From cefc0b2ed180dfcd00e9d290b907f07145ba3f37 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 25 Jun 2021 23:20:31 +0000 Subject: [PATCH] CodeGen from PR 14990 in Azure/azure-rest-api-specs [Python] track2 config (#14990) * authorization * automation * recoveryservices * logic * notificationhubs * search --- .../azure-mgmt-recoveryservices/MANIFEST.in | 1 + .../azure-mgmt-recoveryservices/_meta.json | 11 + .../mgmt/recoveryservices/_configuration.py | 2 +- .../mgmt/recoveryservices/_metadata.json | 94 ++++- .../_recovery_services_client.py | 23 +- .../azure/mgmt/recoveryservices/_version.py | 2 +- .../recoveryservices/aio/_configuration.py | 2 +- .../aio/_recovery_services_client.py | 22 +- .../aio/operations/__init__.py | 2 + .../aio/operations/_operations.py | 4 +- .../_private_link_resources_operations.py | 8 +- .../_recovery_services_client_operations.py | 149 +++++++ .../_recovery_services_operations.py | 4 +- .../_registered_identities_operations.py | 4 +- .../_replication_usages_operations.py | 4 +- .../aio/operations/_usages_operations.py | 4 +- .../_vault_certificates_operations.py | 4 +- .../_vault_extended_info_operations.py | 12 +- .../aio/operations/_vaults_operations.py | 222 ++++++++--- .../mgmt/recoveryservices/models/__init__.py | 28 ++ .../mgmt/recoveryservices/models/_models.py | 326 ++++++++++++++- .../recoveryservices/models/_models_py3.py | 375 ++++++++++++++++-- .../recoveryservices/models/_paged_models.py | 79 ---- .../models/_recovery_services_client_enums.py | 22 +- .../recoveryservices/operations/__init__.py | 2 + .../operations/_operations.py | 2 +- .../_private_link_resources_operations.py | 4 +- .../_recovery_services_client_operations.py | 155 ++++++++ .../_recovery_services_operations.py | 2 +- .../_registered_identities_operations.py | 2 +- .../_replication_usages_operations.py | 2 +- .../operations/_usages_operations.py | 2 +- .../_vault_certificates_operations.py | 2 +- .../_vault_extended_info_operations.py | 6 +- .../operations/_vaults_operations.py | 212 +++++++--- .../azure/mgmt/recoveryservices/version.py | 12 - 36 files changed, 1517 insertions(+), 290 deletions(-) create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_client_operations.py delete mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_paged_models.py create mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_client_operations.py delete mode 100644 sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/version.py diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/MANIFEST.in b/sdk/recoveryservices/azure-mgmt-recoveryservices/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/MANIFEST.in +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json b/sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json new file mode 100644 index 000000000000..5bdb8f34d062 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.2", + "use": [ + "@autorest/python@5.8.1", + "@autorest/modelerfour@4.19.2" + ], + "commit": "7f530e3727f746e26f5b5ece8a5874daf10cc56f", + "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", + "readme": "specification/recoveryservices/resource-manager/readme.md" +} \ No newline at end of file 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 84aeea1bd78f..ec9dc244ebca 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_configuration.py @@ -48,7 +48,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2016-06-01" + self.api_version = "2021-03-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservices/{}'.format(VERSION)) self._configure(**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 9d189ed4da38..3b046a3a96f7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_metadata.json +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/_metadata.json @@ -1,6 +1,6 @@ { - "chosen_version": "2016-06-01", - "total_api_version_list": ["2016-06-01"], + "chosen_version": "2021-03-01", + "total_api_version_list": ["2021-03-01"], "client": { "name": "RecoveryServicesClient", "filename": "_recovery_services_client", @@ -8,8 +8,10 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": false, - "client_side_validation": false + "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\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", + "signature": "subscription_id: str,", "description": "The subscription Id.", "docstring_type": "str", "required": true @@ -42,14 +44,58 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "vault_certificates": "VaultCertificatesOperations", @@ -63,7 +109,33 @@ "usages": "UsagesOperations" }, "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + "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\"]}}}", + "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", + "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": { + "coroutine": true, + "signature": "async def get_operation_status(\n self,\n resource_group_name: str,\n vault_name: str,\n operation_id: str,\n **kwargs: Any\n) -\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\"\"\"" + }, + "call": "resource_group_name, vault_name, operation_id" + }, + "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", + "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": { + "coroutine": true, + "signature": "async def get_operation_result(\n self,\n resource_group_name: str,\n vault_name: str,\n operation_id: str,\n **kwargs: Any\n) -\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\"\"\"" + }, + "call": "resource_group_name, vault_name, operation_id" + } + } + } } \ 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 2b884c98578f..ff2b62b6031f 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 @@ -16,6 +16,7 @@ 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 @@ -26,11 +27,12 @@ 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(object): +class RecoveryServicesClient(RecoveryServicesClientOperationsMixin): """Recovery Services Client. :ivar vault_certificates: VaultCertificatesOperations operations @@ -56,6 +58,7 @@ class RecoveryServicesClient(object): :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. """ def __init__( @@ -95,6 +98,24 @@ def __init__( self.usages = UsagesOperations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, 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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + def close(self): # type: () -> None self._client.close() 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 c47f66669f1b..e5754a47ce68 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 = "1.0.0" +VERSION = "1.0.0b1" 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 d45337c690be..3a503e36d9d2 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 @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2016-06-01" + self.api_version = "2021-03-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservices/{}'.format(VERSION)) self._configure(**kwargs) 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 159b4fa0e44e..5e0a35fddd93 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 @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -24,11 +25,12 @@ 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(object): +class RecoveryServicesClient(RecoveryServicesClientOperationsMixin): """Recovery Services Client. :ivar vault_certificates: VaultCertificatesOperations operations @@ -54,6 +56,7 @@ class RecoveryServicesClient(object): :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. """ def __init__( @@ -92,6 +95,23 @@ def __init__( self.usages = UsagesOperations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> 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. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.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 + async def close(self) -> None: await self._client.close() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/__init__.py index 79d7b3fe7192..98c486465d38 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/__init__.py @@ -14,6 +14,7 @@ from ._vaults_operations import VaultsOperations from ._operations import Operations from ._vault_extended_info_operations import VaultExtendedInfoOperations +from ._recovery_services_client_operations import RecoveryServicesClientOperationsMixin from ._usages_operations import UsagesOperations __all__ = [ @@ -25,5 +26,6 @@ 'VaultsOperations', 'Operations', 'VaultExtendedInfoOperations', + 'RecoveryServicesClientOperationsMixin', 'UsagesOperations', ] 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 c7269b59dfe1..16f63fd27350 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 @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ClientDiscoveryResponse"]: """Returns the list of available operations. @@ -57,7 +57,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): 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 0319432e2ffe..3363b616ff72 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 @@ -45,7 +45,7 @@ def list( self, resource_group_name: str, vault_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.PrivateLinkResources"]: """Returns the list of private link resources that need to be created for Backup and SiteRecovery. @@ -66,7 +66,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -123,7 +123,7 @@ async def get( resource_group_name: str, vault_name: str, private_link_resource_name: str, - **kwargs + **kwargs: Any ) -> "_models.PrivateLinkResource": """Returns a specified private link resource that need to be created for Backup and SiteRecovery. @@ -146,7 +146,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL 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 new file mode 100644 index 000000000000..b603043fea7d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/aio/operations/_recovery_services_client_operations.py @@ -0,0 +1,149 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, 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.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class RecoveryServicesClientOperationsMixin: + + async def get_operation_status( + self, + 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 + present. + :type resource_group_name: str + :param vault_name: The name of the recovery services vault. + :type vault_name: str + :param operation_id: + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResource, or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservices.models.OperationResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResource"] + error_map = { + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationResource', pipeline_response) + + if cls: + 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 + + async def get_operation_result( + self, + 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 + present. + :type resource_group_name: str + :param vault_name: The name of the recovery services vault. + :type vault_name: str + :param operation_id: + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservices.models.Vault or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + 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 033792c27438..0978a7d532c9 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 @@ -45,7 +45,7 @@ async def check_name_availability( resource_group_name: str, location: str, input: "_models.CheckNameAvailabilityParameters", - **kwargs + **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 @@ -74,7 +74,7 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" 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 a01a1d0e237b..846fcadfa908 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 @@ -45,7 +45,7 @@ async def delete( resource_group_name: str, vault_name: str, identity_name: str, - **kwargs + **kwargs: Any ) -> None: """Unregisters the given container from your Recovery Services vault. @@ -66,7 +66,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" # Construct URL url = self.delete.metadata['url'] # 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 f921c78782e1..e16b030a5fd5 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 @@ -45,7 +45,7 @@ def list( self, resource_group_name: str, vault_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ReplicationUsageList"]: """Fetches the replication usages of the vault. @@ -64,7 +64,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): 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 07a14e7aab64..24da06a76228 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 @@ -45,7 +45,7 @@ def list_by_vaults( self, resource_group_name: str, vault_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.VaultUsageList"]: """Fetches the usages of the vault. @@ -64,7 +64,7 @@ def list_by_vaults( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): 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 603807765993..c7e33d926362 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 @@ -46,7 +46,7 @@ async def create( vault_name: str, certificate_name: str, certificate_request: "_models.CertificateRequest", - **kwargs + **kwargs: Any ) -> "_models.VaultCertificateResponse": """Uploads a certificate for a resource. @@ -69,7 +69,7 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" 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 e09790b9abaa..fe0a956e1885 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 @@ -44,7 +44,7 @@ async def get( self, resource_group_name: str, vault_name: str, - **kwargs + **kwargs: Any ) -> "_models.VaultExtendedInfoResource": """Get the vault extended info. @@ -63,7 +63,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -104,7 +104,7 @@ async def create_or_update( resource_group_name: str, vault_name: str, resource_extended_info_details: "_models.VaultExtendedInfoResource", - **kwargs + **kwargs: Any ) -> "_models.VaultExtendedInfoResource": """Create vault extended info. @@ -125,7 +125,7 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -171,7 +171,7 @@ async def update( resource_group_name: str, vault_name: str, resource_extended_info_details: "_models.VaultExtendedInfoResource", - **kwargs + **kwargs: Any ) -> "_models.VaultExtendedInfoResource": """Update vault extended info. @@ -192,7 +192,7 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" 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 82ff35670ed7..e3cda9ae0bc6 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 @@ -12,7 +12,9 @@ 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.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models @@ -43,7 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list_by_subscription_id( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.VaultList"]: """Fetches all the resources of the specified type in the subscription. @@ -57,7 +59,7 @@ def list_by_subscription_id( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -110,7 +112,7 @@ async def get_next(next_link=None): def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.VaultList"]: """Retrieve a list of Vaults. @@ -127,7 +129,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -182,7 +184,7 @@ async def get( self, resource_group_name: str, vault_name: str, - **kwargs + **kwargs: Any ) -> "_models.Vault": """Get the Vault details. @@ -201,7 +203,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -237,38 +239,24 @@ async def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore - async def create_or_update( + async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, vault: "_models.Vault", - **kwargs + **kwargs: Any ) -> "_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 - present. - :type resource_group_name: str - :param vault_name: The name of the recovery services vault. - :type vault_name: str - :param vault: Recovery Services Vault to be created. - :type vault: ~azure.mgmt.recoveryservices.models.Vault - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault, or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservices.models.Vault - :raises: ~azure.core.exceptions.HttpResponseError - """ 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 = "2016-06-01" + 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 + 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'), @@ -306,13 +294,85 @@ 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}'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + vault: "_models.Vault", + **kwargs: Any + ) -> AsyncLROPoller["_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 + present. + :type resource_group_name: str + :param vault_name: The name of the recovery services vault. + :type vault_name: str + :param vault: Recovery Services Vault to be created. + :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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservices.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + vault=vault, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore async def delete( self, resource_group_name: str, vault_name: str, - **kwargs + **kwargs: Any ) -> None: """Deletes a vault. @@ -331,7 +391,8 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -348,6 +409,7 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -362,38 +424,24 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore - async def update( + async def _update_initial( self, resource_group_name: str, vault_name: str, vault: "_models.PatchVault", - **kwargs - ) -> "_models.Vault": - """Updates the vault. - - :param resource_group_name: The name of the resource group where the recovery services vault is - present. - :type resource_group_name: str - :param vault_name: The name of the recovery services vault. - :type vault_name: str - :param vault: Recovery Services Vault to be created. - :type vault: ~azure.mgmt.recoveryservices.models.PatchVault - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault, or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservices.models.Vault - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + **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 = "2016-06-01" + 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 + 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'), @@ -417,18 +465,88 @@ async def update( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = None if response.status_code == 200: deserialized = self._deserialize('Vault', pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + vault_name: str, + vault: "_models.PatchVault", + **kwargs: Any + ) -> AsyncLROPoller["_models.Vault"]: + """Updates the vault. + + :param resource_group_name: The name of the resource group where the recovery services vault is + present. + :type resource_group_name: str + :param vault_name: The name of the recovery services vault. + :type vault_name: str + :param vault: Recovery Services Vault to be created. + :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. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservices.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + vault=vault, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_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 1f9e847f49f2..5d0519244be4 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 @@ -16,10 +16,15 @@ 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 @@ -36,13 +41,16 @@ 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): @@ -55,10 +63,15 @@ 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 @@ -75,18 +88,23 @@ 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 ._recovery_services_client_enums import ( AuthType, + CreatedByType, + InfrastructureEncryptionState, PrivateEndpointConnectionStatus, ProvisioningState, ResourceIdentityType, @@ -107,10 +125,15 @@ 'ClientDiscoveryForServiceSpecification', 'ClientDiscoveryResponse', 'ClientDiscoveryValueForSingleApi', + 'CmkKekIdentity', + 'CmkKeyVaultProperties', + 'Error', + 'ErrorAdditionalInfo', 'IdentityData', 'JobsSummary', 'MonitoringSummary', 'NameInfo', + 'OperationResource', 'PatchTrackedResource', 'PatchVault', 'PrivateEndpoint', @@ -127,16 +150,21 @@ 'ResourceCertificateAndAcsDetails', 'ResourceCertificateDetails', 'Sku', + 'SystemData', 'TrackedResource', 'UpgradeDetails', + 'UserIdentity', 'Vault', 'VaultCertificateResponse', 'VaultExtendedInfoResource', 'VaultList', 'VaultProperties', + 'VaultPropertiesEncryption', 'VaultUsage', 'VaultUsageList', 'AuthType', + 'CreatedByType', + 'InfrastructureEncryptionState', 'PrivateEndpointConnectionStatus', 'ProvisioningState', 'ResourceIdentityType', 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 index db44ce0cb09f..943a1bba909f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models.py @@ -231,6 +231,125 @@ def __init__( 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. @@ -242,8 +361,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 identity type. Possible values include: "SystemAssigned", "None". + :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 = { @@ -256,6 +382,7 @@ class IdentityData(msrest.serialization.Model): '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__( @@ -266,6 +393,7 @@ def __init__( 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): @@ -357,6 +485,47 @@ def __init__( 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. @@ -369,8 +538,8 @@ class Resource(msrest.serialization.Model): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param e_tag: Optional ETag. - :type e_tag: str + :param etag: Optional ETag. + :type etag: str """ _validation = { @@ -383,7 +552,7 @@ class Resource(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, } def __init__( @@ -394,7 +563,7 @@ def __init__( self.id = None self.name = None self.type = None - self.e_tag = kwargs.get('e_tag', None) + self.etag = kwargs.get('etag', None) class PatchTrackedResource(Resource): @@ -409,8 +578,8 @@ class PatchTrackedResource(Resource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param e_tag: Optional ETag. - :type e_tag: str + :param etag: Optional ETag. + :type etag: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -427,7 +596,7 @@ class PatchTrackedResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -453,8 +622,8 @@ class PatchVault(PatchTrackedResource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param e_tag: Optional ETag. - :type e_tag: str + :param etag: Optional ETag. + :type etag: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -477,7 +646,7 @@ class PatchVault(PatchTrackedResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'properties': {'key': 'properties', 'type': 'VaultProperties'}, @@ -882,6 +1051,8 @@ class ResourceCertificateAndAadDetails(ResourceCertificateDetails): :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 = { @@ -908,6 +1079,7 @@ class ResourceCertificateAndAadDetails(ResourceCertificateDetails): '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__( @@ -921,6 +1093,7 @@ def __init__( 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): @@ -995,6 +1168,8 @@ class Sku(msrest.serialization.Model): :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 = { @@ -1003,6 +1178,7 @@ class Sku(msrest.serialization.Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, } def __init__( @@ -1011,6 +1187,48 @@ def __init__( ): 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): @@ -1027,8 +1245,8 @@ class TrackedResource(Resource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param e_tag: Optional ETag. - :type e_tag: str + :param etag: Optional ETag. + :type etag: str :param location: Required. Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -1046,7 +1264,7 @@ class TrackedResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -1127,6 +1345,36 @@ def __init__( 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. @@ -1141,8 +1389,8 @@ class Vault(TrackedResource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param e_tag: Optional ETag. - :type e_tag: str + :param etag: Optional ETag. + :type etag: str :param location: Required. Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -1153,6 +1401,8 @@ class Vault(TrackedResource): :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 = { @@ -1160,18 +1410,20 @@ class Vault(TrackedResource): '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'}, - 'e_tag': {'key': 'eTag', '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__( @@ -1182,6 +1434,7 @@ def __init__( 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): @@ -1236,8 +1489,8 @@ class VaultExtendedInfoResource(Resource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param e_tag: Optional ETag. - :type e_tag: str + :param etag: Optional ETag. + :type etag: str :param integrity_key: Integrity key. :type integrity_key: str :param encryption_key: Encryption key. @@ -1258,7 +1511,7 @@ class VaultExtendedInfoResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'e_tag': {'key': 'eTag', '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'}, @@ -1325,6 +1578,8 @@ 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 """ _validation = { @@ -1340,6 +1595,7 @@ class VaultProperties(msrest.serialization.Model): '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__( @@ -1352,6 +1608,36 @@ def __init__( 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): 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 e84860926663..51c474475d05 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 @@ -266,6 +266,130 @@ def __init__( self.properties = properties +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, + *, + use_system_assigned_identity: Optional[bool] = None, + user_assigned_identity: Optional[str] = None, + **kwargs + ): + super(CmkKekIdentity, self).__init__(**kwargs) + self.use_system_assigned_identity = use_system_assigned_identity + self.user_assigned_identity = user_assigned_identity + + +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, + *, + key_uri: Optional[str] = None, + **kwargs + ): + super(CmkKeyVaultProperties, self).__init__(**kwargs) + self.key_uri = key_uri + + +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. @@ -277,8 +401,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 identity type. Possible values include: "SystemAssigned", "None". + :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 = { @@ -291,18 +422,21 @@ class IdentityData(msrest.serialization.Model): '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, *, type: Union[str, "ResourceIdentityType"], + user_assigned_identities: Optional[Dict[str, "UserIdentity"]] = None, **kwargs ): super(IdentityData, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None self.type = type + self.user_assigned_identities = user_assigned_identities class JobsSummary(msrest.serialization.Model): @@ -408,6 +542,54 @@ def __init__( self.localized_value = localized_value +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, + *, + end_time: Optional[datetime.datetime] = None, + error: Optional["Error"] = None, + id: Optional[str] = None, + name: Optional[str] = None, + status: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + **kwargs + ): + super(OperationResource, self).__init__(**kwargs) + self.end_time = end_time + self.error = error + self.id = id + self.name = name + self.status = status + self.start_time = start_time + + class Resource(msrest.serialization.Model): """ARM Resource. @@ -420,8 +602,8 @@ class Resource(msrest.serialization.Model): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param e_tag: Optional ETag. - :type e_tag: str + :param etag: Optional ETag. + :type etag: str """ _validation = { @@ -434,20 +616,20 @@ class Resource(msrest.serialization.Model): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, } def __init__( self, *, - e_tag: Optional[str] = None, + etag: Optional[str] = None, **kwargs ): super(Resource, self).__init__(**kwargs) self.id = None self.name = None self.type = None - self.e_tag = e_tag + self.etag = etag class PatchTrackedResource(Resource): @@ -462,8 +644,8 @@ class PatchTrackedResource(Resource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param e_tag: Optional ETag. - :type e_tag: str + :param etag: Optional ETag. + :type etag: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -480,7 +662,7 @@ class PatchTrackedResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -488,12 +670,12 @@ class PatchTrackedResource(Resource): def __init__( self, *, - e_tag: Optional[str] = None, + etag: Optional[str] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): - super(PatchTrackedResource, self).__init__(e_tag=e_tag, **kwargs) + super(PatchTrackedResource, self).__init__(etag=etag, **kwargs) self.location = location self.tags = tags @@ -510,8 +692,8 @@ class PatchVault(PatchTrackedResource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param e_tag: Optional ETag. - :type e_tag: str + :param etag: Optional ETag. + :type etag: str :param location: Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -534,7 +716,7 @@ class PatchVault(PatchTrackedResource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'properties': {'key': 'properties', 'type': 'VaultProperties'}, @@ -545,7 +727,7 @@ class PatchVault(PatchTrackedResource): def __init__( self, *, - e_tag: Optional[str] = None, + etag: Optional[str] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, properties: Optional["VaultProperties"] = None, @@ -553,7 +735,7 @@ def __init__( identity: Optional["IdentityData"] = None, **kwargs ): - super(PatchVault, self).__init__(e_tag=e_tag, location=location, tags=tags, **kwargs) + super(PatchVault, self).__init__(etag=etag, location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku self.identity = identity @@ -970,6 +1152,8 @@ class ResourceCertificateAndAadDetails(ResourceCertificateDetails): :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 = { @@ -996,6 +1180,7 @@ class ResourceCertificateAndAadDetails(ResourceCertificateDetails): '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__( @@ -1014,6 +1199,7 @@ def __init__( thumbprint: Optional[str] = None, valid_from: Optional[datetime.datetime] = None, valid_to: Optional[datetime.datetime] = None, + service_resource_id: Optional[str] = None, **kwargs ): 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) @@ -1023,6 +1209,7 @@ def __init__( self.service_principal_client_id = service_principal_client_id self.service_principal_object_id = service_principal_object_id self.azure_management_endpoint_audience = azure_management_endpoint_audience + self.service_resource_id = service_resource_id class ResourceCertificateAndAcsDetails(ResourceCertificateDetails): @@ -1109,6 +1296,8 @@ class Sku(msrest.serialization.Model): :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 = { @@ -1117,16 +1306,67 @@ class Sku(msrest.serialization.Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, } def __init__( self, *, name: Union[str, "SkuName"], + tier: Optional[str] = None, **kwargs ): super(Sku, self).__init__(**kwargs) self.name = name + self.tier = tier + + +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, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at class TrackedResource(Resource): @@ -1143,8 +1383,8 @@ class TrackedResource(Resource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param e_tag: Optional ETag. - :type e_tag: str + :param etag: Optional ETag. + :type etag: str :param location: Required. Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -1162,7 +1402,7 @@ class TrackedResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'e_tag': {'key': 'eTag', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, } @@ -1171,11 +1411,11 @@ def __init__( self, *, location: str, - e_tag: Optional[str] = None, + etag: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): - super(TrackedResource, self).__init__(e_tag=e_tag, **kwargs) + super(TrackedResource, self).__init__(etag=etag, **kwargs) self.location = location self.tags = tags @@ -1247,6 +1487,36 @@ def __init__( 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. @@ -1261,8 +1531,8 @@ class Vault(TrackedResource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param e_tag: Optional ETag. - :type e_tag: str + :param etag: Optional ETag. + :type etag: str :param location: Required. Resource location. :type location: str :param tags: A set of tags. Resource tags. @@ -1273,6 +1543,8 @@ class Vault(TrackedResource): :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 = { @@ -1280,35 +1552,38 @@ class Vault(TrackedResource): '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'}, - 'e_tag': {'key': 'eTag', '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, *, location: str, - e_tag: Optional[str] = None, + etag: Optional[str] = None, tags: Optional[Dict[str, str]] = None, identity: Optional["IdentityData"] = None, properties: Optional["VaultProperties"] = None, sku: Optional["Sku"] = None, **kwargs ): - super(Vault, self).__init__(e_tag=e_tag, location=location, tags=tags, **kwargs) + super(Vault, self).__init__(etag=etag, location=location, tags=tags, **kwargs) self.identity = identity self.properties = properties self.sku = sku + self.system_data = None class VaultCertificateResponse(msrest.serialization.Model): @@ -1365,8 +1640,8 @@ class VaultExtendedInfoResource(Resource): :ivar type: Resource type represents the complete path of the form Namespace/ResourceType/ResourceType/... :vartype type: str - :param e_tag: Optional ETag. - :type e_tag: str + :param etag: Optional ETag. + :type etag: str :param integrity_key: Integrity key. :type integrity_key: str :param encryption_key: Encryption key. @@ -1387,7 +1662,7 @@ class VaultExtendedInfoResource(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, - 'e_tag': {'key': 'eTag', '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'}, @@ -1397,14 +1672,14 @@ class VaultExtendedInfoResource(Resource): def __init__( self, *, - e_tag: Optional[str] = None, + etag: Optional[str] = None, integrity_key: Optional[str] = None, encryption_key: Optional[str] = None, encryption_key_thumbprint: Optional[str] = None, algorithm: Optional[str] = None, **kwargs ): - super(VaultExtendedInfoResource, self).__init__(e_tag=e_tag, **kwargs) + super(VaultExtendedInfoResource, self).__init__(etag=etag, **kwargs) self.integrity_key = integrity_key self.encryption_key = encryption_key self.encryption_key_thumbprint = encryption_key_thumbprint @@ -1462,6 +1737,8 @@ 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 """ _validation = { @@ -1477,12 +1754,14 @@ class VaultProperties(msrest.serialization.Model): '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, *, upgrade_details: Optional["UpgradeDetails"] = None, + encryption: Optional["VaultPropertiesEncryption"] = None, **kwargs ): super(VaultProperties, self).__init__(**kwargs) @@ -1491,6 +1770,40 @@ def __init__( self.private_endpoint_connections = None self.private_endpoint_state_for_backup = None self.private_endpoint_state_for_site_recovery = None + self.encryption = encryption + + +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, + *, + key_vault_properties: Optional["CmkKeyVaultProperties"] = None, + kek_identity: Optional["CmkKekIdentity"] = None, + infrastructure_encryption: Optional[Union[str, "InfrastructureEncryptionState"]] = None, + **kwargs + ): + super(VaultPropertiesEncryption, self).__init__(**kwargs) + self.key_vault_properties = key_vault_properties + self.kek_identity = kek_identity + self.infrastructure_encryption = infrastructure_encryption class VaultUsage(msrest.serialization.Model): diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_paged_models.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_paged_models.py deleted file mode 100644 index 88eba60b5054..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_paged_models.py +++ /dev/null @@ -1,79 +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. -# -------------------------------------------------------------------------- - -from msrest.paging import Paged - - -class ReplicationUsagePaged(Paged): - """ - A paging container for iterating over a list of :class:`ReplicationUsage ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ReplicationUsage]'} - } - - def __init__(self, *args, **kwargs): - - super(ReplicationUsagePaged, self).__init__(*args, **kwargs) -class PrivateLinkResourcePaged(Paged): - """ - A paging container for iterating over a list of :class:`PrivateLinkResource ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PrivateLinkResource]'} - } - - def __init__(self, *args, **kwargs): - - super(PrivateLinkResourcePaged, self).__init__(*args, **kwargs) -class VaultPaged(Paged): - """ - A paging container for iterating over a list of :class:`Vault ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[Vault]'} - } - - def __init__(self, *args, **kwargs): - - super(VaultPaged, self).__init__(*args, **kwargs) -class ClientDiscoveryValueForSingleApiPaged(Paged): - """ - A paging container for iterating over a list of :class:`ClientDiscoveryValueForSingleApi ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[ClientDiscoveryValueForSingleApi]'} - } - - def __init__(self, *args, **kwargs): - - super(ClientDiscoveryValueForSingleApiPaged, self).__init__(*args, **kwargs) -class VaultUsagePaged(Paged): - """ - A paging container for iterating over a list of :class:`VaultUsage ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[VaultUsage]'} - } - - def __init__(self, *args, **kwargs): - - super(VaultUsagePaged, self).__init__(*args, **kwargs) 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 14a2ab437184..3d8cf64858d6 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 @@ -36,6 +36,22 @@ class AuthType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCESS_CONTROL_SERVICE = "AccessControlService" AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class InfrastructureEncryptionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enabling/Disabling the Double Encryption state + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + class PrivateEndpointConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Gets or sets the status. """ @@ -55,11 +71,15 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PENDING = "Pending" class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The identity type. + """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. """ SYSTEM_ASSIGNED = "SystemAssigned" NONE = "None" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The Sku name. diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/__init__.py index 79d7b3fe7192..98c486465d38 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/__init__.py @@ -14,6 +14,7 @@ from ._vaults_operations import VaultsOperations from ._operations import Operations from ._vault_extended_info_operations import VaultExtendedInfoOperations +from ._recovery_services_client_operations import RecoveryServicesClientOperationsMixin from ._usages_operations import UsagesOperations __all__ = [ @@ -25,5 +26,6 @@ 'VaultsOperations', 'Operations', 'VaultExtendedInfoOperations', + 'RecoveryServicesClientOperationsMixin', 'UsagesOperations', ] 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 b33f2d8a88a5..18b502e794c5 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 @@ -62,7 +62,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): 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 e5822740638e..f5e0df8c83c0 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 @@ -71,7 +71,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -152,7 +152,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL 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 new file mode 100644 index 000000000000..c0239cfaa7aa --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_client_operations.py @@ -0,0 +1,155 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +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.mgmt.core.exceptions import ARMErrorFormat + +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]] + +class RecoveryServicesClientOperationsMixin(object): + + def get_operation_status( + self, + resource_group_name, # type: str + vault_name, # type: str + operation_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 + present. + :type resource_group_name: str + :param vault_name: The name of the recovery services vault. + :type vault_name: str + :param operation_id: + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: OperationResource, or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservices.models.OperationResource + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationResource"] + error_map = { + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('OperationResource', pipeline_response) + + if cls: + 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 + + 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"] + """Gets the operation result for a resource. + + :param resource_group_name: The name of the resource group where the recovery services vault is + present. + :type resource_group_name: str + :param vault_name: The name of the recovery services vault. + :type vault_name: str + :param operation_id: + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.recoveryservices.models.Vault or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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" + 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 = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + 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 29695a5c321f..a3654fbec496 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 @@ -79,7 +79,7 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" 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 8157eb857f4a..55f19f9d9eba 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 @@ -71,7 +71,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" # Construct URL url = self.delete.metadata['url'] # 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 4e7d02f7610f..5a84fb7c3be7 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 @@ -69,7 +69,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): 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 6dc2a01115a0..28005deeed8f 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 @@ -69,7 +69,7 @@ def list_by_vaults( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): 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 77a499143ade..0951d6c98503 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 @@ -74,7 +74,7 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" 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 517c6d298701..90b8efbeef70 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 @@ -68,7 +68,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -131,7 +131,7 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -199,7 +199,7 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" 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 6c1cc469d247..3f4945c53fb7 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 @@ -12,7 +12,9 @@ from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models @@ -62,7 +64,7 @@ def list_by_subscription_id( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -133,7 +135,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" def prepare_request(next_link=None): @@ -208,7 +210,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" accept = "application/json" # Construct URL @@ -244,7 +246,7 @@ def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore - def create_or_update( + def _create_or_update_initial( self, resource_group_name, # type: str vault_name, # type: str @@ -252,31 +254,17 @@ def create_or_update( **kwargs # type: Any ): # type: (...) -> "_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 - present. - :type resource_group_name: str - :param vault_name: The name of the recovery services vault. - :type vault_name: str - :param vault: Recovery Services Vault to be created. - :type vault: ~azure.mgmt.recoveryservices.models.Vault - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault, or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservices.models.Vault - :raises: ~azure.core.exceptions.HttpResponseError - """ 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 = "2016-06-01" + 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 + 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'), @@ -314,7 +302,80 @@ 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}'} # type: ignore + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + + 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"] + """Creates or updates a Recovery Services vault. + + :param resource_group_name: The name of the resource group where the recovery services vault is + present. + :type resource_group_name: str + :param vault_name: The name of the recovery services vault. + :type vault_name: str + :param vault: Recovery Services Vault to be created. + :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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Vault or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservices.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + vault=vault, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 def delete( self, @@ -340,7 +401,8 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-06-01" + api_version = "2021-03-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -357,6 +419,7 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -371,39 +434,25 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore - def update( + def _update_initial( self, resource_group_name, # type: str vault_name, # type: str vault, # type: "_models.PatchVault" **kwargs # type: Any ): - # type: (...) -> "_models.Vault" - """Updates the vault. - - :param resource_group_name: The name of the resource group where the recovery services vault is - present. - :type resource_group_name: str - :param vault_name: The name of the recovery services vault. - :type vault_name: str - :param vault: Recovery Services Vault to be created. - :type vault: ~azure.mgmt.recoveryservices.models.PatchVault - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Vault, or the result of cls(response) - :rtype: ~azure.mgmt.recoveryservices.models.Vault - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + # type: (...) -> 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 = "2016-06-01" + 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 + 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'), @@ -427,18 +476,89 @@ def update( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) + deserialized = None if response.status_code == 200: deserialized = self._deserialize('Vault', pipeline_response) - if response.status_code == 201: - deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + vault_name, # type: str + vault, # type: "_models.PatchVault" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Vault"] + """Updates the vault. + + :param resource_group_name: The name of the resource group where the recovery services vault is + present. + :type resource_group_name: str + :param vault_name: The name of the recovery services vault. + :type vault_name: str + :param vault: Recovery Services Vault to be created. + :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. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Vault or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservices.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + vault=vault, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('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) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + 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 diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/version.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/version.py deleted file mode 100644 index 152c552babee..000000000000 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/version.py +++ /dev/null @@ -1,12 +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. -# -------------------------------------------------------------------------- - -VERSION = "0.5.0"