diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json b/sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json index 5bdb8f34d0625..231602c1561dc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.1", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "7f530e3727f746e26f5b5ece8a5874daf10cc56f", + "commit": "ee82552b24c170db2826675f397bb3ee04d73309", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/recoveryservices/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.1 --use=@autorest/modelerfour@4.19.2 --version=3.4.2", + "autorest_command": "autorest specification/recoveryservices/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/recoveryservices/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/__init__.py index 725e4b43f3585..c56abeb90c967 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['RecoveryServicesClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_configuration.py index ec9dc244ebca6..7a71a883354ba 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_configuration.py @@ -6,18 +6,16 @@ # 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 @@ -35,20 +33,19 @@ class RecoveryServicesClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(RecoveryServicesClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(RecoveryServicesClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-03-01" + self.api_version = "2021-12-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservices/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +65,4 @@ def _configure( 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-recoveryservices/azure/mgmt/recoveryservices/_metadata.json b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_metadata.json index 3b046a3a96f7c..e3fe29216ec6b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_metadata.json +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2021-03-01", - "total_api_version_list": ["2021-03-01"], + "chosen_version": "2021-12-01", + "total_api_version_list": ["2021-12-01"], "client": { "name": "RecoveryServicesClient", "filename": "_recovery_services_client", "description": "Recovery Services Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": 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\": [\"RecoveryServicesClientConfiguration\"], \"._operations_mixin\": [\"RecoveryServicesClientOperationsMixin\"]}}, \"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\": [\"RecoveryServicesClientConfiguration\"], \"._operations_mixin\": [\"RecoveryServicesClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"RecoveryServicesClientConfiguration\"], \"._operations_mixin\": [\"RecoveryServicesClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"RecoveryServicesClientConfiguration\"], \"._operations_mixin\": [\"RecoveryServicesClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "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\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "vault_certificates": "VaultCertificatesOperations", @@ -109,12 +108,12 @@ "usages": "UsagesOperations" }, "operation_mixins": { - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.exceptions\": [\"ClientAuthenticationError\", \"HttpResponseError\", \"ResourceExistsError\", \"ResourceNotFoundError\", \"map_error\"], \"azure.mgmt.core.exceptions\": [\"ARMErrorFormat\"], \"azure.core.pipeline\": [\"PipelineResponse\"], \"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}, \"stdlib\": {\"warnings\": [null]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Callable\", \"Dict\", \"Generic\", \"Optional\", \"TypeVar\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}}", "operations": { "get_operation_status" : { "sync": { - "signature": "def get_operation_status(\n self,\n resource_group_name, # type: str\n vault_name, # type: str\n operation_id, # type: str\n **kwargs # type: Any\n):\n", + "signature": "def get_operation_status(\n self,\n resource_group_name, # type: str\n vault_name, # type: str\n operation_id, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e \"_models.OperationResource\"\n", "doc": "\"\"\"Gets the operation status for a resource.\n\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param operation_id:\n:type operation_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: OperationResource, or the result of cls(response)\n:rtype: ~azure.mgmt.recoveryservices.models.OperationResource\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { @@ -126,7 +125,7 @@ }, "get_operation_result" : { "sync": { - "signature": "def get_operation_result(\n self,\n resource_group_name, # type: str\n vault_name, # type: str\n operation_id, # type: str\n **kwargs # type: Any\n):\n", + "signature": "def get_operation_result(\n self,\n resource_group_name, # type: str\n vault_name, # type: str\n operation_id, # type: str\n **kwargs # type: Any\n):\n # type: (...) -\u003e Optional[\"_models.Vault\"]\n", "doc": "\"\"\"Gets the operation result for a resource.\n\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param operation_id:\n:type operation_id: str\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: Vault, or the result of cls(response)\n:rtype: ~azure.mgmt.recoveryservices.models.Vault or None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# 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. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_recovery_services_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_recovery_services_client.py index ff2b62b6031f7..82ef433934805 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_recovery_services_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_recovery_services_client.py @@ -6,31 +6,20 @@ # 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, Optional, 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 RecoveryServicesClientConfiguration +from .operations import Operations, PrivateLinkResourcesOperations, RecoveryServicesClientOperationsMixin, RecoveryServicesOperations, RegisteredIdentitiesOperations, ReplicationUsagesOperations, UsagesOperations, VaultCertificatesOperations, VaultExtendedInfoOperations, VaultsOperations + 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 RecoveryServicesClientConfiguration -from .operations import VaultCertificatesOperations -from .operations import RegisteredIdentitiesOperations -from .operations import ReplicationUsagesOperations -from .operations import PrivateLinkResourcesOperations -from .operations import RecoveryServicesOperations -from .operations import VaultsOperations -from .operations import Operations -from .operations import VaultExtendedInfoOperations -from .operations import RecoveryServicesClientOperationsMixin -from .operations import UsagesOperations -from . import models - class RecoveryServicesClient(RecoveryServicesClientOperationsMixin): """Recovery Services Client. @@ -38,11 +27,13 @@ class RecoveryServicesClient(RecoveryServicesClientOperationsMixin): :ivar vault_certificates: VaultCertificatesOperations operations :vartype vault_certificates: azure.mgmt.recoveryservices.operations.VaultCertificatesOperations :ivar registered_identities: RegisteredIdentitiesOperations operations - :vartype registered_identities: azure.mgmt.recoveryservices.operations.RegisteredIdentitiesOperations + :vartype registered_identities: + azure.mgmt.recoveryservices.operations.RegisteredIdentitiesOperations :ivar replication_usages: ReplicationUsagesOperations operations :vartype replication_usages: azure.mgmt.recoveryservices.operations.ReplicationUsagesOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.recoveryservices.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.recoveryservices.operations.PrivateLinkResourcesOperations :ivar recovery_services: RecoveryServicesOperations operations :vartype recovery_services: azure.mgmt.recoveryservices.operations.RecoveryServicesOperations :ivar vaults: VaultsOperations operations @@ -50,71 +41,70 @@ class RecoveryServicesClient(RecoveryServicesClientOperationsMixin): :ivar operations: Operations operations :vartype operations: azure.mgmt.recoveryservices.operations.Operations :ivar vault_extended_info: VaultExtendedInfoOperations operations - :vartype vault_extended_info: azure.mgmt.recoveryservices.operations.VaultExtendedInfoOperations + :vartype vault_extended_info: + azure.mgmt.recoveryservices.operations.VaultExtendedInfoOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.recoveryservices.operations.UsagesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription Id. :type subscription_id: 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 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 - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = RecoveryServicesClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = RecoveryServicesClientConfiguration(credential=credential, subscription_id=subscription_id, **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.vault_certificates = VaultCertificatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registered_identities = RegisteredIdentitiesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.replication_usages = ReplicationUsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.recovery_services = RecoveryServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.vault_extended_info = VaultExtendedInfoOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.vault_certificates = VaultCertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.registered_identities = RegisteredIdentitiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.replication_usages = ReplicationUsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.recovery_services = RecoveryServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.vault_extended_info = VaultExtendedInfoOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: 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/python/protocol/quickstart + + :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'), - } - 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-recoveryservices/azure/mgmt/recoveryservices/_vendor.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_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-recoveryservices/azure/mgmt/recoveryservices/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_version.py index 48944bf3938a2..e5754a47ce68f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/__init__.py index 1134d60092dae..4cf117717d2c3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/__init__.py @@ -8,3 +8,8 @@ from ._recovery_services_client import RecoveryServicesClient __all__ = ['RecoveryServicesClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_configuration.py index 3a503e36d9d21..97d5458dea67e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/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 @@ -37,15 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(RecoveryServicesClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(RecoveryServicesClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-03-01" + self.api_version = "2021-12-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservices/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +64,4 @@ def _configure( 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-recoveryservices/azure/mgmt/recoveryservices/aio/_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# 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. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_recovery_services_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_recovery_services_client.py index 5e0a35fddd937..8c39bcc3efc8c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_recovery_services_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/_recovery_services_client.py @@ -6,111 +6,108 @@ # 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, Optional, 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 ._configuration import RecoveryServicesClientConfiguration +from .operations import Operations, PrivateLinkResourcesOperations, RecoveryServicesClientOperationsMixin, RecoveryServicesOperations, RegisteredIdentitiesOperations, ReplicationUsagesOperations, UsagesOperations, VaultCertificatesOperations, VaultExtendedInfoOperations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import RecoveryServicesClientConfiguration -from .operations import VaultCertificatesOperations -from .operations import RegisteredIdentitiesOperations -from .operations import ReplicationUsagesOperations -from .operations import PrivateLinkResourcesOperations -from .operations import RecoveryServicesOperations -from .operations import VaultsOperations -from .operations import Operations -from .operations import VaultExtendedInfoOperations -from .operations import RecoveryServicesClientOperationsMixin -from .operations import UsagesOperations -from .. import models - - class RecoveryServicesClient(RecoveryServicesClientOperationsMixin): """Recovery Services Client. :ivar vault_certificates: VaultCertificatesOperations operations - :vartype vault_certificates: azure.mgmt.recoveryservices.aio.operations.VaultCertificatesOperations + :vartype vault_certificates: + azure.mgmt.recoveryservices.aio.operations.VaultCertificatesOperations :ivar registered_identities: RegisteredIdentitiesOperations operations - :vartype registered_identities: azure.mgmt.recoveryservices.aio.operations.RegisteredIdentitiesOperations + :vartype registered_identities: + azure.mgmt.recoveryservices.aio.operations.RegisteredIdentitiesOperations :ivar replication_usages: ReplicationUsagesOperations operations - :vartype replication_usages: azure.mgmt.recoveryservices.aio.operations.ReplicationUsagesOperations + :vartype replication_usages: + azure.mgmt.recoveryservices.aio.operations.ReplicationUsagesOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.recoveryservices.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.recoveryservices.aio.operations.PrivateLinkResourcesOperations :ivar recovery_services: RecoveryServicesOperations operations - :vartype recovery_services: azure.mgmt.recoveryservices.aio.operations.RecoveryServicesOperations + :vartype recovery_services: + azure.mgmt.recoveryservices.aio.operations.RecoveryServicesOperations :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.recoveryservices.aio.operations.VaultsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.recoveryservices.aio.operations.Operations :ivar vault_extended_info: VaultExtendedInfoOperations operations - :vartype vault_extended_info: azure.mgmt.recoveryservices.aio.operations.VaultExtendedInfoOperations + :vartype vault_extended_info: + azure.mgmt.recoveryservices.aio.operations.VaultExtendedInfoOperations :ivar usages: UsagesOperations operations :vartype usages: azure.mgmt.recoveryservices.aio.operations.UsagesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription Id. :type subscription_id: 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 int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: 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 = RecoveryServicesClientConfiguration(credential, subscription_id, **kwargs) + self._config = RecoveryServicesClientConfiguration(credential=credential, subscription_id=subscription_id, **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._serialize.client_side_validation = False + self.vault_certificates = VaultCertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.registered_identities = RegisteredIdentitiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.replication_usages = ReplicationUsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.recovery_services = RecoveryServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.vault_extended_info = VaultExtendedInfoOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + - self.vault_certificates = VaultCertificatesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.registered_identities = RegisteredIdentitiesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.replication_usages = ReplicationUsagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.recovery_services = RecoveryServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.vault_extended_info = VaultExtendedInfoOperations( - self._client, self._config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - 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/python/protocol/quickstart + + :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'), - } - 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-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_operations.py index 16f63fd273501..ef756f3e71c3b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.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') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,8 +54,10 @@ def list( """Returns 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 ClientDiscoveryResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservices.models.ClientDiscoveryResponse] + :return: An iterator like instance of either ClientDiscoveryResponse or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservices.models.ClientDiscoveryResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientDiscoveryResponse"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - 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 - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ClientDiscoveryResponse', pipeline_response) + deserialized = self._deserialize("ClientDiscoveryResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_private_link_resources_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_private_link_resources_operations.py index 3363b616ff720..da2d32292b3f5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_private_link_resources_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_private_link_resources_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list( :param vault_name: The name of the recovery services vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResources or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservices.models.PrivateLinkResources] + :return: An iterator like instance of either PrivateLinkResources or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservices.models.PrivateLinkResources] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResources"] @@ -66,36 +74,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResources', pipeline_response) + deserialized = self._deserialize("PrivateLinkResources", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,11 +118,13 @@ 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/{vaultName}/privateLinkResources'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,28 +153,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_link_resource_name=private_link_resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,4 +178,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_client_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_client_operations.py index b603043fea7db..a8b7b34318287 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_client_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_client_operations.py @@ -5,21 +5,26 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._recovery_services_client_operations import build_get_operation_result_request, build_get_operation_status_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class RecoveryServicesClientOperationsMixin: + @distributed_trace_async async def get_operation_status( self, resource_group_name: str, @@ -46,28 +51,18 @@ async def get_operation_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_operation_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + template_url=self.get_operation_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -81,8 +76,11 @@ async def get_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized + get_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationStatus/{operationId}'} # type: ignore + + @distributed_trace_async async def get_operation_result( self, resource_group_name: str, @@ -109,28 +107,18 @@ async def get_operation_result( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get_operation_result.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_operation_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + template_url=self.get_operation_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -146,4 +134,6 @@ async def get_operation_result( return cls(pipeline_response, deserialized, {}) return deserialized + get_operation_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationResults/{operationId}'} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_operations.py index 0978a7d532c90..19cab53af7c91 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._recovery_services_operations import build_check_name_availability_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, resource_group_name: str, @@ -48,8 +53,10 @@ async def check_name_availability( **kwargs: Any ) -> "_models.CheckNameAvailabilityResult": """API to check for resource name availability. - A name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type - or if one or more such resources exist, each of these must be GC'd and their time of deletion be more than 24 Hours Ago. + A name is available if no other resource exists that has the same SubscriptionId, Resource Name + and Type + or if one or more such resources exist, each of these must be GC'd and their time of deletion + be more than 24 Hours Ago. API to check for resource name availability. A name is available if no other resource exists that has the same SubscriptionId, Resource Name @@ -74,32 +81,22 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'location': self._serialize.url("location", location, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(input, 'CheckNameAvailabilityParameters') - # 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') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'CheckNameAvailabilityParameters') - 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 @@ -113,4 +110,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability'} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_registered_identities_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_registered_identities_operations.py index 846fcadfa9080..d2be44a7e3ae6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_registered_identities_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_registered_identities_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._registered_identities_operations import build_delete_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -66,26 +71,18 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'identityName': self._serialize.url("identity_name", identity_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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + identity_name=identity_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - - 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 @@ -97,3 +94,4 @@ async def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/registeredIdentities/{identityName}'} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_replication_usages_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_replication_usages_operations.py index e16b030a5fd57..73edf0c8a806e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_replication_usages_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_replication_usages_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._replication_usages_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -55,8 +61,10 @@ def list( :param vault_name: The name of the recovery services vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationUsageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservices.models.ReplicationUsageList] + :return: An iterator like instance of either ReplicationUsageList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservices.models.ReplicationUsageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicationUsageList"] @@ -64,36 +72,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationUsageList', pipeline_response) + deserialized = self._deserialize("ReplicationUsageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,6 +116,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_usages_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_usages_operations.py index 24da06a762282..303d3c7051607 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_usages_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_usages_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._usages_operations import build_list_by_vaults_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_vaults( self, resource_group_name: str, @@ -56,7 +62,8 @@ def list_by_vaults( :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultUsageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservices.models.VaultUsageList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservices.models.VaultUsageList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultUsageList"] @@ -64,36 +71,33 @@ def list_by_vaults( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - 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_vaults.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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_vaults_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_vaults.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_vaults_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultUsageList', pipeline_response) + deserialized = self._deserialize("VaultUsageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,6 +115,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_certificates_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_certificates_operations.py index c7e33d926362e..9369214af1a4a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_certificates_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_certificates_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._vault_certificates_operations import build_create_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create( self, resource_group_name: str, @@ -69,33 +74,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_request, 'CertificateRequest') - # 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') + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + certificate_name=certificate_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(certificate_request, 'CertificateRequest') - 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) response = pipeline_response.http_response @@ -109,4 +104,6 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/certificates/{certificateName}'} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_extended_info_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_extended_info_operations.py index fe0a956e18859..e71094adae74c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_extended_info_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vault_extended_info_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._vault_extended_info_operations import build_create_or_update_request, build_get_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -63,27 +68,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -97,8 +92,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -114,7 +112,8 @@ async def create_or_update( :param vault_name: The name of the recovery services vault. :type vault_name: str :param resource_extended_info_details: Details of ResourceExtendedInfo. - :type resource_extended_info_details: ~azure.mgmt.recoveryservices.models.VaultExtendedInfoResource + :type resource_extended_info_details: + ~azure.mgmt.recoveryservices.models.VaultExtendedInfoResource :keyword callable cls: A custom type or function that will be passed the direct response :return: VaultExtendedInfoResource, or the result of cls(response) :rtype: ~azure.mgmt.recoveryservices.models.VaultExtendedInfoResource @@ -125,32 +124,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource_extended_info_details, 'VaultExtendedInfoResource') - # 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') + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource_extended_info_details, 'VaultExtendedInfoResource') - 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) response = pipeline_response.http_response @@ -164,8 +153,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -181,7 +173,8 @@ async def update( :param vault_name: The name of the recovery services vault. :type vault_name: str :param resource_extended_info_details: Details of ResourceExtendedInfo. - :type resource_extended_info_details: ~azure.mgmt.recoveryservices.models.VaultExtendedInfoResource + :type resource_extended_info_details: + ~azure.mgmt.recoveryservices.models.VaultExtendedInfoResource :keyword callable cls: A custom type or function that will be passed the direct response :return: VaultExtendedInfoResource, or the result of cls(response) :rtype: ~azure.mgmt.recoveryservices.models.VaultExtendedInfoResource @@ -192,32 +185,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource_extended_info_details, 'VaultExtendedInfoResource') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource_extended_info_details, 'VaultExtendedInfoResource') - 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) response = pipeline_response.http_response @@ -231,4 +214,6 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo'} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vaults_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vaults_operations.py index e3cda9ae0bc63..94bd46a3cfb92 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vaults_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_vaults_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.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._vaults_operations import build_create_or_update_request_initial, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_id_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription_id( self, **kwargs: Any @@ -59,34 +65,29 @@ def list_by_subscription_id( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - 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_subscription_id.metadata['url'] # type: ignore - path_format_arguments = { - '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_by_subscription_id_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_id_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultList', pipeline_response) + deserialized = self._deserialize("VaultList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,11 +105,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/vaults'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -129,35 +132,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - 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_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultList', pipeline_response) + deserialized = self._deserialize("VaultList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -175,11 +174,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -203,27 +204,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -237,8 +228,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -251,32 +244,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vault, 'Vault') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(vault, 'Vault') - 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) response = pipeline_response.http_response @@ -294,8 +277,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -314,15 +300,18 @@ async def begin_create_or_update( :type vault: ~azure.mgmt.recoveryservices.models.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. + :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 Vault or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservices.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -334,27 +323,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vault_name=vault_name, vault=vault, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -366,8 +349,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -391,27 +376,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,6 +399,7 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + async def _update_initial( self, resource_group_name: str, @@ -436,32 +412,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vault, 'PatchVault') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(vault, 'PatchVault') - 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) response = pipeline_response.http_response @@ -477,8 +443,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -497,15 +466,18 @@ async def begin_update( :type vault: ~azure.mgmt.recoveryservices.models.PatchVault :keyword callable cls: A custom type or function that will be passed the direct response :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 Vault or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservices.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -517,27 +489,21 @@ async def begin_update( resource_group_name=resource_group_name, vault_name=vault_name, vault=vault, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -549,4 +515,5 @@ def get_long_running_output(pipeline_response): ) 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/{vaultName}'} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/__init__.py index 5d0519244be45..e0b1891a17e02 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/__init__.py @@ -6,100 +6,54 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import CertificateRequest - from ._models_py3 import CheckNameAvailabilityParameters - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import ClientDiscoveryDisplay - from ._models_py3 import ClientDiscoveryForLogSpecification - from ._models_py3 import ClientDiscoveryForProperties - from ._models_py3 import ClientDiscoveryForServiceSpecification - from ._models_py3 import ClientDiscoveryResponse - from ._models_py3 import ClientDiscoveryValueForSingleApi - from ._models_py3 import CmkKekIdentity - from ._models_py3 import CmkKeyVaultProperties - from ._models_py3 import Error - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import IdentityData - from ._models_py3 import JobsSummary - from ._models_py3 import MonitoringSummary - from ._models_py3 import NameInfo - from ._models_py3 import OperationResource - from ._models_py3 import PatchTrackedResource - from ._models_py3 import PatchVault - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionVaultProperties - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResources - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import RawCertificateData - from ._models_py3 import ReplicationUsage - from ._models_py3 import ReplicationUsageList - from ._models_py3 import Resource - from ._models_py3 import ResourceCertificateAndAadDetails - from ._models_py3 import ResourceCertificateAndAcsDetails - from ._models_py3 import ResourceCertificateDetails - from ._models_py3 import Sku - from ._models_py3 import SystemData - from ._models_py3 import TrackedResource - from ._models_py3 import UpgradeDetails - from ._models_py3 import UserIdentity - from ._models_py3 import Vault - from ._models_py3 import VaultCertificateResponse - from ._models_py3 import VaultExtendedInfoResource - from ._models_py3 import VaultList - from ._models_py3 import VaultProperties - from ._models_py3 import VaultPropertiesEncryption - from ._models_py3 import VaultUsage - from ._models_py3 import VaultUsageList -except (SyntaxError, ImportError): - from ._models import CertificateRequest # type: ignore - from ._models import CheckNameAvailabilityParameters # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import ClientDiscoveryDisplay # type: ignore - from ._models import ClientDiscoveryForLogSpecification # type: ignore - from ._models import ClientDiscoveryForProperties # type: ignore - from ._models import ClientDiscoveryForServiceSpecification # type: ignore - from ._models import ClientDiscoveryResponse # type: ignore - from ._models import ClientDiscoveryValueForSingleApi # type: ignore - from ._models import CmkKekIdentity # type: ignore - from ._models import CmkKeyVaultProperties # type: ignore - from ._models import Error # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import IdentityData # type: ignore - from ._models import JobsSummary # type: ignore - from ._models import MonitoringSummary # type: ignore - from ._models import NameInfo # type: ignore - from ._models import OperationResource # type: ignore - from ._models import PatchTrackedResource # type: ignore - from ._models import PatchVault # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionVaultProperties # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResources # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import RawCertificateData # type: ignore - from ._models import ReplicationUsage # type: ignore - from ._models import ReplicationUsageList # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceCertificateAndAadDetails # type: ignore - from ._models import ResourceCertificateAndAcsDetails # type: ignore - from ._models import ResourceCertificateDetails # type: ignore - from ._models import Sku # type: ignore - from ._models import SystemData # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import UpgradeDetails # type: ignore - from ._models import UserIdentity # type: ignore - from ._models import Vault # type: ignore - from ._models import VaultCertificateResponse # type: ignore - from ._models import VaultExtendedInfoResource # type: ignore - from ._models import VaultList # type: ignore - from ._models import VaultProperties # type: ignore - from ._models import VaultPropertiesEncryption # type: ignore - from ._models import VaultUsage # type: ignore - from ._models import VaultUsageList # type: ignore +from ._models_py3 import CertificateRequest +from ._models_py3 import CheckNameAvailabilityParameters +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import ClientDiscoveryDisplay +from ._models_py3 import ClientDiscoveryForLogSpecification +from ._models_py3 import ClientDiscoveryForProperties +from ._models_py3 import ClientDiscoveryForServiceSpecification +from ._models_py3 import ClientDiscoveryResponse +from ._models_py3 import ClientDiscoveryValueForSingleApi +from ._models_py3 import CmkKekIdentity +from ._models_py3 import CmkKeyVaultProperties +from ._models_py3 import Error +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import IdentityData +from ._models_py3 import JobsSummary +from ._models_py3 import MonitoringSummary +from ._models_py3 import NameInfo +from ._models_py3 import OperationResource +from ._models_py3 import PatchTrackedResource +from ._models_py3 import PatchVault +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionVaultProperties +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResources +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import RawCertificateData +from ._models_py3 import ReplicationUsage +from ._models_py3 import ReplicationUsageList +from ._models_py3 import Resource +from ._models_py3 import ResourceCertificateAndAadDetails +from ._models_py3 import ResourceCertificateAndAcsDetails +from ._models_py3 import ResourceCertificateDetails +from ._models_py3 import Sku +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource +from ._models_py3 import UpgradeDetails +from ._models_py3 import UserIdentity +from ._models_py3 import Vault +from ._models_py3 import VaultCertificateResponse +from ._models_py3 import VaultExtendedInfoResource +from ._models_py3 import VaultList +from ._models_py3 import VaultProperties +from ._models_py3 import VaultPropertiesEncryption +from ._models_py3 import VaultPropertiesMoveDetails +from ._models_py3 import VaultUsage +from ._models_py3 import VaultUsageList + from ._recovery_services_client_enums import ( AuthType, @@ -108,6 +62,7 @@ PrivateEndpointConnectionStatus, ProvisioningState, ResourceIdentityType, + ResourceMoveState, SkuName, TriggerType, UsagesUnit, @@ -160,6 +115,7 @@ 'VaultList', 'VaultProperties', 'VaultPropertiesEncryption', + 'VaultPropertiesMoveDetails', 'VaultUsage', 'VaultUsageList', 'AuthType', @@ -168,6 +124,7 @@ 'PrivateEndpointConnectionStatus', 'ProvisioningState', 'ResourceIdentityType', + 'ResourceMoveState', 'SkuName', 'TriggerType', 'UsagesUnit', diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models.py deleted file mode 100644 index 943a1bba909fd..0000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models.py +++ /dev/null @@ -1,1699 +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 CertificateRequest(msrest.serialization.Model): - """Details of the certificate to be uploaded to the vault. - - :param properties: Raw certificate data. - :type properties: ~azure.mgmt.recoveryservices.models.RawCertificateData - """ - - _attribute_map = { - 'properties': {'key': 'properties', 'type': 'RawCertificateData'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateRequest, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class CheckNameAvailabilityParameters(msrest.serialization.Model): - """Resource Name availability input parameters - Resource type and resource name. - - :param type: Describes the Resource type: Microsoft.RecoveryServices/Vaults. - :type type: str - :param name: Resource name for which availability needs to be checked. - :type name: str - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityParameters, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - self.name = kwargs.get('name', None) - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """Response for check name availability API. Resource provider will set availability as true | false. - - :param name_available: - :type name_available: bool - :param reason: - :type reason: str - :param message: - :type message: str - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class ClientDiscoveryDisplay(msrest.serialization.Model): - """Localized display information of an operation. - - :param provider: Name of the provider for display purposes. - :type provider: str - :param resource: ResourceType for which this Operation can be performed. - :type resource: str - :param operation: Operations Name itself. - :type operation: str - :param description: Description of the operation having details of what operation is about. - :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(ClientDiscoveryDisplay, 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 ClientDiscoveryForLogSpecification(msrest.serialization.Model): - """Class to represent shoebox log specification in json client discovery. - - :param name: Name of the log. - :type name: str - :param display_name: Localized display name. - :type display_name: str - :param blob_duration: Blobs created in customer storage account per hour. - :type blob_duration: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientDiscoveryForLogSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class ClientDiscoveryForProperties(msrest.serialization.Model): - """Class to represent shoebox properties in json client discovery. - - :param service_specification: Operation properties. - :type service_specification: - ~azure.mgmt.recoveryservices.models.ClientDiscoveryForServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ClientDiscoveryForServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientDiscoveryForProperties, self).__init__(**kwargs) - self.service_specification = kwargs.get('service_specification', None) - - -class ClientDiscoveryForServiceSpecification(msrest.serialization.Model): - """Class to represent shoebox service specification in json client discovery. - - :param log_specifications: List of log specifications of this operation. - :type log_specifications: - list[~azure.mgmt.recoveryservices.models.ClientDiscoveryForLogSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[ClientDiscoveryForLogSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientDiscoveryForServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - - -class ClientDiscoveryResponse(msrest.serialization.Model): - """Operations List response which contains list of available APIs. - - :param value: List of available operations. - :type value: list[~azure.mgmt.recoveryservices.models.ClientDiscoveryValueForSingleApi] - :param next_link: Link to the next chunk of the response. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ClientDiscoveryValueForSingleApi]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientDiscoveryResponse, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ClientDiscoveryValueForSingleApi(msrest.serialization.Model): - """Available operation details. - - :param name: Name of the Operation. - :type name: str - :param display: Contains the localized display information for this particular operation. - :type display: ~azure.mgmt.recoveryservices.models.ClientDiscoveryDisplay - :param origin: The intended executor of the operation;governs the display of the operation in - the RBAC UX and the audit logs UX. - :type origin: str - :param properties: ShoeBox properties for the given operation. - :type properties: ~azure.mgmt.recoveryservices.models.ClientDiscoveryForProperties - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ClientDiscoveryDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ClientDiscoveryForProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientDiscoveryValueForSingleApi, 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 CmkKekIdentity(msrest.serialization.Model): - """The details of the identity used for CMK. - - :param use_system_assigned_identity: Indicate that system assigned identity should be used. - Mutually exclusive with 'userAssignedIdentity' field. - :type use_system_assigned_identity: bool - :param user_assigned_identity: The user assigned identity to be used to grant permissions in - case the type of identity used is UserAssigned. - :type user_assigned_identity: str - """ - - _attribute_map = { - 'use_system_assigned_identity': {'key': 'useSystemAssignedIdentity', 'type': 'bool'}, - 'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CmkKekIdentity, self).__init__(**kwargs) - self.use_system_assigned_identity = kwargs.get('use_system_assigned_identity', None) - self.user_assigned_identity = kwargs.get('user_assigned_identity', None) - - -class CmkKeyVaultProperties(msrest.serialization.Model): - """The properties of the Key Vault which hosts CMK. - - :param key_uri: The key uri of the Customer Managed Key. - :type key_uri: str - """ - - _attribute_map = { - 'key_uri': {'key': 'keyUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CmkKeyVaultProperties, self).__init__(**kwargs) - self.key_uri = kwargs.get('key_uri', None) - - -class Error(msrest.serialization.Model): - """The resource management error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.recoveryservices.models.ErrorAdditionalInfo] - :ivar code: The error code. - :vartype code: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.recoveryservices.models.Error] - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - """ - - _validation = { - 'additional_info': {'readonly': True}, - 'code': {'readonly': True}, - 'details': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - } - - _attribute_map = { - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - 'code': {'key': 'code', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[Error]'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Error, self).__init__(**kwargs) - self.additional_info = None - self.code = None - self.details = None - self.message = None - self.target = None - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar info: The additional info. - :vartype info: any - :ivar type: The additional info type. - :vartype type: str - """ - - _validation = { - 'info': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'info': {'key': 'info', 'type': 'object'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.info = None - self.type = None - - -class IdentityData(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: Required. The type of managed identity used. The type 'SystemAssigned, - UserAssigned' includes both an implicitly created identity and a set of user-assigned - identities. The type 'None' will remove any identities. Possible values include: - "SystemAssigned", "None", "UserAssigned", "SystemAssigned, UserAssigned". - :type type: str or ~azure.mgmt.recoveryservices.models.ResourceIdentityType - :param user_assigned_identities: The list of user-assigned identities associated with the - resource. The user-assigned identity dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, ~azure.mgmt.recoveryservices.models.UserIdentity] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserIdentity}'}, - } - - def __init__( - self, - **kwargs - ): - super(IdentityData, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs['type'] - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class JobsSummary(msrest.serialization.Model): - """Summary of the replication job data for this vault. - - :param failed_jobs: Count of failed jobs. - :type failed_jobs: int - :param suspended_jobs: Count of suspended jobs. - :type suspended_jobs: int - :param in_progress_jobs: Count of in-progress jobs. - :type in_progress_jobs: int - """ - - _attribute_map = { - 'failed_jobs': {'key': 'failedJobs', 'type': 'int'}, - 'suspended_jobs': {'key': 'suspendedJobs', 'type': 'int'}, - 'in_progress_jobs': {'key': 'inProgressJobs', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(JobsSummary, self).__init__(**kwargs) - self.failed_jobs = kwargs.get('failed_jobs', None) - self.suspended_jobs = kwargs.get('suspended_jobs', None) - self.in_progress_jobs = kwargs.get('in_progress_jobs', None) - - -class MonitoringSummary(msrest.serialization.Model): - """Summary of the replication monitoring data for this vault. - - :param un_healthy_vm_count: Count of unhealthy VMs. - :type un_healthy_vm_count: int - :param un_healthy_provider_count: Count of unhealthy replication providers. - :type un_healthy_provider_count: int - :param events_count: Count of all critical warnings. - :type events_count: int - :param deprecated_provider_count: Count of all deprecated recovery service providers. - :type deprecated_provider_count: int - :param supported_provider_count: Count of all the supported recovery service providers. - :type supported_provider_count: int - :param unsupported_provider_count: Count of all the unsupported recovery service providers. - :type unsupported_provider_count: int - """ - - _attribute_map = { - 'un_healthy_vm_count': {'key': 'unHealthyVmCount', 'type': 'int'}, - 'un_healthy_provider_count': {'key': 'unHealthyProviderCount', 'type': 'int'}, - 'events_count': {'key': 'eventsCount', 'type': 'int'}, - 'deprecated_provider_count': {'key': 'deprecatedProviderCount', 'type': 'int'}, - 'supported_provider_count': {'key': 'supportedProviderCount', 'type': 'int'}, - 'unsupported_provider_count': {'key': 'unsupportedProviderCount', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(MonitoringSummary, self).__init__(**kwargs) - self.un_healthy_vm_count = kwargs.get('un_healthy_vm_count', None) - self.un_healthy_provider_count = kwargs.get('un_healthy_provider_count', None) - self.events_count = kwargs.get('events_count', None) - self.deprecated_provider_count = kwargs.get('deprecated_provider_count', None) - self.supported_provider_count = kwargs.get('supported_provider_count', None) - self.unsupported_provider_count = kwargs.get('unsupported_provider_count', None) - - -class NameInfo(msrest.serialization.Model): - """The name of usage. - - :param value: Value of usage. - :type value: str - :param localized_value: Localized value of usage. - :type localized_value: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'localized_value': {'key': 'localizedValue', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NameInfo, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.localized_value = kwargs.get('localized_value', None) - - -class OperationResource(msrest.serialization.Model): - """Operation Resource. - - :param end_time: End time of the operation. - :type end_time: ~datetime.datetime - :param error: Required if status == failed or status == canceled. This is the OData v4 error - format, used by the RPC and will go into the v2.2 Azure REST API guidelines. - :type error: ~azure.mgmt.recoveryservices.models.Error - :param id: It should match what is used to GET the operation result. - :type id: str - :param name: It must match the last segment of the "id" field, and will typically be a GUID / - system generated value. - :type name: str - :param status: The status of the operation. (InProgress/Success/Failed/Cancelled). - :type status: str - :param start_time: Start time of the operation. - :type start_time: ~datetime.datetime - """ - - _attribute_map = { - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'Error'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResource, self).__init__(**kwargs) - self.end_time = kwargs.get('end_time', None) - self.error = kwargs.get('error', None) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.status = kwargs.get('status', None) - self.start_time = kwargs.get('start_time', None) - - -class Resource(msrest.serialization.Model): - """ARM Resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :param etag: Optional ETag. - :type etag: 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'}, - 'etag': {'key': 'etag', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.etag = kwargs.get('etag', None) - - -class PatchTrackedResource(Resource): - """Tracked resource with location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :param etag: Optional ETag. - :type etag: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, 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'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(PatchTrackedResource, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - - -class PatchVault(PatchTrackedResource): - """Patch Resource information, as returned by the resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :param etag: Optional ETag. - :type etag: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.recoveryservices.models.VaultProperties - :param sku: Identifies the unique system identifier for each Azure resource. - :type sku: ~azure.mgmt.recoveryservices.models.Sku - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.recoveryservices.models.IdentityData - """ - - _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'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'VaultProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'identity': {'key': 'identity', 'type': 'IdentityData'}, - } - - def __init__( - self, - **kwargs - ): - super(PatchVault, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - self.sku = kwargs.get('sku', None) - self.identity = kwargs.get('identity', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint network resource that is linked to the Private Endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Gets or sets id. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(msrest.serialization.Model): - """Private Endpoint Connection Response Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Gets or sets provisioning state of the private endpoint connection. - Possible values include: "Succeeded", "Deleting", "Failed", "Pending". - :vartype provisioning_state: str or ~azure.mgmt.recoveryservices.models.ProvisioningState - :ivar private_endpoint: The Private Endpoint network resource that is linked to the Private - Endpoint connection. - :vartype private_endpoint: ~azure.mgmt.recoveryservices.models.PrivateEndpoint - :ivar private_link_service_connection_state: Gets or sets private link service connection - state. - :vartype private_link_service_connection_state: - ~azure.mgmt.recoveryservices.models.PrivateLinkServiceConnectionState - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'private_endpoint': {'readonly': True}, - 'private_link_service_connection_state': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'private_endpoint': {'key': 'privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.provisioning_state = None - self.private_endpoint = None - self.private_link_service_connection_state = None - - -class PrivateEndpointConnectionVaultProperties(msrest.serialization.Model): - """Information to be stored in Vault properties as an element of privateEndpointConnections List. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Format of id - subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.[Service]/{resource}/{resourceName}/privateEndpointConnections/{connectionName}. - :vartype id: str - :ivar properties: Private Endpoint Connection Response Properties. - :vartype properties: ~azure.mgmt.recoveryservices.models.PrivateEndpointConnection - """ - - _validation = { - 'id': {'readonly': True}, - 'properties': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnection'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionVaultProperties, self).__init__(**kwargs) - self.id = None - self.properties = None - - -class PrivateLinkResource(msrest.serialization.Model): - """Information of the private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: e.g. Microsoft.RecoveryServices/vaults/privateLinkResources. - :vartype type: str - :ivar group_id: e.g. f9ad6492-33d4-4690-9999-6bfd52a0d081 (Backup) or - f9ad6492-33d4-4690-9999-6bfd52a0d082 (SiteRecovery). - :vartype group_id: str - :ivar required_members: [backup-ecs1, backup-prot1, backup-prot1b, backup-prot1c, backup-id1]. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource Private link DNS zone name. - :vartype required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - 'required_zone_names': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.group_id = None - self.required_members = None - self.required_zone_names = None - - -class PrivateLinkResources(msrest.serialization.Model): - """Class which represent the stamps associated with the vault. - - :param value: A collection of private link resources. - :type value: list[~azure.mgmt.recoveryservices.models.PrivateLinkResource] - :param next_link: Link to the next chunk of the response. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResources, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """Gets or sets private link service connection state. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: Gets or sets the status. Possible values include: "Pending", "Approved", - "Rejected", "Disconnected". - :vartype status: str or ~azure.mgmt.recoveryservices.models.PrivateEndpointConnectionStatus - :ivar description: Gets or sets description. - :vartype description: str - :ivar actions_required: Gets or sets actions required. - :vartype actions_required: str - """ - - _validation = { - 'status': {'readonly': True}, - 'description': {'readonly': True}, - 'actions_required': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = None - self.description = None - self.actions_required = None - - -class RawCertificateData(msrest.serialization.Model): - """Raw certificate data. - - :param auth_type: Specifies the authentication type. Possible values include: "Invalid", "ACS", - "AAD", "AccessControlService", "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.recoveryservices.models.AuthType - :param certificate: The base64 encoded certificate raw data string. - :type certificate: bytearray - """ - - _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'certificate': {'key': 'certificate', 'type': 'bytearray'}, - } - - def __init__( - self, - **kwargs - ): - super(RawCertificateData, self).__init__(**kwargs) - self.auth_type = kwargs.get('auth_type', None) - self.certificate = kwargs.get('certificate', None) - - -class ReplicationUsage(msrest.serialization.Model): - """Replication usages of a vault. - - :param monitoring_summary: Summary of the replication monitoring data for this vault. - :type monitoring_summary: ~azure.mgmt.recoveryservices.models.MonitoringSummary - :param jobs_summary: Summary of the replication jobs data for this vault. - :type jobs_summary: ~azure.mgmt.recoveryservices.models.JobsSummary - :param protected_item_count: Number of replication protected items for this vault. - :type protected_item_count: int - :param recovery_plan_count: Number of replication recovery plans for this vault. - :type recovery_plan_count: int - :param registered_servers_count: Number of servers registered to this vault. - :type registered_servers_count: int - :param recovery_services_provider_auth_type: The authentication type of recovery service - providers in the vault. - :type recovery_services_provider_auth_type: int - """ - - _attribute_map = { - 'monitoring_summary': {'key': 'monitoringSummary', 'type': 'MonitoringSummary'}, - 'jobs_summary': {'key': 'jobsSummary', 'type': 'JobsSummary'}, - 'protected_item_count': {'key': 'protectedItemCount', 'type': 'int'}, - 'recovery_plan_count': {'key': 'recoveryPlanCount', 'type': 'int'}, - 'registered_servers_count': {'key': 'registeredServersCount', 'type': 'int'}, - 'recovery_services_provider_auth_type': {'key': 'recoveryServicesProviderAuthType', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationUsage, self).__init__(**kwargs) - self.monitoring_summary = kwargs.get('monitoring_summary', None) - self.jobs_summary = kwargs.get('jobs_summary', None) - self.protected_item_count = kwargs.get('protected_item_count', None) - self.recovery_plan_count = kwargs.get('recovery_plan_count', None) - self.registered_servers_count = kwargs.get('registered_servers_count', None) - self.recovery_services_provider_auth_type = kwargs.get('recovery_services_provider_auth_type', None) - - -class ReplicationUsageList(msrest.serialization.Model): - """Replication usages for vault. - - :param value: The list of replication usages for the given vault. - :type value: list[~azure.mgmt.recoveryservices.models.ReplicationUsage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ReplicationUsage]'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationUsageList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ResourceCertificateDetails(msrest.serialization.Model): - """Certificate details representing the Vault credentials. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ResourceCertificateAndAcsDetails, ResourceCertificateAndAadDetails. - - All required parameters must be populated in order to send to Azure. - - :param auth_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. - :type auth_type: str - :param certificate: The base64 encoded certificate raw data string. - :type certificate: bytearray - :param friendly_name: Certificate friendly name. - :type friendly_name: str - :param issuer: Certificate issuer. - :type issuer: str - :param resource_id: Resource ID of the vault. - :type resource_id: long - :param subject: Certificate Subject Name. - :type subject: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - :param valid_from: Certificate Validity start Date time. - :type valid_from: ~datetime.datetime - :param valid_to: Certificate Validity End Date time. - :type valid_to: ~datetime.datetime - """ - - _validation = { - 'auth_type': {'required': True}, - } - - _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'certificate': {'key': 'certificate', 'type': 'bytearray'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'issuer': {'key': 'issuer', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'long'}, - 'subject': {'key': 'subject', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'valid_from': {'key': 'validFrom', 'type': 'iso-8601'}, - 'valid_to': {'key': 'validTo', 'type': 'iso-8601'}, - } - - _subtype_map = { - 'auth_type': {'AccessControlService': 'ResourceCertificateAndAcsDetails', 'AzureActiveDirectory': 'ResourceCertificateAndAadDetails'} - } - - def __init__( - self, - **kwargs - ): - super(ResourceCertificateDetails, self).__init__(**kwargs) - self.auth_type = None # type: Optional[str] - self.certificate = kwargs.get('certificate', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.issuer = kwargs.get('issuer', None) - self.resource_id = kwargs.get('resource_id', None) - self.subject = kwargs.get('subject', None) - self.thumbprint = kwargs.get('thumbprint', None) - self.valid_from = kwargs.get('valid_from', None) - self.valid_to = kwargs.get('valid_to', None) - - -class ResourceCertificateAndAadDetails(ResourceCertificateDetails): - """Certificate details representing the Vault credentials for AAD. - - All required parameters must be populated in order to send to Azure. - - :param auth_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. - :type auth_type: str - :param certificate: The base64 encoded certificate raw data string. - :type certificate: bytearray - :param friendly_name: Certificate friendly name. - :type friendly_name: str - :param issuer: Certificate issuer. - :type issuer: str - :param resource_id: Resource ID of the vault. - :type resource_id: long - :param subject: Certificate Subject Name. - :type subject: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - :param valid_from: Certificate Validity start Date time. - :type valid_from: ~datetime.datetime - :param valid_to: Certificate Validity End Date time. - :type valid_to: ~datetime.datetime - :param aad_authority: Required. AAD tenant authority. - :type aad_authority: str - :param aad_tenant_id: Required. AAD tenant Id. - :type aad_tenant_id: str - :param service_principal_client_id: Required. AAD service principal clientId. - :type service_principal_client_id: str - :param service_principal_object_id: Required. AAD service principal ObjectId. - :type service_principal_object_id: str - :param azure_management_endpoint_audience: Required. Azure Management Endpoint Audience. - :type azure_management_endpoint_audience: str - :param service_resource_id: Service Resource Id. - :type service_resource_id: str - """ - - _validation = { - 'auth_type': {'required': True}, - 'aad_authority': {'required': True}, - 'aad_tenant_id': {'required': True}, - 'service_principal_client_id': {'required': True}, - 'service_principal_object_id': {'required': True}, - 'azure_management_endpoint_audience': {'required': True}, - } - - _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'certificate': {'key': 'certificate', 'type': 'bytearray'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'issuer': {'key': 'issuer', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'long'}, - 'subject': {'key': 'subject', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'valid_from': {'key': 'validFrom', 'type': 'iso-8601'}, - 'valid_to': {'key': 'validTo', 'type': 'iso-8601'}, - 'aad_authority': {'key': 'aadAuthority', 'type': 'str'}, - 'aad_tenant_id': {'key': 'aadTenantId', 'type': 'str'}, - 'service_principal_client_id': {'key': 'servicePrincipalClientId', 'type': 'str'}, - 'service_principal_object_id': {'key': 'servicePrincipalObjectId', 'type': 'str'}, - 'azure_management_endpoint_audience': {'key': 'azureManagementEndpointAudience', 'type': 'str'}, - 'service_resource_id': {'key': 'serviceResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceCertificateAndAadDetails, self).__init__(**kwargs) - self.auth_type = 'AzureActiveDirectory' # type: str - self.aad_authority = kwargs['aad_authority'] - self.aad_tenant_id = kwargs['aad_tenant_id'] - self.service_principal_client_id = kwargs['service_principal_client_id'] - self.service_principal_object_id = kwargs['service_principal_object_id'] - self.azure_management_endpoint_audience = kwargs['azure_management_endpoint_audience'] - self.service_resource_id = kwargs.get('service_resource_id', None) - - -class ResourceCertificateAndAcsDetails(ResourceCertificateDetails): - """Certificate details representing the Vault credentials for ACS. - - All required parameters must be populated in order to send to Azure. - - :param auth_type: Required. This property will be used as the discriminator for deciding the - specific types in the polymorphic chain of types.Constant filled by server. - :type auth_type: str - :param certificate: The base64 encoded certificate raw data string. - :type certificate: bytearray - :param friendly_name: Certificate friendly name. - :type friendly_name: str - :param issuer: Certificate issuer. - :type issuer: str - :param resource_id: Resource ID of the vault. - :type resource_id: long - :param subject: Certificate Subject Name. - :type subject: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - :param valid_from: Certificate Validity start Date time. - :type valid_from: ~datetime.datetime - :param valid_to: Certificate Validity End Date time. - :type valid_to: ~datetime.datetime - :param global_acs_namespace: Required. ACS namespace name - tenant for our service. - :type global_acs_namespace: str - :param global_acs_host_name: Required. Acs mgmt host name to connect to. - :type global_acs_host_name: str - :param global_acs_rp_realm: Required. Global ACS namespace RP realm. - :type global_acs_rp_realm: str - """ - - _validation = { - 'auth_type': {'required': True}, - 'global_acs_namespace': {'required': True}, - 'global_acs_host_name': {'required': True}, - 'global_acs_rp_realm': {'required': True}, - } - - _attribute_map = { - 'auth_type': {'key': 'authType', 'type': 'str'}, - 'certificate': {'key': 'certificate', 'type': 'bytearray'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'issuer': {'key': 'issuer', 'type': 'str'}, - 'resource_id': {'key': 'resourceId', 'type': 'long'}, - 'subject': {'key': 'subject', 'type': 'str'}, - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'valid_from': {'key': 'validFrom', 'type': 'iso-8601'}, - 'valid_to': {'key': 'validTo', 'type': 'iso-8601'}, - 'global_acs_namespace': {'key': 'globalAcsNamespace', 'type': 'str'}, - 'global_acs_host_name': {'key': 'globalAcsHostName', 'type': 'str'}, - 'global_acs_rp_realm': {'key': 'globalAcsRPRealm', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceCertificateAndAcsDetails, self).__init__(**kwargs) - self.auth_type = 'AccessControlService' # type: str - self.global_acs_namespace = kwargs['global_acs_namespace'] - self.global_acs_host_name = kwargs['global_acs_host_name'] - self.global_acs_rp_realm = kwargs['global_acs_rp_realm'] - - -class Sku(msrest.serialization.Model): - """Identifies the unique system identifier for each Azure resource. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The Sku name. Possible values include: "Standard", "RS0". - :type name: str or ~azure.mgmt.recoveryservices.models.SkuName - :param tier: The Sku tier. - :type tier: str - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = kwargs.get('tier', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.recoveryservices.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.recoveryservices.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TrackedResource(Resource): - """Tracked resource with location. - - 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 id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :param etag: Optional ETag. - :type etag: str - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - - -class UpgradeDetails(msrest.serialization.Model): - """Details for upgrading vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar operation_id: ID of the vault upgrade operation. - :vartype operation_id: str - :ivar start_time_utc: UTC time at which the upgrade operation has started. - :vartype start_time_utc: ~datetime.datetime - :ivar last_updated_time_utc: UTC time at which the upgrade operation status was last updated. - :vartype last_updated_time_utc: ~datetime.datetime - :ivar end_time_utc: UTC time at which the upgrade operation has ended. - :vartype end_time_utc: ~datetime.datetime - :ivar status: Status of the vault upgrade operation. Possible values include: "Unknown", - "InProgress", "Upgraded", "Failed". - :vartype status: str or ~azure.mgmt.recoveryservices.models.VaultUpgradeState - :ivar message: Message to the user containing information about the upgrade operation. - :vartype message: str - :ivar trigger_type: The way the vault upgrade was triggered. Possible values include: - "UserTriggered", "ForcedUpgrade". - :vartype trigger_type: str or ~azure.mgmt.recoveryservices.models.TriggerType - :ivar upgraded_resource_id: Resource ID of the upgraded vault. - :vartype upgraded_resource_id: str - :ivar previous_resource_id: Resource ID of the vault before the upgrade. - :vartype previous_resource_id: str - """ - - _validation = { - 'operation_id': {'readonly': True}, - 'start_time_utc': {'readonly': True}, - 'last_updated_time_utc': {'readonly': True}, - 'end_time_utc': {'readonly': True}, - 'status': {'readonly': True}, - 'message': {'readonly': True}, - 'trigger_type': {'readonly': True}, - 'upgraded_resource_id': {'readonly': True}, - 'previous_resource_id': {'readonly': True}, - } - - _attribute_map = { - 'operation_id': {'key': 'operationId', 'type': 'str'}, - 'start_time_utc': {'key': 'startTimeUtc', 'type': 'iso-8601'}, - 'last_updated_time_utc': {'key': 'lastUpdatedTimeUtc', 'type': 'iso-8601'}, - 'end_time_utc': {'key': 'endTimeUtc', 'type': 'iso-8601'}, - 'status': {'key': 'status', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'trigger_type': {'key': 'triggerType', 'type': 'str'}, - 'upgraded_resource_id': {'key': 'upgradedResourceId', 'type': 'str'}, - 'previous_resource_id': {'key': 'previousResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpgradeDetails, self).__init__(**kwargs) - self.operation_id = None - self.start_time_utc = None - self.last_updated_time_utc = None - self.end_time_utc = None - self.status = None - self.message = None - self.trigger_type = None - self.upgraded_resource_id = None - self.previous_resource_id = None - - -class UserIdentity(msrest.serialization.Model): - """A resource identity that is managed by the user of the service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the user-assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the user-assigned identity. - :vartype client_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserIdentity, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class Vault(TrackedResource): - """Resource information, as returned by the resource 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. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :param etag: Optional ETag. - :type etag: str - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.recoveryservices.models.IdentityData - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.recoveryservices.models.VaultProperties - :param sku: Identifies the unique system identifier for each Azure resource. - :type sku: ~azure.mgmt.recoveryservices.models.Sku - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.recoveryservices.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'IdentityData'}, - 'properties': {'key': 'properties', 'type': 'VaultProperties'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Vault, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.properties = kwargs.get('properties', None) - self.sku = kwargs.get('sku', None) - self.system_data = None - - -class VaultCertificateResponse(msrest.serialization.Model): - """Certificate corresponding to a vault that can be used by clients to register themselves with the vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :param properties: Certificate details representing the Vault credentials. - :type properties: ~azure.mgmt.recoveryservices.models.ResourceCertificateDetails - """ - - _validation = { - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'id': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'ResourceCertificateDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultCertificateResponse, self).__init__(**kwargs) - self.name = None - self.type = None - self.id = None - self.properties = kwargs.get('properties', None) - - -class VaultExtendedInfoResource(Resource): - """Vault extended information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :param etag: Optional ETag. - :type etag: str - :param integrity_key: Integrity key. - :type integrity_key: str - :param encryption_key: Encryption key. - :type encryption_key: str - :param encryption_key_thumbprint: Encryption key thumbprint. - :type encryption_key_thumbprint: str - :param algorithm: Algorithm for Vault ExtendedInfo. - :type algorithm: 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'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'integrity_key': {'key': 'properties.integrityKey', 'type': 'str'}, - 'encryption_key': {'key': 'properties.encryptionKey', 'type': 'str'}, - 'encryption_key_thumbprint': {'key': 'properties.encryptionKeyThumbprint', 'type': 'str'}, - 'algorithm': {'key': 'properties.algorithm', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultExtendedInfoResource, self).__init__(**kwargs) - self.integrity_key = kwargs.get('integrity_key', None) - self.encryption_key = kwargs.get('encryption_key', None) - self.encryption_key_thumbprint = kwargs.get('encryption_key_thumbprint', None) - self.algorithm = kwargs.get('algorithm', None) - - -class VaultList(msrest.serialization.Model): - """The response model for a list of Vaults. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: list[~azure.mgmt.recoveryservices.models.Vault] - :ivar next_link: - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Vault]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class VaultProperties(msrest.serialization.Model): - """Properties of the vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning State. - :vartype provisioning_state: str - :param upgrade_details: Details for upgrading vault. - :type upgrade_details: ~azure.mgmt.recoveryservices.models.UpgradeDetails - :ivar private_endpoint_connections: List of private endpoint connection. - :vartype private_endpoint_connections: - list[~azure.mgmt.recoveryservices.models.PrivateEndpointConnectionVaultProperties] - :ivar private_endpoint_state_for_backup: Private endpoint state for backup. Possible values - include: "None", "Enabled". - :vartype private_endpoint_state_for_backup: str or - ~azure.mgmt.recoveryservices.models.VaultPrivateEndpointState - :ivar private_endpoint_state_for_site_recovery: Private endpoint state for site recovery. - Possible values include: "None", "Enabled". - :vartype private_endpoint_state_for_site_recovery: str or - ~azure.mgmt.recoveryservices.models.VaultPrivateEndpointState - :param encryption: Customer Managed Key details of the resource. - :type encryption: ~azure.mgmt.recoveryservices.models.VaultPropertiesEncryption - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'private_endpoint_state_for_backup': {'readonly': True}, - 'private_endpoint_state_for_site_recovery': {'readonly': True}, - } - - _attribute_map = { - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'upgrade_details': {'key': 'upgradeDetails', 'type': 'UpgradeDetails'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionVaultProperties]'}, - 'private_endpoint_state_for_backup': {'key': 'privateEndpointStateForBackup', 'type': 'str'}, - 'private_endpoint_state_for_site_recovery': {'key': 'privateEndpointStateForSiteRecovery', 'type': 'str'}, - 'encryption': {'key': 'encryption', 'type': 'VaultPropertiesEncryption'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.upgrade_details = kwargs.get('upgrade_details', None) - self.private_endpoint_connections = None - self.private_endpoint_state_for_backup = None - self.private_endpoint_state_for_site_recovery = None - self.encryption = kwargs.get('encryption', None) - - -class VaultPropertiesEncryption(msrest.serialization.Model): - """Customer Managed Key details of the resource. - - :param key_vault_properties: The properties of the Key Vault which hosts CMK. - :type key_vault_properties: ~azure.mgmt.recoveryservices.models.CmkKeyVaultProperties - :param kek_identity: The details of the identity used for CMK. - :type kek_identity: ~azure.mgmt.recoveryservices.models.CmkKekIdentity - :param infrastructure_encryption: Enabling/Disabling the Double Encryption state. Possible - values include: "Enabled", "Disabled". - :type infrastructure_encryption: str or - ~azure.mgmt.recoveryservices.models.InfrastructureEncryptionState - """ - - _attribute_map = { - 'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'CmkKeyVaultProperties'}, - 'kek_identity': {'key': 'kekIdentity', 'type': 'CmkKekIdentity'}, - 'infrastructure_encryption': {'key': 'infrastructureEncryption', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultPropertiesEncryption, self).__init__(**kwargs) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - self.kek_identity = kwargs.get('kek_identity', None) - self.infrastructure_encryption = kwargs.get('infrastructure_encryption', None) - - -class VaultUsage(msrest.serialization.Model): - """Usages of a vault. - - :param unit: Unit of the usage. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountPerSecond", "BytesPerSecond". - :type unit: str or ~azure.mgmt.recoveryservices.models.UsagesUnit - :param quota_period: Quota period of usage. - :type quota_period: str - :param next_reset_time: Next reset time of usage. - :type next_reset_time: ~datetime.datetime - :param current_value: Current value of usage. - :type current_value: long - :param limit: Limit of usage. - :type limit: long - :param name: Name of usage. - :type name: ~azure.mgmt.recoveryservices.models.NameInfo - """ - - _attribute_map = { - 'unit': {'key': 'unit', 'type': 'str'}, - 'quota_period': {'key': 'quotaPeriod', 'type': 'str'}, - 'next_reset_time': {'key': 'nextResetTime', 'type': 'iso-8601'}, - 'current_value': {'key': 'currentValue', 'type': 'long'}, - 'limit': {'key': 'limit', 'type': 'long'}, - 'name': {'key': 'name', 'type': 'NameInfo'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultUsage, self).__init__(**kwargs) - self.unit = kwargs.get('unit', None) - self.quota_period = kwargs.get('quota_period', None) - self.next_reset_time = kwargs.get('next_reset_time', None) - self.current_value = kwargs.get('current_value', None) - self.limit = kwargs.get('limit', None) - self.name = kwargs.get('name', None) - - -class VaultUsageList(msrest.serialization.Model): - """Usage for vault. - - :param value: The list of usages for the given vault. - :type value: list[~azure.mgmt.recoveryservices.models.VaultUsage] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[VaultUsage]'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultUsageList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models_py3.py index 51c474475d052..e9edd6a0dec1c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models_py3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models_py3.py @@ -17,8 +17,8 @@ class CertificateRequest(msrest.serialization.Model): """Details of the certificate to be uploaded to the vault. - :param properties: Raw certificate data. - :type properties: ~azure.mgmt.recoveryservices.models.RawCertificateData + :ivar properties: Raw certificate data. + :vartype properties: ~azure.mgmt.recoveryservices.models.RawCertificateData """ _attribute_map = { @@ -31,6 +31,10 @@ def __init__( properties: Optional["RawCertificateData"] = None, **kwargs ): + """ + :keyword properties: Raw certificate data. + :paramtype properties: ~azure.mgmt.recoveryservices.models.RawCertificateData + """ super(CertificateRequest, self).__init__(**kwargs) self.properties = properties @@ -38,10 +42,10 @@ def __init__( class CheckNameAvailabilityParameters(msrest.serialization.Model): """Resource Name availability input parameters - Resource type and resource name. - :param type: Describes the Resource type: Microsoft.RecoveryServices/Vaults. - :type type: str - :param name: Resource name for which availability needs to be checked. - :type name: str + :ivar type: Describes the Resource type: Microsoft.RecoveryServices/Vaults. + :vartype type: str + :ivar name: Resource name for which availability needs to be checked. + :vartype name: str """ _attribute_map = { @@ -56,6 +60,12 @@ def __init__( name: Optional[str] = None, **kwargs ): + """ + :keyword type: Describes the Resource type: Microsoft.RecoveryServices/Vaults. + :paramtype type: str + :keyword name: Resource name for which availability needs to be checked. + :paramtype name: str + """ super(CheckNameAvailabilityParameters, self).__init__(**kwargs) self.type = type self.name = name @@ -64,12 +74,12 @@ def __init__( class CheckNameAvailabilityResult(msrest.serialization.Model): """Response for check name availability API. Resource provider will set availability as true | false. - :param name_available: - :type name_available: bool - :param reason: - :type reason: str - :param message: - :type message: str + :ivar name_available: + :vartype name_available: bool + :ivar reason: + :vartype reason: str + :ivar message: + :vartype message: str """ _attribute_map = { @@ -86,6 +96,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword name_available: + :paramtype name_available: bool + :keyword reason: + :paramtype reason: str + :keyword message: + :paramtype message: str + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = name_available self.reason = reason @@ -95,14 +113,14 @@ def __init__( class ClientDiscoveryDisplay(msrest.serialization.Model): """Localized display information of an operation. - :param provider: Name of the provider for display purposes. - :type provider: str - :param resource: ResourceType for which this Operation can be performed. - :type resource: str - :param operation: Operations Name itself. - :type operation: str - :param description: Description of the operation having details of what operation is about. - :type description: str + :ivar provider: Name of the provider for display purposes. + :vartype provider: str + :ivar resource: ResourceType for which this Operation can be performed. + :vartype resource: str + :ivar operation: Operations Name itself. + :vartype operation: str + :ivar description: Description of the operation having details of what operation is about. + :vartype description: str """ _attribute_map = { @@ -121,6 +139,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Name of the provider for display purposes. + :paramtype provider: str + :keyword resource: ResourceType for which this Operation can be performed. + :paramtype resource: str + :keyword operation: Operations Name itself. + :paramtype operation: str + :keyword description: Description of the operation having details of what operation is about. + :paramtype description: str + """ super(ClientDiscoveryDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -131,12 +159,12 @@ def __init__( class ClientDiscoveryForLogSpecification(msrest.serialization.Model): """Class to represent shoebox log specification in json client discovery. - :param name: Name of the log. - :type name: str - :param display_name: Localized display name. - :type display_name: str - :param blob_duration: Blobs created in customer storage account per hour. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized display name. + :vartype display_name: str + :ivar blob_duration: Blobs created in customer storage account per hour. + :vartype blob_duration: str """ _attribute_map = { @@ -153,6 +181,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized display name. + :paramtype display_name: str + :keyword blob_duration: Blobs created in customer storage account per hour. + :paramtype blob_duration: str + """ super(ClientDiscoveryForLogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -162,8 +198,8 @@ def __init__( class ClientDiscoveryForProperties(msrest.serialization.Model): """Class to represent shoebox properties in json client discovery. - :param service_specification: Operation properties. - :type service_specification: + :ivar service_specification: Operation properties. + :vartype service_specification: ~azure.mgmt.recoveryservices.models.ClientDiscoveryForServiceSpecification """ @@ -177,6 +213,11 @@ def __init__( service_specification: Optional["ClientDiscoveryForServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Operation properties. + :paramtype service_specification: + ~azure.mgmt.recoveryservices.models.ClientDiscoveryForServiceSpecification + """ super(ClientDiscoveryForProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -184,8 +225,8 @@ def __init__( class ClientDiscoveryForServiceSpecification(msrest.serialization.Model): """Class to represent shoebox service specification in json client discovery. - :param log_specifications: List of log specifications of this operation. - :type log_specifications: + :ivar log_specifications: List of log specifications of this operation. + :vartype log_specifications: list[~azure.mgmt.recoveryservices.models.ClientDiscoveryForLogSpecification] """ @@ -199,6 +240,11 @@ def __init__( log_specifications: Optional[List["ClientDiscoveryForLogSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: List of log specifications of this operation. + :paramtype log_specifications: + list[~azure.mgmt.recoveryservices.models.ClientDiscoveryForLogSpecification] + """ super(ClientDiscoveryForServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications @@ -206,10 +252,10 @@ def __init__( class ClientDiscoveryResponse(msrest.serialization.Model): """Operations List response which contains list of available APIs. - :param value: List of available operations. - :type value: list[~azure.mgmt.recoveryservices.models.ClientDiscoveryValueForSingleApi] - :param next_link: Link to the next chunk of the response. - :type next_link: str + :ivar value: List of available operations. + :vartype value: list[~azure.mgmt.recoveryservices.models.ClientDiscoveryValueForSingleApi] + :ivar next_link: Link to the next chunk of the response. + :vartype next_link: str """ _attribute_map = { @@ -224,6 +270,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of available operations. + :paramtype value: list[~azure.mgmt.recoveryservices.models.ClientDiscoveryValueForSingleApi] + :keyword next_link: Link to the next chunk of the response. + :paramtype next_link: str + """ super(ClientDiscoveryResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -232,15 +284,15 @@ def __init__( class ClientDiscoveryValueForSingleApi(msrest.serialization.Model): """Available operation details. - :param name: Name of the Operation. - :type name: str - :param display: Contains the localized display information for this particular operation. - :type display: ~azure.mgmt.recoveryservices.models.ClientDiscoveryDisplay - :param origin: The intended executor of the operation;governs the display of the operation in + :ivar name: Name of the Operation. + :vartype name: str + :ivar display: Contains the localized display information for this particular operation. + :vartype display: ~azure.mgmt.recoveryservices.models.ClientDiscoveryDisplay + :ivar origin: The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX. - :type origin: str - :param properties: ShoeBox properties for the given operation. - :type properties: ~azure.mgmt.recoveryservices.models.ClientDiscoveryForProperties + :vartype origin: str + :ivar properties: ShoeBox properties for the given operation. + :vartype properties: ~azure.mgmt.recoveryservices.models.ClientDiscoveryForProperties """ _attribute_map = { @@ -259,6 +311,17 @@ def __init__( properties: Optional["ClientDiscoveryForProperties"] = None, **kwargs ): + """ + :keyword name: Name of the Operation. + :paramtype name: str + :keyword display: Contains the localized display information for this particular operation. + :paramtype display: ~azure.mgmt.recoveryservices.models.ClientDiscoveryDisplay + :keyword origin: The intended executor of the operation;governs the display of the operation in + the RBAC UX and the audit logs UX. + :paramtype origin: str + :keyword properties: ShoeBox properties for the given operation. + :paramtype properties: ~azure.mgmt.recoveryservices.models.ClientDiscoveryForProperties + """ super(ClientDiscoveryValueForSingleApi, self).__init__(**kwargs) self.name = name self.display = display @@ -269,12 +332,12 @@ def __init__( class CmkKekIdentity(msrest.serialization.Model): """The details of the identity used for CMK. - :param use_system_assigned_identity: Indicate that system assigned identity should be used. + :ivar use_system_assigned_identity: Indicate that system assigned identity should be used. Mutually exclusive with 'userAssignedIdentity' field. - :type use_system_assigned_identity: bool - :param user_assigned_identity: The user assigned identity to be used to grant permissions in + :vartype use_system_assigned_identity: bool + :ivar user_assigned_identity: The user assigned identity to be used to grant permissions in case the type of identity used is UserAssigned. - :type user_assigned_identity: str + :vartype user_assigned_identity: str """ _attribute_map = { @@ -289,6 +352,14 @@ def __init__( user_assigned_identity: Optional[str] = None, **kwargs ): + """ + :keyword use_system_assigned_identity: Indicate that system assigned identity should be used. + Mutually exclusive with 'userAssignedIdentity' field. + :paramtype use_system_assigned_identity: bool + :keyword user_assigned_identity: The user assigned identity to be used to grant permissions in + case the type of identity used is UserAssigned. + :paramtype user_assigned_identity: str + """ super(CmkKekIdentity, self).__init__(**kwargs) self.use_system_assigned_identity = use_system_assigned_identity self.user_assigned_identity = user_assigned_identity @@ -297,8 +368,8 @@ def __init__( class CmkKeyVaultProperties(msrest.serialization.Model): """The properties of the Key Vault which hosts CMK. - :param key_uri: The key uri of the Customer Managed Key. - :type key_uri: str + :ivar key_uri: The key uri of the Customer Managed Key. + :vartype key_uri: str """ _attribute_map = { @@ -311,6 +382,10 @@ def __init__( key_uri: Optional[str] = None, **kwargs ): + """ + :keyword key_uri: The key uri of the Customer Managed Key. + :paramtype key_uri: str + """ super(CmkKeyVaultProperties, self).__init__(**kwargs) self.key_uri = key_uri @@ -352,6 +427,8 @@ def __init__( self, **kwargs ): + """ + """ super(Error, self).__init__(**kwargs) self.additional_info = None self.code = None @@ -385,6 +462,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.info = None self.type = None @@ -401,15 +480,15 @@ class IdentityData(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: Required. The type of managed identity used. The type 'SystemAssigned, + :ivar type: Required. The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities. Possible values include: "SystemAssigned", "None", "UserAssigned", "SystemAssigned, UserAssigned". - :type type: str or ~azure.mgmt.recoveryservices.models.ResourceIdentityType - :param user_assigned_identities: The list of user-assigned identities associated with the + :vartype type: str or ~azure.mgmt.recoveryservices.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user-assigned identities associated with the resource. The user-assigned identity dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, ~azure.mgmt.recoveryservices.models.UserIdentity] + :vartype user_assigned_identities: dict[str, ~azure.mgmt.recoveryservices.models.UserIdentity] """ _validation = { @@ -432,6 +511,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserIdentity"]] = None, **kwargs ): + """ + :keyword type: Required. The type of managed identity used. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user-assigned + identities. The type 'None' will remove any identities. Possible values include: + "SystemAssigned", "None", "UserAssigned", "SystemAssigned, UserAssigned". + :paramtype type: str or ~azure.mgmt.recoveryservices.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user-assigned identities associated with the + resource. The user-assigned identity dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.recoveryservices.models.UserIdentity] + """ super(IdentityData, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -442,12 +533,12 @@ def __init__( class JobsSummary(msrest.serialization.Model): """Summary of the replication job data for this vault. - :param failed_jobs: Count of failed jobs. - :type failed_jobs: int - :param suspended_jobs: Count of suspended jobs. - :type suspended_jobs: int - :param in_progress_jobs: Count of in-progress jobs. - :type in_progress_jobs: int + :ivar failed_jobs: Count of failed jobs. + :vartype failed_jobs: int + :ivar suspended_jobs: Count of suspended jobs. + :vartype suspended_jobs: int + :ivar in_progress_jobs: Count of in-progress jobs. + :vartype in_progress_jobs: int """ _attribute_map = { @@ -464,6 +555,14 @@ def __init__( in_progress_jobs: Optional[int] = None, **kwargs ): + """ + :keyword failed_jobs: Count of failed jobs. + :paramtype failed_jobs: int + :keyword suspended_jobs: Count of suspended jobs. + :paramtype suspended_jobs: int + :keyword in_progress_jobs: Count of in-progress jobs. + :paramtype in_progress_jobs: int + """ super(JobsSummary, self).__init__(**kwargs) self.failed_jobs = failed_jobs self.suspended_jobs = suspended_jobs @@ -473,18 +572,18 @@ def __init__( class MonitoringSummary(msrest.serialization.Model): """Summary of the replication monitoring data for this vault. - :param un_healthy_vm_count: Count of unhealthy VMs. - :type un_healthy_vm_count: int - :param un_healthy_provider_count: Count of unhealthy replication providers. - :type un_healthy_provider_count: int - :param events_count: Count of all critical warnings. - :type events_count: int - :param deprecated_provider_count: Count of all deprecated recovery service providers. - :type deprecated_provider_count: int - :param supported_provider_count: Count of all the supported recovery service providers. - :type supported_provider_count: int - :param unsupported_provider_count: Count of all the unsupported recovery service providers. - :type unsupported_provider_count: int + :ivar un_healthy_vm_count: Count of unhealthy VMs. + :vartype un_healthy_vm_count: int + :ivar un_healthy_provider_count: Count of unhealthy replication providers. + :vartype un_healthy_provider_count: int + :ivar events_count: Count of all critical warnings. + :vartype events_count: int + :ivar deprecated_provider_count: Count of all deprecated recovery service providers. + :vartype deprecated_provider_count: int + :ivar supported_provider_count: Count of all the supported recovery service providers. + :vartype supported_provider_count: int + :ivar unsupported_provider_count: Count of all the unsupported recovery service providers. + :vartype unsupported_provider_count: int """ _attribute_map = { @@ -507,6 +606,20 @@ def __init__( unsupported_provider_count: Optional[int] = None, **kwargs ): + """ + :keyword un_healthy_vm_count: Count of unhealthy VMs. + :paramtype un_healthy_vm_count: int + :keyword un_healthy_provider_count: Count of unhealthy replication providers. + :paramtype un_healthy_provider_count: int + :keyword events_count: Count of all critical warnings. + :paramtype events_count: int + :keyword deprecated_provider_count: Count of all deprecated recovery service providers. + :paramtype deprecated_provider_count: int + :keyword supported_provider_count: Count of all the supported recovery service providers. + :paramtype supported_provider_count: int + :keyword unsupported_provider_count: Count of all the unsupported recovery service providers. + :paramtype unsupported_provider_count: int + """ super(MonitoringSummary, self).__init__(**kwargs) self.un_healthy_vm_count = un_healthy_vm_count self.un_healthy_provider_count = un_healthy_provider_count @@ -519,10 +632,10 @@ def __init__( class NameInfo(msrest.serialization.Model): """The name of usage. - :param value: Value of usage. - :type value: str - :param localized_value: Localized value of usage. - :type localized_value: str + :ivar value: Value of usage. + :vartype value: str + :ivar localized_value: Localized value of usage. + :vartype localized_value: str """ _attribute_map = { @@ -537,6 +650,12 @@ def __init__( localized_value: Optional[str] = None, **kwargs ): + """ + :keyword value: Value of usage. + :paramtype value: str + :keyword localized_value: Localized value of usage. + :paramtype localized_value: str + """ super(NameInfo, self).__init__(**kwargs) self.value = value self.localized_value = localized_value @@ -545,20 +664,20 @@ def __init__( class OperationResource(msrest.serialization.Model): """Operation Resource. - :param end_time: End time of the operation. - :type end_time: ~datetime.datetime - :param error: Required if status == failed or status == canceled. This is the OData v4 error + :ivar end_time: End time of the operation. + :vartype end_time: ~datetime.datetime + :ivar error: Required if status == failed or status == canceled. This is the OData v4 error format, used by the RPC and will go into the v2.2 Azure REST API guidelines. - :type error: ~azure.mgmt.recoveryservices.models.Error - :param id: It should match what is used to GET the operation result. - :type id: str - :param name: It must match the last segment of the "id" field, and will typically be a GUID / + :vartype error: ~azure.mgmt.recoveryservices.models.Error + :ivar id: It should match what is used to GET the operation result. + :vartype id: str + :ivar name: It must match the last segment of the "id" field, and will typically be a GUID / system generated value. - :type name: str - :param status: The status of the operation. (InProgress/Success/Failed/Cancelled). - :type status: str - :param start_time: Start time of the operation. - :type start_time: ~datetime.datetime + :vartype name: str + :ivar status: The status of the operation. (InProgress/Success/Failed/Cancelled). + :vartype status: str + :ivar start_time: Start time of the operation. + :vartype start_time: ~datetime.datetime """ _attribute_map = { @@ -581,6 +700,22 @@ def __init__( start_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword end_time: End time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword error: Required if status == failed or status == canceled. This is the OData v4 error + format, used by the RPC and will go into the v2.2 Azure REST API guidelines. + :paramtype error: ~azure.mgmt.recoveryservices.models.Error + :keyword id: It should match what is used to GET the operation result. + :paramtype id: str + :keyword name: It must match the last segment of the "id" field, and will typically be a GUID / + system generated value. + :paramtype name: str + :keyword status: The status of the operation. (InProgress/Success/Failed/Cancelled). + :paramtype status: str + :keyword start_time: Start time of the operation. + :paramtype start_time: ~datetime.datetime + """ super(OperationResource, self).__init__(**kwargs) self.end_time = end_time self.error = error @@ -602,8 +737,8 @@ class Resource(msrest.serialization.Model): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param etag: Optional ETag. - :type etag: str + :ivar etag: Optional ETag. + :vartype etag: str """ _validation = { @@ -625,6 +760,10 @@ def __init__( etag: Optional[str] = None, **kwargs ): + """ + :keyword etag: Optional ETag. + :paramtype etag: str + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -644,12 +783,12 @@ class PatchTrackedResource(Resource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param etag: Optional ETag. - :type etag: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar etag: Optional ETag. + :vartype etag: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -675,6 +814,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword etag: Optional ETag. + :paramtype etag: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(PatchTrackedResource, self).__init__(etag=etag, **kwargs) self.location = location self.tags = tags @@ -692,18 +839,18 @@ class PatchVault(PatchTrackedResource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param etag: Optional ETag. - :type etag: str - :param location: Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.recoveryservices.models.VaultProperties - :param sku: Identifies the unique system identifier for each Azure resource. - :type sku: ~azure.mgmt.recoveryservices.models.Sku - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.recoveryservices.models.IdentityData + :ivar etag: Optional ETag. + :vartype etag: str + :ivar location: Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.recoveryservices.models.VaultProperties + :ivar sku: Identifies the unique system identifier for each Azure resource. + :vartype sku: ~azure.mgmt.recoveryservices.models.Sku + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.recoveryservices.models.IdentityData """ _validation = { @@ -735,6 +882,20 @@ def __init__( identity: Optional["IdentityData"] = None, **kwargs ): + """ + :keyword etag: Optional ETag. + :paramtype etag: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.recoveryservices.models.VaultProperties + :keyword sku: Identifies the unique system identifier for each Azure resource. + :paramtype sku: ~azure.mgmt.recoveryservices.models.Sku + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.recoveryservices.models.IdentityData + """ super(PatchVault, self).__init__(etag=etag, location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku @@ -762,6 +923,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -799,6 +962,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.provisioning_state = None self.private_endpoint = None @@ -815,25 +980,43 @@ class PrivateEndpointConnectionVaultProperties(msrest.serialization.Model): :vartype id: str :ivar properties: Private Endpoint Connection Response Properties. :vartype properties: ~azure.mgmt.recoveryservices.models.PrivateEndpointConnection + :ivar name: The name of the private Endpoint Connection. + :vartype name: str + :ivar type: The type, which will be of the format, + Microsoft.RecoveryServices/vaults/privateEndpointConnections. + :vartype type: str + :ivar location: The location of the private Endpoint connection. + :vartype location: str """ _validation = { 'id': {'readonly': True}, 'properties': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'properties': {'key': 'properties', 'type': 'PrivateEndpointConnection'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, } def __init__( self, **kwargs ): + """ + """ super(PrivateEndpointConnectionVaultProperties, self).__init__(**kwargs) self.id = None self.properties = None + self.name = None + self.type = None + self.location = None class PrivateLinkResource(msrest.serialization.Model): @@ -878,6 +1061,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateLinkResource, self).__init__(**kwargs) self.id = None self.name = None @@ -890,10 +1075,10 @@ def __init__( class PrivateLinkResources(msrest.serialization.Model): """Class which represent the stamps associated with the vault. - :param value: A collection of private link resources. - :type value: list[~azure.mgmt.recoveryservices.models.PrivateLinkResource] - :param next_link: Link to the next chunk of the response. - :type next_link: str + :ivar value: A collection of private link resources. + :vartype value: list[~azure.mgmt.recoveryservices.models.PrivateLinkResource] + :ivar next_link: Link to the next chunk of the response. + :vartype next_link: str """ _attribute_map = { @@ -908,6 +1093,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: A collection of private link resources. + :paramtype value: list[~azure.mgmt.recoveryservices.models.PrivateLinkResource] + :keyword next_link: Link to the next chunk of the response. + :paramtype next_link: str + """ super(PrivateLinkResources, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -943,6 +1134,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = None self.description = None @@ -952,11 +1145,11 @@ def __init__( class RawCertificateData(msrest.serialization.Model): """Raw certificate data. - :param auth_type: Specifies the authentication type. Possible values include: "Invalid", "ACS", + :ivar auth_type: Specifies the authentication type. Possible values include: "Invalid", "ACS", "AAD", "AccessControlService", "AzureActiveDirectory". - :type auth_type: str or ~azure.mgmt.recoveryservices.models.AuthType - :param certificate: The base64 encoded certificate raw data string. - :type certificate: bytearray + :vartype auth_type: str or ~azure.mgmt.recoveryservices.models.AuthType + :ivar certificate: The base64 encoded certificate raw data string. + :vartype certificate: bytearray """ _attribute_map = { @@ -971,6 +1164,13 @@ def __init__( certificate: Optional[bytearray] = None, **kwargs ): + """ + :keyword auth_type: Specifies the authentication type. Possible values include: "Invalid", + "ACS", "AAD", "AccessControlService", "AzureActiveDirectory". + :paramtype auth_type: str or ~azure.mgmt.recoveryservices.models.AuthType + :keyword certificate: The base64 encoded certificate raw data string. + :paramtype certificate: bytearray + """ super(RawCertificateData, self).__init__(**kwargs) self.auth_type = auth_type self.certificate = certificate @@ -979,19 +1179,19 @@ def __init__( class ReplicationUsage(msrest.serialization.Model): """Replication usages of a vault. - :param monitoring_summary: Summary of the replication monitoring data for this vault. - :type monitoring_summary: ~azure.mgmt.recoveryservices.models.MonitoringSummary - :param jobs_summary: Summary of the replication jobs data for this vault. - :type jobs_summary: ~azure.mgmt.recoveryservices.models.JobsSummary - :param protected_item_count: Number of replication protected items for this vault. - :type protected_item_count: int - :param recovery_plan_count: Number of replication recovery plans for this vault. - :type recovery_plan_count: int - :param registered_servers_count: Number of servers registered to this vault. - :type registered_servers_count: int - :param recovery_services_provider_auth_type: The authentication type of recovery service + :ivar monitoring_summary: Summary of the replication monitoring data for this vault. + :vartype monitoring_summary: ~azure.mgmt.recoveryservices.models.MonitoringSummary + :ivar jobs_summary: Summary of the replication jobs data for this vault. + :vartype jobs_summary: ~azure.mgmt.recoveryservices.models.JobsSummary + :ivar protected_item_count: Number of replication protected items for this vault. + :vartype protected_item_count: int + :ivar recovery_plan_count: Number of replication recovery plans for this vault. + :vartype recovery_plan_count: int + :ivar registered_servers_count: Number of servers registered to this vault. + :vartype registered_servers_count: int + :ivar recovery_services_provider_auth_type: The authentication type of recovery service providers in the vault. - :type recovery_services_provider_auth_type: int + :vartype recovery_services_provider_auth_type: int """ _attribute_map = { @@ -1014,6 +1214,21 @@ def __init__( recovery_services_provider_auth_type: Optional[int] = None, **kwargs ): + """ + :keyword monitoring_summary: Summary of the replication monitoring data for this vault. + :paramtype monitoring_summary: ~azure.mgmt.recoveryservices.models.MonitoringSummary + :keyword jobs_summary: Summary of the replication jobs data for this vault. + :paramtype jobs_summary: ~azure.mgmt.recoveryservices.models.JobsSummary + :keyword protected_item_count: Number of replication protected items for this vault. + :paramtype protected_item_count: int + :keyword recovery_plan_count: Number of replication recovery plans for this vault. + :paramtype recovery_plan_count: int + :keyword registered_servers_count: Number of servers registered to this vault. + :paramtype registered_servers_count: int + :keyword recovery_services_provider_auth_type: The authentication type of recovery service + providers in the vault. + :paramtype recovery_services_provider_auth_type: int + """ super(ReplicationUsage, self).__init__(**kwargs) self.monitoring_summary = monitoring_summary self.jobs_summary = jobs_summary @@ -1026,8 +1241,8 @@ def __init__( class ReplicationUsageList(msrest.serialization.Model): """Replication usages for vault. - :param value: The list of replication usages for the given vault. - :type value: list[~azure.mgmt.recoveryservices.models.ReplicationUsage] + :ivar value: The list of replication usages for the given vault. + :vartype value: list[~azure.mgmt.recoveryservices.models.ReplicationUsage] """ _attribute_map = { @@ -1040,6 +1255,10 @@ def __init__( value: Optional[List["ReplicationUsage"]] = None, **kwargs ): + """ + :keyword value: The list of replication usages for the given vault. + :paramtype value: list[~azure.mgmt.recoveryservices.models.ReplicationUsage] + """ super(ReplicationUsageList, self).__init__(**kwargs) self.value = value @@ -1052,25 +1271,25 @@ class ResourceCertificateDetails(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. This property will be used as the discriminator for deciding the + :ivar auth_type: Required. This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types.Constant filled by server. - :type auth_type: str - :param certificate: The base64 encoded certificate raw data string. - :type certificate: bytearray - :param friendly_name: Certificate friendly name. - :type friendly_name: str - :param issuer: Certificate issuer. - :type issuer: str - :param resource_id: Resource ID of the vault. - :type resource_id: long - :param subject: Certificate Subject Name. - :type subject: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - :param valid_from: Certificate Validity start Date time. - :type valid_from: ~datetime.datetime - :param valid_to: Certificate Validity End Date time. - :type valid_to: ~datetime.datetime + :vartype auth_type: str + :ivar certificate: The base64 encoded certificate raw data string. + :vartype certificate: bytearray + :ivar friendly_name: Certificate friendly name. + :vartype friendly_name: str + :ivar issuer: Certificate issuer. + :vartype issuer: str + :ivar resource_id: Resource ID of the vault. + :vartype resource_id: long + :ivar subject: Certificate Subject Name. + :vartype subject: str + :ivar thumbprint: Certificate thumbprint. + :vartype thumbprint: str + :ivar valid_from: Certificate Validity start Date time. + :vartype valid_from: ~datetime.datetime + :ivar valid_to: Certificate Validity End Date time. + :vartype valid_to: ~datetime.datetime """ _validation = { @@ -1106,6 +1325,24 @@ def __init__( valid_to: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword certificate: The base64 encoded certificate raw data string. + :paramtype certificate: bytearray + :keyword friendly_name: Certificate friendly name. + :paramtype friendly_name: str + :keyword issuer: Certificate issuer. + :paramtype issuer: str + :keyword resource_id: Resource ID of the vault. + :paramtype resource_id: long + :keyword subject: Certificate Subject Name. + :paramtype subject: str + :keyword thumbprint: Certificate thumbprint. + :paramtype thumbprint: str + :keyword valid_from: Certificate Validity start Date time. + :paramtype valid_from: ~datetime.datetime + :keyword valid_to: Certificate Validity End Date time. + :paramtype valid_to: ~datetime.datetime + """ super(ResourceCertificateDetails, self).__init__(**kwargs) self.auth_type = None # type: Optional[str] self.certificate = certificate @@ -1123,37 +1360,37 @@ class ResourceCertificateAndAadDetails(ResourceCertificateDetails): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. This property will be used as the discriminator for deciding the + :ivar auth_type: Required. This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types.Constant filled by server. - :type auth_type: str - :param certificate: The base64 encoded certificate raw data string. - :type certificate: bytearray - :param friendly_name: Certificate friendly name. - :type friendly_name: str - :param issuer: Certificate issuer. - :type issuer: str - :param resource_id: Resource ID of the vault. - :type resource_id: long - :param subject: Certificate Subject Name. - :type subject: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - :param valid_from: Certificate Validity start Date time. - :type valid_from: ~datetime.datetime - :param valid_to: Certificate Validity End Date time. - :type valid_to: ~datetime.datetime - :param aad_authority: Required. AAD tenant authority. - :type aad_authority: str - :param aad_tenant_id: Required. AAD tenant Id. - :type aad_tenant_id: str - :param service_principal_client_id: Required. AAD service principal clientId. - :type service_principal_client_id: str - :param service_principal_object_id: Required. AAD service principal ObjectId. - :type service_principal_object_id: str - :param azure_management_endpoint_audience: Required. Azure Management Endpoint Audience. - :type azure_management_endpoint_audience: str - :param service_resource_id: Service Resource Id. - :type service_resource_id: str + :vartype auth_type: str + :ivar certificate: The base64 encoded certificate raw data string. + :vartype certificate: bytearray + :ivar friendly_name: Certificate friendly name. + :vartype friendly_name: str + :ivar issuer: Certificate issuer. + :vartype issuer: str + :ivar resource_id: Resource ID of the vault. + :vartype resource_id: long + :ivar subject: Certificate Subject Name. + :vartype subject: str + :ivar thumbprint: Certificate thumbprint. + :vartype thumbprint: str + :ivar valid_from: Certificate Validity start Date time. + :vartype valid_from: ~datetime.datetime + :ivar valid_to: Certificate Validity End Date time. + :vartype valid_to: ~datetime.datetime + :ivar aad_authority: Required. AAD tenant authority. + :vartype aad_authority: str + :ivar aad_tenant_id: Required. AAD tenant Id. + :vartype aad_tenant_id: str + :ivar service_principal_client_id: Required. AAD service principal clientId. + :vartype service_principal_client_id: str + :ivar service_principal_object_id: Required. AAD service principal ObjectId. + :vartype service_principal_object_id: str + :ivar azure_management_endpoint_audience: Required. Azure Management Endpoint Audience. + :vartype azure_management_endpoint_audience: str + :ivar service_resource_id: Service Resource Id. + :vartype service_resource_id: str """ _validation = { @@ -1202,6 +1439,36 @@ def __init__( service_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword certificate: The base64 encoded certificate raw data string. + :paramtype certificate: bytearray + :keyword friendly_name: Certificate friendly name. + :paramtype friendly_name: str + :keyword issuer: Certificate issuer. + :paramtype issuer: str + :keyword resource_id: Resource ID of the vault. + :paramtype resource_id: long + :keyword subject: Certificate Subject Name. + :paramtype subject: str + :keyword thumbprint: Certificate thumbprint. + :paramtype thumbprint: str + :keyword valid_from: Certificate Validity start Date time. + :paramtype valid_from: ~datetime.datetime + :keyword valid_to: Certificate Validity End Date time. + :paramtype valid_to: ~datetime.datetime + :keyword aad_authority: Required. AAD tenant authority. + :paramtype aad_authority: str + :keyword aad_tenant_id: Required. AAD tenant Id. + :paramtype aad_tenant_id: str + :keyword service_principal_client_id: Required. AAD service principal clientId. + :paramtype service_principal_client_id: str + :keyword service_principal_object_id: Required. AAD service principal ObjectId. + :paramtype service_principal_object_id: str + :keyword azure_management_endpoint_audience: Required. Azure Management Endpoint Audience. + :paramtype azure_management_endpoint_audience: str + :keyword service_resource_id: Service Resource Id. + :paramtype service_resource_id: str + """ super(ResourceCertificateAndAadDetails, self).__init__(certificate=certificate, friendly_name=friendly_name, issuer=issuer, resource_id=resource_id, subject=subject, thumbprint=thumbprint, valid_from=valid_from, valid_to=valid_to, **kwargs) self.auth_type = 'AzureActiveDirectory' # type: str self.aad_authority = aad_authority @@ -1217,31 +1484,31 @@ class ResourceCertificateAndAcsDetails(ResourceCertificateDetails): All required parameters must be populated in order to send to Azure. - :param auth_type: Required. This property will be used as the discriminator for deciding the + :ivar auth_type: Required. This property will be used as the discriminator for deciding the specific types in the polymorphic chain of types.Constant filled by server. - :type auth_type: str - :param certificate: The base64 encoded certificate raw data string. - :type certificate: bytearray - :param friendly_name: Certificate friendly name. - :type friendly_name: str - :param issuer: Certificate issuer. - :type issuer: str - :param resource_id: Resource ID of the vault. - :type resource_id: long - :param subject: Certificate Subject Name. - :type subject: str - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - :param valid_from: Certificate Validity start Date time. - :type valid_from: ~datetime.datetime - :param valid_to: Certificate Validity End Date time. - :type valid_to: ~datetime.datetime - :param global_acs_namespace: Required. ACS namespace name - tenant for our service. - :type global_acs_namespace: str - :param global_acs_host_name: Required. Acs mgmt host name to connect to. - :type global_acs_host_name: str - :param global_acs_rp_realm: Required. Global ACS namespace RP realm. - :type global_acs_rp_realm: str + :vartype auth_type: str + :ivar certificate: The base64 encoded certificate raw data string. + :vartype certificate: bytearray + :ivar friendly_name: Certificate friendly name. + :vartype friendly_name: str + :ivar issuer: Certificate issuer. + :vartype issuer: str + :ivar resource_id: Resource ID of the vault. + :vartype resource_id: long + :ivar subject: Certificate Subject Name. + :vartype subject: str + :ivar thumbprint: Certificate thumbprint. + :vartype thumbprint: str + :ivar valid_from: Certificate Validity start Date time. + :vartype valid_from: ~datetime.datetime + :ivar valid_to: Certificate Validity End Date time. + :vartype valid_to: ~datetime.datetime + :ivar global_acs_namespace: Required. ACS namespace name - tenant for our service. + :vartype global_acs_namespace: str + :ivar global_acs_host_name: Required. Acs mgmt host name to connect to. + :vartype global_acs_host_name: str + :ivar global_acs_rp_realm: Required. Global ACS namespace RP realm. + :vartype global_acs_rp_realm: str """ _validation = { @@ -1282,6 +1549,30 @@ def __init__( valid_to: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword certificate: The base64 encoded certificate raw data string. + :paramtype certificate: bytearray + :keyword friendly_name: Certificate friendly name. + :paramtype friendly_name: str + :keyword issuer: Certificate issuer. + :paramtype issuer: str + :keyword resource_id: Resource ID of the vault. + :paramtype resource_id: long + :keyword subject: Certificate Subject Name. + :paramtype subject: str + :keyword thumbprint: Certificate thumbprint. + :paramtype thumbprint: str + :keyword valid_from: Certificate Validity start Date time. + :paramtype valid_from: ~datetime.datetime + :keyword valid_to: Certificate Validity End Date time. + :paramtype valid_to: ~datetime.datetime + :keyword global_acs_namespace: Required. ACS namespace name - tenant for our service. + :paramtype global_acs_namespace: str + :keyword global_acs_host_name: Required. Acs mgmt host name to connect to. + :paramtype global_acs_host_name: str + :keyword global_acs_rp_realm: Required. Global ACS namespace RP realm. + :paramtype global_acs_rp_realm: str + """ super(ResourceCertificateAndAcsDetails, self).__init__(certificate=certificate, friendly_name=friendly_name, issuer=issuer, resource_id=resource_id, subject=subject, thumbprint=thumbprint, valid_from=valid_from, valid_to=valid_to, **kwargs) self.auth_type = 'AccessControlService' # type: str self.global_acs_namespace = global_acs_namespace @@ -1294,10 +1585,16 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The Sku name. Possible values include: "Standard", "RS0". - :type name: str or ~azure.mgmt.recoveryservices.models.SkuName - :param tier: The Sku tier. - :type tier: str + :ivar name: Required. The Sku name. Possible values include: "Standard", "RS0". + :vartype name: str or ~azure.mgmt.recoveryservices.models.SkuName + :ivar tier: The Sku tier. + :vartype tier: str + :ivar family: The sku family. + :vartype family: str + :ivar size: The sku size. + :vartype size: str + :ivar capacity: The sku capacity. + :vartype capacity: str """ _validation = { @@ -1307,6 +1604,9 @@ class Sku(msrest.serialization.Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'tier': {'key': 'tier', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'str'}, } def __init__( @@ -1314,30 +1614,48 @@ def __init__( *, name: Union[str, "SkuName"], tier: Optional[str] = None, + family: Optional[str] = None, + size: Optional[str] = None, + capacity: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. The Sku name. Possible values include: "Standard", "RS0". + :paramtype name: str or ~azure.mgmt.recoveryservices.models.SkuName + :keyword tier: The Sku tier. + :paramtype tier: str + :keyword family: The sku family. + :paramtype family: str + :keyword size: The sku size. + :paramtype size: str + :keyword capacity: The sku capacity. + :paramtype capacity: str + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier + self.family = family + self.size = size + self.capacity = capacity class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.recoveryservices.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.recoveryservices.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.recoveryservices.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.recoveryservices.models.CreatedByType + :ivar last_modified_at: The type of identity that last modified the resource. + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1360,6 +1678,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.recoveryservices.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.recoveryservices.models.CreatedByType + :keyword last_modified_at: The type of identity that last modified the resource. + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -1383,12 +1717,12 @@ class TrackedResource(Resource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param etag: Optional ETag. - :type etag: str - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar etag: Optional ETag. + :vartype etag: str + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -1415,6 +1749,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword etag: Optional ETag. + :paramtype etag: str + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(TrackedResource, self).__init__(etag=etag, **kwargs) self.location = location self.tags = tags @@ -1475,6 +1817,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpgradeDetails, self).__init__(**kwargs) self.operation_id = None self.start_time_utc = None @@ -1512,6 +1856,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -1531,18 +1877,18 @@ class Vault(TrackedResource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param etag: Optional ETag. - :type etag: str - :param location: Required. Resource location. - :type location: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: Identity for the resource. - :type identity: ~azure.mgmt.recoveryservices.models.IdentityData - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.recoveryservices.models.VaultProperties - :param sku: Identifies the unique system identifier for each Azure resource. - :type sku: ~azure.mgmt.recoveryservices.models.Sku + :ivar etag: Optional ETag. + :vartype etag: str + :ivar location: Required. Resource location. + :vartype location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.recoveryservices.models.IdentityData + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.recoveryservices.models.VaultProperties + :ivar sku: Identifies the unique system identifier for each Azure resource. + :vartype sku: ~azure.mgmt.recoveryservices.models.Sku :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.recoveryservices.models.SystemData """ @@ -1579,6 +1925,20 @@ def __init__( sku: Optional["Sku"] = None, **kwargs ): + """ + :keyword etag: Optional ETag. + :paramtype etag: str + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.recoveryservices.models.IdentityData + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.recoveryservices.models.VaultProperties + :keyword sku: Identifies the unique system identifier for each Azure resource. + :paramtype sku: ~azure.mgmt.recoveryservices.models.Sku + """ super(Vault, self).__init__(etag=etag, location=location, tags=tags, **kwargs) self.identity = identity self.properties = properties @@ -1598,8 +1958,8 @@ class VaultCertificateResponse(msrest.serialization.Model): :vartype type: str :ivar id: Resource Id represents the complete path to the resource. :vartype id: str - :param properties: Certificate details representing the Vault credentials. - :type properties: ~azure.mgmt.recoveryservices.models.ResourceCertificateDetails + :ivar properties: Certificate details representing the Vault credentials. + :vartype properties: ~azure.mgmt.recoveryservices.models.ResourceCertificateDetails """ _validation = { @@ -1621,6 +1981,10 @@ def __init__( properties: Optional["ResourceCertificateDetails"] = None, **kwargs ): + """ + :keyword properties: Certificate details representing the Vault credentials. + :paramtype properties: ~azure.mgmt.recoveryservices.models.ResourceCertificateDetails + """ super(VaultCertificateResponse, self).__init__(**kwargs) self.name = None self.type = None @@ -1640,16 +2004,16 @@ class VaultExtendedInfoResource(Resource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param etag: Optional ETag. - :type etag: str - :param integrity_key: Integrity key. - :type integrity_key: str - :param encryption_key: Encryption key. - :type encryption_key: str - :param encryption_key_thumbprint: Encryption key thumbprint. - :type encryption_key_thumbprint: str - :param algorithm: Algorithm for Vault ExtendedInfo. - :type algorithm: str + :ivar etag: Optional ETag. + :vartype etag: str + :ivar integrity_key: Integrity key. + :vartype integrity_key: str + :ivar encryption_key: Encryption key. + :vartype encryption_key: str + :ivar encryption_key_thumbprint: Encryption key thumbprint. + :vartype encryption_key_thumbprint: str + :ivar algorithm: Algorithm for Vault ExtendedInfo. + :vartype algorithm: str """ _validation = { @@ -1679,6 +2043,18 @@ def __init__( algorithm: Optional[str] = None, **kwargs ): + """ + :keyword etag: Optional ETag. + :paramtype etag: str + :keyword integrity_key: Integrity key. + :paramtype integrity_key: str + :keyword encryption_key: Encryption key. + :paramtype encryption_key: str + :keyword encryption_key_thumbprint: Encryption key thumbprint. + :paramtype encryption_key_thumbprint: str + :keyword algorithm: Algorithm for Vault ExtendedInfo. + :paramtype algorithm: str + """ super(VaultExtendedInfoResource, self).__init__(etag=etag, **kwargs) self.integrity_key = integrity_key self.encryption_key = encryption_key @@ -1691,8 +2067,8 @@ class VaultList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: - :type value: list[~azure.mgmt.recoveryservices.models.Vault] + :ivar value: + :vartype value: list[~azure.mgmt.recoveryservices.models.Vault] :ivar next_link: :vartype next_link: str """ @@ -1712,6 +2088,10 @@ def __init__( value: Optional[List["Vault"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.recoveryservices.models.Vault] + """ super(VaultList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1724,8 +2104,8 @@ class VaultProperties(msrest.serialization.Model): :ivar provisioning_state: Provisioning State. :vartype provisioning_state: str - :param upgrade_details: Details for upgrading vault. - :type upgrade_details: ~azure.mgmt.recoveryservices.models.UpgradeDetails + :ivar upgrade_details: Details for upgrading vault. + :vartype upgrade_details: ~azure.mgmt.recoveryservices.models.UpgradeDetails :ivar private_endpoint_connections: List of private endpoint connection. :vartype private_endpoint_connections: list[~azure.mgmt.recoveryservices.models.PrivateEndpointConnectionVaultProperties] @@ -1737,8 +2117,14 @@ class VaultProperties(msrest.serialization.Model): Possible values include: "None", "Enabled". :vartype private_endpoint_state_for_site_recovery: str or ~azure.mgmt.recoveryservices.models.VaultPrivateEndpointState - :param encryption: Customer Managed Key details of the resource. - :type encryption: ~azure.mgmt.recoveryservices.models.VaultPropertiesEncryption + :ivar encryption: Customer Managed Key details of the resource. + :vartype encryption: ~azure.mgmt.recoveryservices.models.VaultPropertiesEncryption + :ivar move_details: The details of the latest move operation performed on the Azure Resource. + :vartype move_details: ~azure.mgmt.recoveryservices.models.VaultPropertiesMoveDetails + :ivar move_state: The State of the Resource after the move operation. Possible values include: + "Unknown", "InProgress", "PrepareFailed", "CommitFailed", "PrepareTimedout", "CommitTimedout", + "MoveSucceeded", "Failure", "CriticalFailure", "PartialSuccess". + :vartype move_state: str or ~azure.mgmt.recoveryservices.models.ResourceMoveState """ _validation = { @@ -1746,6 +2132,7 @@ class VaultProperties(msrest.serialization.Model): 'private_endpoint_connections': {'readonly': True}, 'private_endpoint_state_for_backup': {'readonly': True}, 'private_endpoint_state_for_site_recovery': {'readonly': True}, + 'move_state': {'readonly': True}, } _attribute_map = { @@ -1755,6 +2142,8 @@ class VaultProperties(msrest.serialization.Model): 'private_endpoint_state_for_backup': {'key': 'privateEndpointStateForBackup', 'type': 'str'}, 'private_endpoint_state_for_site_recovery': {'key': 'privateEndpointStateForSiteRecovery', 'type': 'str'}, 'encryption': {'key': 'encryption', 'type': 'VaultPropertiesEncryption'}, + 'move_details': {'key': 'moveDetails', 'type': 'VaultPropertiesMoveDetails'}, + 'move_state': {'key': 'moveState', 'type': 'str'}, } def __init__( @@ -1762,8 +2151,18 @@ def __init__( *, upgrade_details: Optional["UpgradeDetails"] = None, encryption: Optional["VaultPropertiesEncryption"] = None, + move_details: Optional["VaultPropertiesMoveDetails"] = None, **kwargs ): + """ + :keyword upgrade_details: Details for upgrading vault. + :paramtype upgrade_details: ~azure.mgmt.recoveryservices.models.UpgradeDetails + :keyword encryption: Customer Managed Key details of the resource. + :paramtype encryption: ~azure.mgmt.recoveryservices.models.VaultPropertiesEncryption + :keyword move_details: The details of the latest move operation performed on the Azure + Resource. + :paramtype move_details: ~azure.mgmt.recoveryservices.models.VaultPropertiesMoveDetails + """ super(VaultProperties, self).__init__(**kwargs) self.provisioning_state = None self.upgrade_details = upgrade_details @@ -1771,18 +2170,20 @@ def __init__( self.private_endpoint_state_for_backup = None self.private_endpoint_state_for_site_recovery = None self.encryption = encryption + self.move_details = move_details + self.move_state = None class VaultPropertiesEncryption(msrest.serialization.Model): """Customer Managed Key details of the resource. - :param key_vault_properties: The properties of the Key Vault which hosts CMK. - :type key_vault_properties: ~azure.mgmt.recoveryservices.models.CmkKeyVaultProperties - :param kek_identity: The details of the identity used for CMK. - :type kek_identity: ~azure.mgmt.recoveryservices.models.CmkKekIdentity - :param infrastructure_encryption: Enabling/Disabling the Double Encryption state. Possible + :ivar key_vault_properties: The properties of the Key Vault which hosts CMK. + :vartype key_vault_properties: ~azure.mgmt.recoveryservices.models.CmkKeyVaultProperties + :ivar kek_identity: The details of the identity used for CMK. + :vartype kek_identity: ~azure.mgmt.recoveryservices.models.CmkKekIdentity + :ivar infrastructure_encryption: Enabling/Disabling the Double Encryption state. Possible values include: "Enabled", "Disabled". - :type infrastructure_encryption: str or + :vartype infrastructure_encryption: str or ~azure.mgmt.recoveryservices.models.InfrastructureEncryptionState """ @@ -1800,28 +2201,85 @@ def __init__( infrastructure_encryption: Optional[Union[str, "InfrastructureEncryptionState"]] = None, **kwargs ): + """ + :keyword key_vault_properties: The properties of the Key Vault which hosts CMK. + :paramtype key_vault_properties: ~azure.mgmt.recoveryservices.models.CmkKeyVaultProperties + :keyword kek_identity: The details of the identity used for CMK. + :paramtype kek_identity: ~azure.mgmt.recoveryservices.models.CmkKekIdentity + :keyword infrastructure_encryption: Enabling/Disabling the Double Encryption state. Possible + values include: "Enabled", "Disabled". + :paramtype infrastructure_encryption: str or + ~azure.mgmt.recoveryservices.models.InfrastructureEncryptionState + """ super(VaultPropertiesEncryption, self).__init__(**kwargs) self.key_vault_properties = key_vault_properties self.kek_identity = kek_identity self.infrastructure_encryption = infrastructure_encryption +class VaultPropertiesMoveDetails(msrest.serialization.Model): + """The details of the latest move operation performed on the Azure Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar operation_id: OperationId of the Resource Move Operation. + :vartype operation_id: str + :ivar start_time_utc: Start Time of the Resource Move Operation. + :vartype start_time_utc: ~datetime.datetime + :ivar completion_time_utc: End Time of the Resource Move Operation. + :vartype completion_time_utc: ~datetime.datetime + :ivar source_resource_id: Source Resource of the Resource Move Operation. + :vartype source_resource_id: str + :ivar target_resource_id: Target Resource of the Resource Move Operation. + :vartype target_resource_id: str + """ + + _validation = { + 'operation_id': {'readonly': True}, + 'start_time_utc': {'readonly': True}, + 'completion_time_utc': {'readonly': True}, + 'source_resource_id': {'readonly': True}, + 'target_resource_id': {'readonly': True}, + } + + _attribute_map = { + 'operation_id': {'key': 'operationId', 'type': 'str'}, + 'start_time_utc': {'key': 'startTimeUtc', 'type': 'iso-8601'}, + 'completion_time_utc': {'key': 'completionTimeUtc', 'type': 'iso-8601'}, + 'source_resource_id': {'key': 'sourceResourceId', 'type': 'str'}, + 'target_resource_id': {'key': 'targetResourceId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VaultPropertiesMoveDetails, self).__init__(**kwargs) + self.operation_id = None + self.start_time_utc = None + self.completion_time_utc = None + self.source_resource_id = None + self.target_resource_id = None + + class VaultUsage(msrest.serialization.Model): """Usages of a vault. - :param unit: Unit of the usage. Possible values include: "Count", "Bytes", "Seconds", - "Percent", "CountPerSecond", "BytesPerSecond". - :type unit: str or ~azure.mgmt.recoveryservices.models.UsagesUnit - :param quota_period: Quota period of usage. - :type quota_period: str - :param next_reset_time: Next reset time of usage. - :type next_reset_time: ~datetime.datetime - :param current_value: Current value of usage. - :type current_value: long - :param limit: Limit of usage. - :type limit: long - :param name: Name of usage. - :type name: ~azure.mgmt.recoveryservices.models.NameInfo + :ivar unit: Unit of the usage. Possible values include: "Count", "Bytes", "Seconds", "Percent", + "CountPerSecond", "BytesPerSecond". + :vartype unit: str or ~azure.mgmt.recoveryservices.models.UsagesUnit + :ivar quota_period: Quota period of usage. + :vartype quota_period: str + :ivar next_reset_time: Next reset time of usage. + :vartype next_reset_time: ~datetime.datetime + :ivar current_value: Current value of usage. + :vartype current_value: long + :ivar limit: Limit of usage. + :vartype limit: long + :ivar name: Name of usage. + :vartype name: ~azure.mgmt.recoveryservices.models.NameInfo """ _attribute_map = { @@ -1844,6 +2302,21 @@ def __init__( name: Optional["NameInfo"] = None, **kwargs ): + """ + :keyword unit: Unit of the usage. Possible values include: "Count", "Bytes", "Seconds", + "Percent", "CountPerSecond", "BytesPerSecond". + :paramtype unit: str or ~azure.mgmt.recoveryservices.models.UsagesUnit + :keyword quota_period: Quota period of usage. + :paramtype quota_period: str + :keyword next_reset_time: Next reset time of usage. + :paramtype next_reset_time: ~datetime.datetime + :keyword current_value: Current value of usage. + :paramtype current_value: long + :keyword limit: Limit of usage. + :paramtype limit: long + :keyword name: Name of usage. + :paramtype name: ~azure.mgmt.recoveryservices.models.NameInfo + """ super(VaultUsage, self).__init__(**kwargs) self.unit = unit self.quota_period = quota_period @@ -1856,8 +2329,8 @@ def __init__( class VaultUsageList(msrest.serialization.Model): """Usage for vault. - :param value: The list of usages for the given vault. - :type value: list[~azure.mgmt.recoveryservices.models.VaultUsage] + :ivar value: The list of usages for the given vault. + :vartype value: list[~azure.mgmt.recoveryservices.models.VaultUsage] """ _attribute_map = { @@ -1870,5 +2343,9 @@ def __init__( value: Optional[List["VaultUsage"]] = None, **kwargs ): + """ + :keyword value: The list of usages for the given vault. + :paramtype value: list[~azure.mgmt.recoveryservices.models.VaultUsage] + """ super(VaultUsageList, self).__init__(**kwargs) self.value = value diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_recovery_services_client_enums.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_recovery_services_client_enums.py index 3d8cf64858d68..9254f585c445e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_recovery_services_client_enums.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_recovery_services_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -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 AuthType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AuthType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the authentication type. """ @@ -36,7 +21,7 @@ class AuthType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCESS_CONTROL_SERVICE = "AccessControlService" AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -45,14 +30,14 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class InfrastructureEncryptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InfrastructureEncryptionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enabling/Disabling the Double Encryption state """ ENABLED = "Enabled" DISABLED = "Disabled" -class PrivateEndpointConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the status. """ @@ -61,7 +46,7 @@ class PrivateEndpointConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, s REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets provisioning state of the private endpoint connection. """ @@ -70,7 +55,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" PENDING = "Pending" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove any identities. @@ -81,21 +66,36 @@ class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceMoveState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The State of the Resource after the move operation + """ + + UNKNOWN = "Unknown" + IN_PROGRESS = "InProgress" + PREPARE_FAILED = "PrepareFailed" + COMMIT_FAILED = "CommitFailed" + PREPARE_TIMEDOUT = "PrepareTimedout" + COMMIT_TIMEDOUT = "CommitTimedout" + MOVE_SUCCEEDED = "MoveSucceeded" + FAILURE = "Failure" + CRITICAL_FAILURE = "CriticalFailure" + PARTIAL_SUCCESS = "PartialSuccess" + +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The Sku name. """ STANDARD = "Standard" RS0 = "RS0" -class TriggerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class TriggerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The way the vault upgrade was triggered. """ USER_TRIGGERED = "UserTriggered" FORCED_UPGRADE = "ForcedUpgrade" -class UsagesUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UsagesUnit(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Unit of the usage. """ @@ -106,14 +106,14 @@ class UsagesUnit(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): COUNT_PER_SECOND = "CountPerSecond" BYTES_PER_SECOND = "BytesPerSecond" -class VaultPrivateEndpointState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VaultPrivateEndpointState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Private endpoint state for backup. """ NONE = "None" ENABLED = "Enabled" -class VaultUpgradeState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VaultUpgradeState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the vault upgrade operation. """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_operations.py index 18b502e794c59..9e3bf049fc1dc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -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]] +from .._vendor import _convert_request +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( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.RecoveryServices/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ClientDiscoveryResponse"] + **kwargs: Any + ) -> Iterable["_models.ClientDiscoveryResponse"]: """Returns 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 ClientDiscoveryResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservices.models.ClientDiscoveryResponse] + :return: An iterator like instance of either ClientDiscoveryResponse or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservices.models.ClientDiscoveryResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientDiscoveryResponse"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - 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 - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ClientDiscoveryResponse', pipeline_response) + deserialized = self._deserialize("ClientDiscoveryResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_private_link_resources_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_private_link_resources_operations.py index f5e0df8c83c0c..284c9ebcfeeea 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_private_link_resources_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_private_link_resources_operations.py @@ -5,23 +5,97 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -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]] +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( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_link_resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateLinkResources/{privateLinkResourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "privateLinkResourceName": _SERIALIZER.url("private_link_resource_name", private_link_resource_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResources"] + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResources"]: """Returns the list of private link resources that need to be created for Backup and SiteRecovery. Returns the list of private link resources that need to be created for Backup and SiteRecovery. @@ -62,7 +136,8 @@ def list( :param vault_name: The name of the recovery services vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResources or the result of cls(response) + :return: An iterator like instance of either PrivateLinkResources or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservices.models.PrivateLinkResources] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -71,36 +146,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateLinkResources', pipeline_response) + deserialized = self._deserialize("PrivateLinkResources", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,19 +190,20 @@ 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/{vaultName}/privateLinkResources'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - private_link_resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResource" + resource_group_name: str, + vault_name: str, + private_link_resource_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResource": """Returns a specified private link resource that need to be created for Backup and SiteRecovery. Returns a specified private link resource that need to be created for Backup and SiteRecovery. @@ -152,28 +225,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_link_resource_name=private_link_resource_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,4 +250,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_client_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_client_operations.py index c0239cfaa7aad..3647303d142a7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_client_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_client_operations.py @@ -5,33 +5,109 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_operation_status_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationStatus/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_operation_result_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationResults/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class RecoveryServicesClientOperationsMixin(object): + @distributed_trace def get_operation_status( self, - resource_group_name, # type: str - vault_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationResource" + resource_group_name: str, + vault_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationResource": """Gets the operation status for a resource. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -51,28 +127,18 @@ def get_operation_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get_operation_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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 = build_get_operation_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + template_url=self.get_operation_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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 @@ -86,16 +152,18 @@ def get_operation_status( return cls(pipeline_response, deserialized, {}) return deserialized + get_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationStatus/{operationId}'} # type: ignore + + @distributed_trace def get_operation_result( self, - resource_group_name, # type: str - vault_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Vault"] + resource_group_name: str, + vault_name: str, + operation_id: str, + **kwargs: Any + ) -> Optional["_models.Vault"]: """Gets the operation result for a resource. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -115,28 +183,18 @@ def get_operation_result( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get_operation_result.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_operation_result_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_id=operation_id, + template_url=self.get_operation_result.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -152,4 +210,6 @@ def get_operation_result( return cls(pipeline_response, deserialized, {}) return deserialized + get_operation_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationResults/{operationId}'} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_operations.py index a3654fbec4969..9ae828bbdd48f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_operations.py @@ -5,22 +5,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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + subscription_id: str, + resource_group_name: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class RecoveryServicesOperations(object): """RecoveryServicesOperations operations. @@ -44,17 +91,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - resource_group_name, # type: str - location, # type: str - input, # type: "_models.CheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + resource_group_name: str, + location: str, + input: "_models.CheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """API to check for resource name availability. - A name is available if no other resource exists that has the same SubscriptionId, Resource Name and Type - or if one or more such resources exist, each of these must be GC'd and their time of deletion be more than 24 Hours Ago. + A name is available if no other resource exists that has the same SubscriptionId, Resource Name + and Type + or if one or more such resources exist, each of these must be GC'd and their time of deletion + be more than 24 Hours Ago. API to check for resource name availability. A name is available if no other resource exists that has the same SubscriptionId, Resource Name @@ -79,32 +128,22 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'location': self._serialize.url("location", location, '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(input, 'CheckNameAvailabilityParameters') - # 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') + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(input, 'CheckNameAvailabilityParameters') - 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 @@ -118,4 +157,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/locations/{location}/checkNameAvailability'} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_registered_identities_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_registered_identities_operations.py index 55f19f9d9ebae..4cc41abcc8650 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_registered_identities_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_registered_identities_operations.py @@ -5,22 +5,55 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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_delete_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + identity_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + # Construct URL + url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/registeredIdentities/{identityName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "identityName": _SERIALIZER.url("identity_name", identity_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class RegisteredIdentitiesOperations(object): """RegisteredIdentitiesOperations operations. @@ -44,14 +77,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def delete( self, - resource_group_name, # type: str - vault_name, # type: str - identity_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vault_name: str, + identity_name: str, + **kwargs: Any + ) -> None: """Unregisters the given container from your Recovery Services vault. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -71,26 +104,18 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'identityName': self._serialize.url("identity_name", identity_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 = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + identity_name=identity_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,3 +127,4 @@ def delete( return cls(pipeline_response, None, {}) delete.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/registeredIdentities/{identityName}'} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_replication_usages_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_replication_usages_operations.py index 5a84fb7c3be7a..f0aefe9172f79 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_replication_usages_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_replication_usages_operations.py @@ -5,23 +5,60 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -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]] +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( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/replicationUsages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ReplicationUsagesOperations(object): """ReplicationUsagesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ReplicationUsageList"] + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable["_models.ReplicationUsageList"]: """Fetches the replication usages of the vault. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -60,7 +97,8 @@ def list( :param vault_name: The name of the recovery services vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ReplicationUsageList or the result of cls(response) + :return: An iterator like instance of either ReplicationUsageList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservices.models.ReplicationUsageList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -69,36 +107,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - 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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ReplicationUsageList', pipeline_response) + deserialized = self._deserialize("ReplicationUsageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,6 +151,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_usages_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_usages_operations.py index 28005deeed8f8..a8425a31fe473 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_usages_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_usages_operations.py @@ -5,23 +5,60 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -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]] +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_vaults_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/usages') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class UsagesOperations(object): """UsagesOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_vaults( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultUsageList"] + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable["_models.VaultUsageList"]: """Fetches the usages of the vault. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -69,36 +106,33 @@ def list_by_vaults( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - 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_vaults.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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_vaults_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_vaults.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_vaults_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultUsageList', pipeline_response) + deserialized = self._deserialize("VaultUsageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,6 +150,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_certificates_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_certificates_operations.py index 0951d6c98503d..2be278b914df5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_certificates_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_certificates_operations.py @@ -5,22 +5,71 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + certificate_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/certificates/{certificateName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "certificateName": _SERIALIZER.url("certificate_name", certificate_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VaultCertificatesOperations(object): """VaultCertificatesOperations operations. @@ -44,15 +93,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - vault_name, # type: str - certificate_name, # type: str - certificate_request, # type: "_models.CertificateRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultCertificateResponse" + resource_group_name: str, + vault_name: str, + certificate_name: str, + certificate_request: "_models.CertificateRequest", + **kwargs: Any + ) -> "_models.VaultCertificateResponse": """Uploads a certificate for a resource. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -74,33 +123,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'certificateName': self._serialize.url("certificate_name", certificate_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(certificate_request, 'CertificateRequest') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + certificate_name=certificate_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(certificate_request, 'CertificateRequest') - 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) response = pipeline_response.http_response @@ -114,4 +153,6 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/certificates/{certificateName}'} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_extended_info_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_extended_info_operations.py index 90b8efbeef70c..b9fb4e4b22470 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_extended_info_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vault_extended_info_operations.py @@ -5,22 +5,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 TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VaultExtendedInfoOperations(object): """VaultExtendedInfoOperations operations. @@ -44,13 +170,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultExtendedInfoResource" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.VaultExtendedInfoResource": """Get the vault extended info. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -68,27 +194,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -102,16 +218,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - vault_name, # type: str - resource_extended_info_details, # type: "_models.VaultExtendedInfoResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultExtendedInfoResource" + resource_group_name: str, + vault_name: str, + resource_extended_info_details: "_models.VaultExtendedInfoResource", + **kwargs: Any + ) -> "_models.VaultExtendedInfoResource": """Create vault extended info. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -120,7 +238,8 @@ def create_or_update( :param vault_name: The name of the recovery services vault. :type vault_name: str :param resource_extended_info_details: Details of ResourceExtendedInfo. - :type resource_extended_info_details: ~azure.mgmt.recoveryservices.models.VaultExtendedInfoResource + :type resource_extended_info_details: + ~azure.mgmt.recoveryservices.models.VaultExtendedInfoResource :keyword callable cls: A custom type or function that will be passed the direct response :return: VaultExtendedInfoResource, or the result of cls(response) :rtype: ~azure.mgmt.recoveryservices.models.VaultExtendedInfoResource @@ -131,32 +250,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource_extended_info_details, 'VaultExtendedInfoResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource_extended_info_details, 'VaultExtendedInfoResource') - 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) response = pipeline_response.http_response @@ -170,16 +279,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - vault_name, # type: str - resource_extended_info_details, # type: "_models.VaultExtendedInfoResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultExtendedInfoResource" + resource_group_name: str, + vault_name: str, + resource_extended_info_details: "_models.VaultExtendedInfoResource", + **kwargs: Any + ) -> "_models.VaultExtendedInfoResource": """Update vault extended info. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -188,7 +299,8 @@ def update( :param vault_name: The name of the recovery services vault. :type vault_name: str :param resource_extended_info_details: Details of ResourceExtendedInfo. - :type resource_extended_info_details: ~azure.mgmt.recoveryservices.models.VaultExtendedInfoResource + :type resource_extended_info_details: + ~azure.mgmt.recoveryservices.models.VaultExtendedInfoResource :keyword callable cls: A custom type or function that will be passed the direct response :return: VaultExtendedInfoResource, or the result of cls(response) :rtype: ~azure.mgmt.recoveryservices.models.VaultExtendedInfoResource @@ -199,32 +311,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(resource_extended_info_details, 'VaultExtendedInfoResource') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(resource_extended_info_details, 'VaultExtendedInfoResource') - 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) response = pipeline_response.http_response @@ -238,4 +340,6 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/extendedInformation/vaultExtendedInfo'} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vaults_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vaults_operations.py index 3f4945c53fb7b..3b367f526492e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vaults_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_vaults_operations.py @@ -5,25 +5,250 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, 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.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_id_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/vaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VaultsOperations(object): """VaultsOperations operations. @@ -47,11 +272,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription_id( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultList"] + **kwargs: Any + ) -> Iterable["_models.VaultList"]: """Fetches all the resources of the specified type in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -64,34 +289,29 @@ def list_by_subscription_id( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - 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_subscription_id.metadata['url'] # type: ignore - path_format_arguments = { - '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_by_subscription_id_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription_id.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_id_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultList', pipeline_response) + deserialized = self._deserialize("VaultList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,17 +329,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription_id.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/vaults'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.VaultList"]: """Retrieve a list of Vaults. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -135,35 +356,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - 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_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultList', pipeline_response) + deserialized = self._deserialize("VaultList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -181,18 +398,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.Vault": """Get the Vault details. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -210,27 +428,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -244,47 +452,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - vault_name, # type: str - vault, # type: "_models.Vault" - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + vault: "_models.Vault", + **kwargs: Any + ) -> "_models.Vault": cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vault, 'Vault') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(vault, 'Vault') - 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) response = pipeline_response.http_response @@ -302,16 +501,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - vault_name, # type: str - vault, # type: "_models.Vault" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Vault"] + resource_group_name: str, + vault_name: str, + vault: "_models.Vault", + **kwargs: Any + ) -> LROPoller["_models.Vault"]: """Creates or updates a Recovery Services vault. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -323,15 +524,18 @@ def begin_create_or_update( :type vault: ~azure.mgmt.recoveryservices.models.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. + :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 Vault or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservices.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -343,27 +547,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vault_name=vault_name, vault=vault, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -375,15 +573,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + @distributed_trace def delete( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> None: """Deletes a vault. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -401,27 +600,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -434,45 +623,35 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + def _update_initial( self, - resource_group_name, # type: str - vault_name, # type: str - vault, # type: "_models.PatchVault" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Vault"] + resource_group_name: str, + vault_name: str, + vault: "_models.PatchVault", + **kwargs: Any + ) -> Optional["_models.Vault"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Vault"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(vault, 'PatchVault') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(vault, 'PatchVault') - 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) response = pipeline_response.http_response @@ -488,16 +667,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - vault_name, # type: str - vault, # type: "_models.PatchVault" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Vault"] + resource_group_name: str, + vault_name: str, + vault: "_models.PatchVault", + **kwargs: Any + ) -> LROPoller["_models.Vault"]: """Updates the vault. :param resource_group_name: The name of the resource group where the recovery services vault is @@ -509,15 +690,18 @@ def begin_update( :type vault: ~azure.mgmt.recoveryservices.models.PatchVault :keyword callable cls: A custom type or function that will be passed the direct response :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 Vault or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservices.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -529,27 +713,21 @@ def begin_update( resource_group_name=resource_group_name, vault_name=vault_name, vault=vault, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -561,4 +739,5 @@ def get_long_running_output(pipeline_response): ) 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/{vaultName}'} # type: ignore