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..28899aa88d86 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "V2", + "use": "@microsoft.azure/autorest.python@~4.0.71", + "commit": "63b1fd7575f4d3e51df80a8ccc4879e97ff92d17", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/recoveryservices/resource-manager/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2", + "readme": "specification/recoveryservices/resource-manager/readme.md" +} \ 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 845c00d6a784..7a0e1f602161 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 @@ -13,6 +13,7 @@ from msrest import Serializer, Deserializer from ._configuration import RecoveryServicesClientConfiguration +from .operations import RecoveryServicesClientOperationsMixin from .operations import VaultCertificatesOperations from .operations import RegisteredIdentitiesOperations from .operations import ReplicationUsagesOperations @@ -25,7 +26,7 @@ from . import models -class RecoveryServicesClient(SDKClient): +class RecoveryServicesClient(RecoveryServicesClientOperationsMixin, SDKClient): """Recovery Services Client :ivar config: Configuration for client. @@ -65,7 +66,7 @@ def __init__( super(RecoveryServicesClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2016-06-01' + self.api_version = '2021-03-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) 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 cfada5a8f252..10e06b21a664 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 @@ -18,10 +18,15 @@ from ._models_py3 import ClientDiscoveryForProperties from ._models_py3 import ClientDiscoveryForServiceSpecification 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,12 +41,15 @@ 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 VaultProperties + from ._models_py3 import VaultPropertiesEncryption from ._models_py3 import VaultUsage except (SyntaxError, ImportError): from ._models import CertificateRequest @@ -52,10 +60,15 @@ from ._models import ClientDiscoveryForProperties from ._models import ClientDiscoveryForServiceSpecification from ._models import ClientDiscoveryValueForSingleApi + from ._models import CmkKekIdentity + from ._models import CmkKeyVaultProperties + from ._models import Error + from ._models import ErrorAdditionalInfo from ._models import IdentityData from ._models import JobsSummary from ._models import MonitoringSummary from ._models import NameInfo + from ._models import OperationResource from ._models import PatchTrackedResource from ._models import PatchVault from ._models import PrivateEndpoint @@ -70,12 +83,15 @@ from ._models import ResourceCertificateAndAcsDetails from ._models import ResourceCertificateDetails from ._models import Sku + from ._models import SystemData from ._models import TrackedResource from ._models import UpgradeDetails + from ._models import UserIdentity from ._models import Vault from ._models import VaultCertificateResponse from ._models import VaultExtendedInfoResource from ._models import VaultProperties + from ._models import VaultPropertiesEncryption from ._models import VaultUsage from ._paged_models import ClientDiscoveryValueForSingleApiPaged from ._paged_models import PrivateLinkResourcePaged @@ -91,6 +107,8 @@ ProvisioningState, PrivateEndpointConnectionStatus, VaultPrivateEndpointState, + InfrastructureEncryptionState, + CreatedByType, UsagesUnit, ) @@ -103,10 +121,15 @@ 'ClientDiscoveryForProperties', 'ClientDiscoveryForServiceSpecification', 'ClientDiscoveryValueForSingleApi', + 'CmkKekIdentity', + 'CmkKeyVaultProperties', + 'Error', + 'ErrorAdditionalInfo', 'IdentityData', 'JobsSummary', 'MonitoringSummary', 'NameInfo', + 'OperationResource', 'PatchTrackedResource', 'PatchVault', 'PrivateEndpoint', @@ -121,12 +144,15 @@ 'ResourceCertificateAndAcsDetails', 'ResourceCertificateDetails', 'Sku', + 'SystemData', 'TrackedResource', 'UpgradeDetails', + 'UserIdentity', 'Vault', 'VaultCertificateResponse', 'VaultExtendedInfoResource', 'VaultProperties', + 'VaultPropertiesEncryption', 'VaultUsage', 'ReplicationUsagePaged', 'PrivateLinkResourcePaged', @@ -141,5 +167,7 @@ 'ProvisioningState', 'PrivateEndpointConnectionStatus', 'VaultPrivateEndpointState', + 'InfrastructureEncryptionState', + 'CreatedByType', 'UsagesUnit', ] diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models.py b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/models/_models.py index d2593aa62d56..3b7cd008b5bd 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 @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class CertificateRequest(Model): @@ -195,11 +196,144 @@ def __init__(self, **kwargs): class CloudError(Model): """CloudError. + + An error response from Azure Backup. + + :param error: + :type error: ~azure.mgmt.recoveryservices.models.Error + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__(self, **kwargs): + super(CloudError, self).__init__(**kwargs) + self.error = kwargs.get('error', None) + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class CmkKekIdentity(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(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(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(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: object + :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(Model): """Identity for the resource. @@ -213,10 +347,19 @@ class IdentityData(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 = { @@ -229,6 +372,7 @@ class IdentityData(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, **kwargs): @@ -236,6 +380,7 @@ def __init__(self, **kwargs): self.principal_id = None self.tenant_id = None self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) class JobsSummary(Model): @@ -322,6 +467,46 @@ def __init__(self, **kwargs): self.localized_value = kwargs.get('localized_value', None) +class OperationResource(Model): + """Operation Resource. + + :param end_time: End time of the operation + :type end_time: 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 + """ + + _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(Model): """ARM Resource. @@ -335,8 +520,8 @@ class Resource(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 = { @@ -349,7 +534,7 @@ class Resource(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, **kwargs): @@ -357,7 +542,7 @@ def __init__(self, **kwargs): 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): @@ -373,8 +558,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: Resource tags. @@ -391,7 +576,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}'}, } @@ -415,8 +600,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: Resource tags. @@ -439,7 +624,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'}, @@ -792,6 +977,8 @@ class ResourceCertificateAndAadDetails(ResourceCertificateDetails): :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 = { @@ -818,6 +1005,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__(self, **kwargs): @@ -827,6 +1015,7 @@ def __init__(self, **kwargs): self.service_principal_client_id = kwargs.get('service_principal_client_id', None) self.service_principal_object_id = kwargs.get('service_principal_object_id', None) self.azure_management_endpoint_audience = kwargs.get('azure_management_endpoint_audience', None) + self.service_resource_id = kwargs.get('service_resource_id', None) self.auth_type = 'AzureActiveDirectory' @@ -900,6 +1089,8 @@ class Sku(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 = { @@ -908,11 +1099,55 @@ class Sku(Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, } def __init__(self, **kwargs): super(Sku, self).__init__(**kwargs) self.name = kwargs.get('name', None) + self.tier = kwargs.get('tier', None) + + +class SystemData(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 + :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 + """ + + _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): @@ -930,8 +1165,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: Resource tags. @@ -949,7 +1184,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}'}, } @@ -1029,6 +1264,34 @@ def __init__(self, **kwargs): self.previous_resource_id = None +class UserIdentity(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 object_id: The object ID of the user-assigned identity. + :vartype object_id: str + :ivar client_id: The client ID of the user-assigned identity. + :vartype client_id: str + """ + + _validation = { + 'object_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(UserIdentity, self).__init__(**kwargs) + self.object_id = None + self.client_id = None + + class Vault(TrackedResource): """Resource information, as returned by the resource provider. @@ -1044,8 +1307,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: Resource tags. @@ -1056,6 +1319,8 @@ class Vault(TrackedResource): :type properties: ~azure.mgmt.recoveryservices.models.VaultProperties :param sku: :type sku: ~azure.mgmt.recoveryservices.models.Sku + :param system_data: + :type system_data: ~azure.mgmt.recoveryservices.models.SystemData """ _validation = { @@ -1069,12 +1334,13 @@ class Vault(TrackedResource): '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, **kwargs): @@ -1082,6 +1348,7 @@ def __init__(self, **kwargs): self.identity = kwargs.get('identity', None) self.properties = kwargs.get('properties', None) self.sku = kwargs.get('sku', None) + self.system_data = kwargs.get('system_data', None) class VaultCertificateResponse(Model): @@ -1137,8 +1404,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. @@ -1159,7 +1426,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'}, @@ -1195,6 +1462,9 @@ class VaultProperties(Model): site recovery. Possible values include: 'None', 'Enabled' :vartype private_endpoint_state_for_site_recovery: str or ~azure.mgmt.recoveryservices.models.VaultPrivateEndpointState + :param encryption: Customer Managed Key details of the resource. + :type encryption: + ~azure.mgmt.recoveryservices.models.VaultPropertiesEncryption """ _validation = { @@ -1210,6 +1480,7 @@ class VaultProperties(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, **kwargs): @@ -1219,6 +1490,34 @@ def __init__(self, **kwargs): 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(Model): + """Customer Managed Key details of the resource. + + :param key_vault_properties: + :type key_vault_properties: + ~azure.mgmt.recoveryservices.models.CmkKeyVaultProperties + :param kek_identity: + :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(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 e6641c778a8a..42c0bf896c49 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 @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from msrest.serialization import Model +from msrest.exceptions import HttpOperationError class CertificateRequest(Model): @@ -195,11 +196,144 @@ def __init__(self, *, name: str=None, display=None, origin: str=None, properties class CloudError(Model): """CloudError. + + An error response from Azure Backup. + + :param error: + :type error: ~azure.mgmt.recoveryservices.models.Error + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__(self, *, error=None, **kwargs) -> None: + super(CloudError, self).__init__(**kwargs) + self.error = error + + +class CloudErrorException(HttpOperationError): + """Server responsed with exception of type: 'CloudError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args) + + +class CmkKekIdentity(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: bool=None, user_assigned_identity: str=None, **kwargs) -> None: + super(CmkKekIdentity, self).__init__(**kwargs) + self.use_system_assigned_identity = use_system_assigned_identity + self.user_assigned_identity = user_assigned_identity + + +class CmkKeyVaultProperties(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: str=None, **kwargs) -> None: + super(CmkKeyVaultProperties, self).__init__(**kwargs) + self.key_uri = key_uri + + +class Error(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) -> None: + super(Error, self).__init__(**kwargs) + self.additional_info = None + self.code = None + self.details = None + self.message = None + self.target = None + + +class ErrorAdditionalInfo(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: object + :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) -> None: + super(ErrorAdditionalInfo, self).__init__(**kwargs) + self.info = None + self.type = None + class IdentityData(Model): """Identity for the resource. @@ -213,10 +347,19 @@ class IdentityData(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 = { @@ -229,13 +372,15 @@ class IdentityData(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, **kwargs) -> None: + def __init__(self, *, type, user_assigned_identities=None, **kwargs) -> None: 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(Model): @@ -322,6 +467,46 @@ def __init__(self, *, value: str=None, localized_value: str=None, **kwargs) -> N self.localized_value = localized_value +class OperationResource(Model): + """Operation Resource. + + :param end_time: End time of the operation + :type end_time: 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 + """ + + _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=None, error=None, id: str=None, name: str=None, status: str=None, start_time=None, **kwargs) -> None: + 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(Model): """ARM Resource. @@ -335,8 +520,8 @@ class Resource(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 = { @@ -349,15 +534,15 @@ class Resource(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: str=None, **kwargs) -> None: + def __init__(self, *, etag: str=None, **kwargs) -> None: 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): @@ -373,8 +558,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: Resource tags. @@ -391,13 +576,13 @@ 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}'}, } - def __init__(self, *, e_tag: str=None, location: str=None, tags=None, **kwargs) -> None: - super(PatchTrackedResource, self).__init__(e_tag=e_tag, **kwargs) + def __init__(self, *, etag: str=None, location: str=None, tags=None, **kwargs) -> None: + super(PatchTrackedResource, self).__init__(etag=etag, **kwargs) self.location = location self.tags = tags @@ -415,8 +600,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: Resource tags. @@ -439,7 +624,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'}, @@ -447,8 +632,8 @@ class PatchVault(PatchTrackedResource): 'identity': {'key': 'identity', 'type': 'IdentityData'}, } - def __init__(self, *, e_tag: str=None, location: str=None, tags=None, properties=None, sku=None, identity=None, **kwargs) -> None: - super(PatchVault, self).__init__(e_tag=e_tag, location=location, tags=tags, **kwargs) + def __init__(self, *, etag: str=None, location: str=None, tags=None, properties=None, sku=None, identity=None, **kwargs) -> None: + super(PatchVault, self).__init__(etag=etag, location=location, tags=tags, **kwargs) self.properties = properties self.sku = sku self.identity = identity @@ -792,6 +977,8 @@ class ResourceCertificateAndAadDetails(ResourceCertificateDetails): :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 = { @@ -818,15 +1005,17 @@ 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__(self, *, aad_authority: str, aad_tenant_id: str, service_principal_client_id: str, service_principal_object_id: str, azure_management_endpoint_audience: str, certificate: bytearray=None, friendly_name: str=None, issuer: str=None, resource_id: int=None, subject: str=None, thumbprint: str=None, valid_from=None, valid_to=None, **kwargs) -> None: + def __init__(self, *, aad_authority: str, aad_tenant_id: str, service_principal_client_id: str, service_principal_object_id: str, azure_management_endpoint_audience: str, certificate: bytearray=None, friendly_name: str=None, issuer: str=None, resource_id: int=None, subject: str=None, thumbprint: str=None, valid_from=None, valid_to=None, service_resource_id: str=None, **kwargs) -> None: super(ResourceCertificateAndAadDetails, self).__init__(certificate=certificate, friendly_name=friendly_name, issuer=issuer, resource_id=resource_id, subject=subject, thumbprint=thumbprint, valid_from=valid_from, valid_to=valid_to, **kwargs) self.aad_authority = aad_authority self.aad_tenant_id = aad_tenant_id 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 self.auth_type = 'AzureActiveDirectory' @@ -900,6 +1089,8 @@ class Sku(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 = { @@ -908,11 +1099,55 @@ class Sku(Model): _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, } - def __init__(self, *, name, **kwargs) -> None: + def __init__(self, *, name, tier: str=None, **kwargs) -> None: super(Sku, self).__init__(**kwargs) self.name = name + self.tier = tier + + +class SystemData(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 + :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 + """ + + _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: str=None, created_by_type=None, created_at=None, last_modified_by: str=None, last_modified_by_type=None, last_modified_at=None, **kwargs) -> None: + 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): @@ -930,8 +1165,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: Resource tags. @@ -949,13 +1184,13 @@ 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}'}, } - def __init__(self, *, location: str, e_tag: str=None, tags=None, **kwargs) -> None: - super(TrackedResource, self).__init__(e_tag=e_tag, **kwargs) + def __init__(self, *, location: str, etag: str=None, tags=None, **kwargs) -> None: + super(TrackedResource, self).__init__(etag=etag, **kwargs) self.location = location self.tags = tags @@ -1029,6 +1264,34 @@ def __init__(self, **kwargs) -> None: self.previous_resource_id = None +class UserIdentity(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 object_id: The object ID of the user-assigned identity. + :vartype object_id: str + :ivar client_id: The client ID of the user-assigned identity. + :vartype client_id: str + """ + + _validation = { + 'object_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(UserIdentity, self).__init__(**kwargs) + self.object_id = None + self.client_id = None + + class Vault(TrackedResource): """Resource information, as returned by the resource provider. @@ -1044,8 +1307,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: Resource tags. @@ -1056,6 +1319,8 @@ class Vault(TrackedResource): :type properties: ~azure.mgmt.recoveryservices.models.VaultProperties :param sku: :type sku: ~azure.mgmt.recoveryservices.models.Sku + :param system_data: + :type system_data: ~azure.mgmt.recoveryservices.models.SystemData """ _validation = { @@ -1069,19 +1334,21 @@ class Vault(TrackedResource): '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: str=None, tags=None, identity=None, properties=None, sku=None, **kwargs) -> None: - super(Vault, self).__init__(e_tag=e_tag, location=location, tags=tags, **kwargs) + def __init__(self, *, location: str, etag: str=None, tags=None, identity=None, properties=None, sku=None, system_data=None, **kwargs) -> None: + super(Vault, self).__init__(etag=etag, location=location, tags=tags, **kwargs) self.identity = identity self.properties = properties self.sku = sku + self.system_data = system_data class VaultCertificateResponse(Model): @@ -1137,8 +1404,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. @@ -1159,15 +1426,15 @@ 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'}, 'algorithm': {'key': 'properties.algorithm', 'type': 'str'}, } - def __init__(self, *, e_tag: str=None, integrity_key: str=None, encryption_key: str=None, encryption_key_thumbprint: str=None, algorithm: str=None, **kwargs) -> None: - super(VaultExtendedInfoResource, self).__init__(e_tag=e_tag, **kwargs) + def __init__(self, *, etag: str=None, integrity_key: str=None, encryption_key: str=None, encryption_key_thumbprint: str=None, algorithm: str=None, **kwargs) -> None: + super(VaultExtendedInfoResource, self).__init__(etag=etag, **kwargs) self.integrity_key = integrity_key self.encryption_key = encryption_key self.encryption_key_thumbprint = encryption_key_thumbprint @@ -1195,6 +1462,9 @@ class VaultProperties(Model): site recovery. Possible values include: 'None', 'Enabled' :vartype private_endpoint_state_for_site_recovery: str or ~azure.mgmt.recoveryservices.models.VaultPrivateEndpointState + :param encryption: Customer Managed Key details of the resource. + :type encryption: + ~azure.mgmt.recoveryservices.models.VaultPropertiesEncryption """ _validation = { @@ -1210,15 +1480,44 @@ class VaultProperties(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=None, **kwargs) -> None: + def __init__(self, *, upgrade_details=None, encryption=None, **kwargs) -> None: super(VaultProperties, self).__init__(**kwargs) self.provisioning_state = None self.upgrade_details = upgrade_details 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(Model): + """Customer Managed Key details of the resource. + + :param key_vault_properties: + :type key_vault_properties: + ~azure.mgmt.recoveryservices.models.CmkKeyVaultProperties + :param kek_identity: + :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=None, kek_identity=None, infrastructure_encryption=None, **kwargs) -> None: + super(VaultPropertiesEncryption, self).__init__(**kwargs) + self.key_vault_properties = key_vault_properties + self.kek_identity = kek_identity + self.infrastructure_encryption = infrastructure_encryption class VaultUsage(Model): 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 26d3025c4aaf..c5975d4db658 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 @@ -45,6 +45,8 @@ class ResourceIdentityType(str, Enum): system_assigned = "SystemAssigned" none = "None" + user_assigned = "UserAssigned" + system_assigned_user_assigned = "SystemAssigned, UserAssigned" class ProvisioningState(str, Enum): @@ -69,6 +71,20 @@ class VaultPrivateEndpointState(str, Enum): enabled = "Enabled" +class InfrastructureEncryptionState(str, Enum): + + enabled = "Enabled" + disabled = "Disabled" + + +class CreatedByType(str, Enum): + + user = "User" + application = "Application" + managed_identity = "ManagedIdentity" + key = "Key" + + class UsagesUnit(str, Enum): count = "Count" 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 8c7fb955c340..d939ef33a2a0 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 @@ -18,6 +18,7 @@ from ._operations import Operations from ._vault_extended_info_operations import VaultExtendedInfoOperations from ._usages_operations import UsagesOperations +from ._recovery_services_client_operations import RecoveryServicesClientOperationsMixin __all__ = [ 'VaultCertificatesOperations', @@ -29,4 +30,5 @@ 'Operations', 'VaultExtendedInfoOperations', 'UsagesOperations', + 'RecoveryServicesClientOperationsMixin', ] 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 f4e2a2fb5bc1..64221ecf41d7 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 @@ -25,7 +25,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2016-06-01". + :ivar api_version: Client Api Version. Constant value: "2021-03-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-06-01" + self.api_version = "2021-03-01" self.config = config 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 733c6c5abd99..8c4e33d689ff 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 @@ -25,7 +25,7 @@ class PrivateLinkResourcesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2016-06-01". + :ivar api_version: Client Api Version. Constant value: "2021-03-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-06-01" + self.api_version = "2021-03-01" self.config = config 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..f2dccd4359e5 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/azure/mgmt/recoveryservices/operations/_recovery_services_client_operations.py @@ -0,0 +1,150 @@ +# 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.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling +from .. import models +import uuid + + +class RecoveryServicesClientOperationsMixin(object): + + def get_operation_status( + self, resource_group_name, vault_name, operation_id, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: OperationResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.recoveryservices.models.OperationResource or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_operation_status.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('OperationResource', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationStatus/{operationId}'} + + def get_operation_result( + self, resource_group_name, vault_name, operation_id, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: Vault or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.recoveryservices.models.Vault or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get_operation_result.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('Vault', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_operation_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationResults/{operationId}'} 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 bb245f62e1c1..ce2328d4319f 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 @@ -25,7 +25,7 @@ class RecoveryServicesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2016-06-01". + :ivar api_version: Client Api Version. Constant value: "2021-03-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-06-01" + self.api_version = "2021-03-01" self.config = config 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 6ceb55258ea5..0b8b48449ab5 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 @@ -25,7 +25,7 @@ class RegisteredIdentitiesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2016-06-01". + :ivar api_version: Client Api Version. Constant value: "2021-03-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-06-01" + self.api_version = "2021-03-01" self.config = config 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 3745df04f7aa..24f10fce8c8e 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 @@ -25,7 +25,7 @@ class ReplicationUsagesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2016-06-01". + :ivar api_version: Client Api Version. Constant value: "2021-03-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-06-01" + self.api_version = "2021-03-01" self.config = config 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 28ed089540c6..9005a7c0796c 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 @@ -25,7 +25,7 @@ class UsagesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2016-06-01". + :ivar api_version: Client Api Version. Constant value: "2021-03-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-06-01" + self.api_version = "2021-03-01" self.config = config 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 fd45b9407935..0b52c9b50afa 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 @@ -25,7 +25,7 @@ class VaultCertificatesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2016-06-01". + :ivar api_version: Client Api Version. Constant value: "2021-03-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-06-01" + self.api_version = "2021-03-01" self.config = config 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 91591c004bfa..d12ae2a8f876 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 @@ -25,7 +25,7 @@ class VaultExtendedInfoOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2016-06-01". + :ivar api_version: Client Api Version. Constant value: "2021-03-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-06-01" + self.api_version = "2021-03-01" self.config = config 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 e007b3b7db7a..96f6c5fbd66b 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,6 +12,8 @@ import uuid from msrest.pipeline import ClientRawResponse from msrestazure.azure_exceptions import CloudError +from msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling from .. import models @@ -25,7 +27,7 @@ class VaultsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2016-06-01". + :ivar api_version: Client Api Version. Constant value: "2021-03-01". """ models = models @@ -35,7 +37,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2016-06-01" + self.api_version = "2021-03-01" self.config = config @@ -237,27 +239,9 @@ def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} - def create_or_update( - self, resource_group_name, vault_name, vault, custom_headers=None, raw=False, **operation_config): - """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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Vault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.recoveryservices.models.Vault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _create_or_update_initial( + self, resource_group_name, vault_name, vault, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.create_or_update.metadata['url'] path_format_arguments = { @@ -295,6 +279,7 @@ def create_or_update( raise exp deserialized = None + if response.status_code == 200: deserialized = self._deserialize('Vault', response) if response.status_code == 201: @@ -305,6 +290,56 @@ def create_or_update( return client_raw_response return deserialized + + def create_or_update( + self, resource_group_name, vault_name, vault, custom_headers=None, raw=False, polling=True, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Vault or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.recoveryservices.models.Vault] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.recoveryservices.models.Vault]] + :raises: :class:`CloudError` + """ + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + vault=vault, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Vault', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} def delete( @@ -361,27 +396,9 @@ def delete( return client_raw_response delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'} - def update( - self, resource_group_name, vault_name, vault, custom_headers=None, raw=False, **operation_config): - """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 - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: Vault or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.recoveryservices.models.Vault or - ~msrest.pipeline.ClientRawResponse - :raises: :class:`CloudError` - """ + def _update_initial( + self, resource_group_name, vault_name, vault, custom_headers=None, raw=False, **operation_config): # Construct URL url = self.update.metadata['url'] path_format_arguments = { @@ -413,20 +430,69 @@ def update( request = self._client.patch(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 201]: + if response.status_code not in [200, 202]: exp = CloudError(response) exp.request_id = response.headers.get('x-ms-request-id') raise exp deserialized = None + if response.status_code == 200: deserialized = self._deserialize('Vault', response) - if response.status_code == 201: - deserialized = self._deserialize('Vault', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized + + def update( + self, resource_group_name, vault_name, vault, custom_headers=None, raw=False, polling=True, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns Vault or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.recoveryservices.models.Vault] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.recoveryservices.models.Vault]] + :raises: :class:`CloudError` + """ + raw_result = self._update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + vault=vault, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('Vault', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}'}