Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Key Vault] Add 7.3-preview support for administration #20364

Merged
merged 6 commits into from
Aug 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sdk/keyvault/azure-keyvault-administration/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Release History

## 4.0.1 (Unreleased)
## 4.1.0b1 (Unreleased)

### Features Added
- Key Vault API version 7.3-preview is the default version

### Breaking Changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ class KeyVaultDataAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
WRITE_ROLE_ASSIGNMENT = "Microsoft.KeyVault/managedHsm/roleAssignments/write/action"
#: Get role definition.
READ_ROLE_DEFINITION = "Microsoft.KeyVault/managedHsm/roleDefinitions/read/action"
#: Create or update role definition.
WRITE_ROLE_DEFINITION = "Microsoft.KeyVault/managedHsm/roleDefinitions/write/action"
#: Delete role definition.
DELETE_ROLE_DEFINITION = "Microsoft.KeyVault/managedHsm/roleDefinitions/delete/action"
#: Encrypt using an HSM key.
ENCRYPT_HSM_KEY = "Microsoft.KeyVault/managedHsm/keys/encrypt/action"
#: Decrypt using an HSM key.
Expand All @@ -58,12 +62,16 @@ class KeyVaultDataAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
DELETE_HSM_KEY = "Microsoft.KeyVault/managedHsm/keys/delete"
#: Export an HSM key.
EXPORT_HSM_KEY = "Microsoft.KeyVault/managedHsm/keys/export/action"
#: Release an HSM key using Secure Key Release.
RELEASE_KEY = "Microsoft.KeyVault/managedHsm/keys/release/action"
#: Import an HSM key.
IMPORT_HSM_KEY = "Microsoft.KeyVault/managedHsm/keys/import/action"
#: Purge a deleted HSM key.
PURGE_DELETED_HSM_KEY = "Microsoft.KeyVault/managedHsm/keys/deletedKeys/delete"
#: Download an HSM security domain.
DOWNLOAD_HSM_SECURITY_DOMAIN = "Microsoft.KeyVault/managedHsm/securitydomain/download/action"
#: Check status of HSM security domain download.
DOWNLOAD_HSM_SECURITY_DOMAIN_STATUS = "Microsoft.KeyVault/managedHsm/securitydomain/download/read"
#: Upload an HSM security domain.
UPLOAD_HSM_SECURITY_DOMAIN = "Microsoft.KeyVault/managedHsm/securitydomain/upload/action"
#: Check the status of the HSM security domain exchange file.
Expand All @@ -78,3 +86,5 @@ class KeyVaultDataAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):
READ_HSM_BACKUP_STATUS = "Microsoft.KeyVault/managedHsm/backup/status/action"
#: Read an HSM restore status.
READ_HSM_RESTORE_STATUS = "Microsoft.KeyVault/managedHsm/restore/status/action"
#: Generate random numbers.
RANDOM_NUMBERS_GENERATE = "Microsoft.KeyVault/managedHsm/rng/action"
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def __init__(
profile=KnownProfiles.default, # type: KnownProfiles
**kwargs # type: Any
):
if api_version == '7.2':
if api_version == '7.2' or api_version == '7.3-preview':
base_url = '{vaultBaseUrl}'
else:
raise ValueError("API version {} is not available".format(api_version))
Expand All @@ -84,21 +84,28 @@ def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 7.2: :mod:`v7_2.models<azure.keyvault.v7_2.models>`
* 7.3-preview: :mod:`v7_3_preview.models<azure.keyvault.v7_3_preview.models>`
"""
if api_version == '7.2':
from .v7_2 import models
return models
elif api_version == '7.3-preview':
from .v7_3_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))

@property
def role_assignments(self):
"""Instance depends on the API version:
* 7.2: :class:`RoleAssignmentsOperations<azure.keyvault.v7_2.operations.RoleAssignmentsOperations>`
* 7.3-preview: :class:`RoleAssignmentsOperations<azure.keyvault.v7_3_preview.operations.RoleAssignmentsOperations>`
"""
api_version = self._get_api_version('role_assignments')
if api_version == '7.2':
from .v7_2.operations import RoleAssignmentsOperations as OperationClass
elif api_version == '7.3-preview':
from .v7_3_preview.operations import RoleAssignmentsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'role_assignments'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -108,10 +115,13 @@ def role_definitions(self):
"""Instance depends on the API version:
* 7.2: :class:`RoleDefinitionsOperations<azure.keyvault.v7_2.operations.RoleDefinitionsOperations>`
* 7.3-preview: :class:`RoleDefinitionsOperations<azure.keyvault.v7_3_preview.operations.RoleDefinitionsOperations>`
"""
api_version = self._get_api_version('role_definitions')
if api_version == '7.2':
from .v7_2.operations import RoleDefinitionsOperations as OperationClass
elif api_version == '7.3-preview':
from .v7_3_preview.operations import RoleDefinitionsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'role_definitions'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def begin_full_backup(
api_version = self._get_api_version('begin_full_backup')
if api_version == '7.2':
from .v7_2.operations import KeyVaultClientOperationsMixin as OperationClass
elif api_version == '7.3-preview':
from .v7_3_preview.operations import KeyVaultClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'begin_full_backup'".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -89,6 +91,8 @@ def begin_full_restore_operation(
api_version = self._get_api_version('begin_full_restore_operation')
if api_version == '7.2':
from .v7_2.operations import KeyVaultClientOperationsMixin as OperationClass
elif api_version == '7.3-preview':
from .v7_3_preview.operations import KeyVaultClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'begin_full_restore_operation'".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -129,6 +133,8 @@ def begin_selective_key_restore_operation(
api_version = self._get_api_version('begin_selective_key_restore_operation')
if api_version == '7.2':
from .v7_2.operations import KeyVaultClientOperationsMixin as OperationClass
elif api_version == '7.3-preview':
from .v7_3_preview.operations import KeyVaultClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'begin_selective_key_restore_operation'".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -159,6 +165,8 @@ def full_backup_status(
api_version = self._get_api_version('full_backup_status')
if api_version == '7.2':
from .v7_2.operations import KeyVaultClientOperationsMixin as OperationClass
elif api_version == '7.3-preview':
from .v7_3_preview.operations import KeyVaultClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'full_backup_status'".format(api_version))
mixin_instance = OperationClass()
Expand Down Expand Up @@ -189,6 +197,8 @@ def restore_status(
api_version = self._get_api_version('restore_status')
if api_version == '7.2':
from .v7_2.operations import KeyVaultClientOperationsMixin as OperationClass
elif api_version == '7.3-preview':
from .v7_3_preview.operations import KeyVaultClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'restore_status'".format(api_version))
mixin_instance = OperationClass()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(
profile: KnownProfiles = KnownProfiles.default,
**kwargs # type: Any
) -> None:
if api_version == '7.2':
if api_version == '7.2' or api_version == '7.3-preview':
base_url = '{vaultBaseUrl}'
else:
raise ValueError("API version {} is not available".format(api_version))
Expand All @@ -79,21 +79,28 @@ def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 7.2: :mod:`v7_2.models<azure.keyvault.v7_2.models>`
* 7.3-preview: :mod:`v7_3_preview.models<azure.keyvault.v7_3_preview.models>`
"""
if api_version == '7.2':
from ..v7_2 import models
return models
elif api_version == '7.3-preview':
from ..v7_3_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))

@property
def role_assignments(self):
"""Instance depends on the API version:
* 7.2: :class:`RoleAssignmentsOperations<azure.keyvault.v7_2.aio.operations.RoleAssignmentsOperations>`
* 7.3-preview: :class:`RoleAssignmentsOperations<azure.keyvault.v7_3_preview.aio.operations.RoleAssignmentsOperations>`
"""
api_version = self._get_api_version('role_assignments')
if api_version == '7.2':
from ..v7_2.aio.operations import RoleAssignmentsOperations as OperationClass
elif api_version == '7.3-preview':
from ..v7_3_preview.aio.operations import RoleAssignmentsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'role_assignments'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand All @@ -103,10 +110,13 @@ def role_definitions(self):
"""Instance depends on the API version:
* 7.2: :class:`RoleDefinitionsOperations<azure.keyvault.v7_2.aio.operations.RoleDefinitionsOperations>`
* 7.3-preview: :class:`RoleDefinitionsOperations<azure.keyvault.v7_3_preview.aio.operations.RoleDefinitionsOperations>`
"""
api_version = self._get_api_version('role_definitions')
if api_version == '7.2':
from ..v7_2.aio.operations import RoleDefinitionsOperations as OperationClass
elif api_version == '7.3-preview':
from ..v7_3_preview.aio.operations import RoleDefinitionsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'role_definitions'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async def begin_full_backup(
self,
vault_base_url: str,
azure_storage_blob_container_uri: Optional["_models.SASTokenParameter"] = None,
**kwargs
**kwargs: Any
) -> AsyncLROPoller["_models.FullBackupOperation"]:
"""Creates a full backup using a user-provided SAS token to an Azure blob storage container.
Expand All @@ -48,6 +48,8 @@ async def begin_full_backup(
api_version = self._get_api_version('begin_full_backup')
if api_version == '7.2':
from ..v7_2.aio.operations import KeyVaultClientOperationsMixin as OperationClass
elif api_version == '7.3-preview':
from ..v7_3_preview.aio.operations import KeyVaultClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'begin_full_backup'".format(api_version))
mixin_instance = OperationClass()
Expand All @@ -62,7 +64,7 @@ async def begin_full_restore_operation(
self,
vault_base_url: str,
restore_blob_details: Optional["_models.RestoreOperationParameters"] = None,
**kwargs
**kwargs: Any
) -> AsyncLROPoller["_models.RestoreOperation"]:
"""Restores all key materials using the SAS token pointing to a previously stored Azure Blob
storage backup folder.
Expand All @@ -85,6 +87,8 @@ async def begin_full_restore_operation(
api_version = self._get_api_version('begin_full_restore_operation')
if api_version == '7.2':
from ..v7_2.aio.operations import KeyVaultClientOperationsMixin as OperationClass
elif api_version == '7.3-preview':
from ..v7_3_preview.aio.operations import KeyVaultClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'begin_full_restore_operation'".format(api_version))
mixin_instance = OperationClass()
Expand All @@ -100,7 +104,7 @@ async def begin_selective_key_restore_operation(
vault_base_url: str,
key_name: str,
restore_blob_details: Optional["_models.SelectiveKeyRestoreOperationParameters"] = None,
**kwargs
**kwargs: Any
) -> AsyncLROPoller["_models.SelectiveKeyRestoreOperation"]:
"""Restores all key versions of a given key using user supplied SAS token pointing to a previously
stored Azure Blob storage backup folder.
Expand All @@ -125,6 +129,8 @@ async def begin_selective_key_restore_operation(
api_version = self._get_api_version('begin_selective_key_restore_operation')
if api_version == '7.2':
from ..v7_2.aio.operations import KeyVaultClientOperationsMixin as OperationClass
elif api_version == '7.3-preview':
from ..v7_3_preview.aio.operations import KeyVaultClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'begin_selective_key_restore_operation'".format(api_version))
mixin_instance = OperationClass()
Expand All @@ -139,7 +145,7 @@ async def full_backup_status(
self,
vault_base_url: str,
job_id: str,
**kwargs
**kwargs: Any
) -> "_models.FullBackupOperation":
"""Returns the status of full backup operation.
Expand All @@ -155,6 +161,8 @@ async def full_backup_status(
api_version = self._get_api_version('full_backup_status')
if api_version == '7.2':
from ..v7_2.aio.operations import KeyVaultClientOperationsMixin as OperationClass
elif api_version == '7.3-preview':
from ..v7_3_preview.aio.operations import KeyVaultClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'full_backup_status'".format(api_version))
mixin_instance = OperationClass()
Expand All @@ -169,7 +177,7 @@ async def restore_status(
self,
vault_base_url: str,
job_id: str,
**kwargs
**kwargs: Any
) -> "_models.RestoreOperation":
"""Returns the status of restore operation.
Expand All @@ -185,6 +193,8 @@ async def restore_status(
api_version = self._get_api_version('restore_status')
if api_version == '7.2':
from ..v7_2.aio.operations import KeyVaultClientOperationsMixin as OperationClass
elif api_version == '7.3-preview':
from ..v7_3_preview.aio.operations import KeyVaultClientOperationsMixin as OperationClass
else:
raise ValueError("API version {} does not have operation 'restore_status'".format(api_version))
mixin_instance = OperationClass()
Expand Down
Loading