Skip to content

[Key Vault] Add 7.3 API version, prep for stable releases #23603

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

Merged
merged 11 commits into from
Mar 24, 2022
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 4 additions & 5 deletions sdk/keyvault/azure-keyvault-administration/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Release History

## 4.1.0b4 (Unreleased)
## 4.1.0 (2022-03-24)

### Features Added

### Breaking Changes

### Bugs Fixed
- Key Vault API version 7.3 is now the default
- Added support for multi-tenant authentication when using `azure-identity`
1.8.0 or newer ([#20698](https://github.com/Azure/azure-sdk-for-python/issues/20698))

### Other Changes
- (From 4.1.0b3) Python 2.7 is no longer supported. Please use Python version 3.6 or later.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@

from typing import TYPE_CHECKING

from msrest import Deserializer, Serializer

from azure.core import PipelineClient
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from msrest import Deserializer, Serializer

from ._configuration import KeyVaultClientConfiguration
from ._operations_mixin import KeyVaultClientOperationsMixin
Expand All @@ -23,8 +24,6 @@
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Optional

from azure.core.pipeline.transport import HttpRequest, HttpResponse

class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Expand All @@ -49,7 +48,7 @@ class KeyVaultClient(KeyVaultClientOperationsMixin, MultiApiClientMixin, _SDKCli
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

DEFAULT_API_VERSION = '7.2'
DEFAULT_API_VERSION = '7.3'
_PROFILE_TAG = "azure.keyvault.KeyVaultClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
Expand All @@ -64,7 +63,7 @@ def __init__(
profile=KnownProfiles.default, # type: KnownProfiles
**kwargs # type: Any
):
if api_version == '7.2' or api_version == '7.3-preview':
if api_version == '7.2' or api_version == '7.3':
base_url = '{vaultBaseUrl}'
else:
raise ValueError("API version {} is not available".format(api_version))
Expand All @@ -84,13 +83,13 @@ 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>`
* 7.3: :mod:`v7_3.models<azure.keyvault.v7_3.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
elif api_version == '7.3':
from .v7_3 import models
return models
raise ValueError("API version {} is not available".format(api_version))

Expand All @@ -99,13 +98,13 @@ 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>`
* 7.3: :class:`RoleAssignmentsOperations<azure.keyvault.v7_3.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
elif api_version == '7.3':
from .v7_3.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 @@ -115,13 +114,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>`
* 7.3: :class:`RoleDefinitionsOperations<azure.keyvault.v7_3.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
elif api_version == '7.3':
from .v7_3.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 @@ -10,17 +10,12 @@
# --------------------------------------------------------------------------
from msrest import Serializer, Deserializer
from typing import TYPE_CHECKING
import warnings

from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.polling.base_polling import LROBasePolling

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union
from typing import Any, Optional

from azure.core.polling import LROPoller


class KeyVaultClientOperationsMixin(object):
Expand All @@ -31,29 +26,34 @@ def begin_full_backup(
azure_storage_blob_container_uri=None, # type: Optional["_models.SASTokenParameter"]
**kwargs # type: Any
):
"""Creates a full backup using a user-provided SAS token to an Azure blob storage container.
# type: (...) -> LROPoller["_models.FullBackupOperation"]
"""Creates a full backup using a user-provided SAS token to an Azure blob storage container. This
operation is supported only by the Managed HSM service.

:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.
:type vault_base_url: str
:param azure_storage_blob_container_uri: Azure blob shared access signature token pointing to a
valid Azure blob container where full backup needs to be stored. This token needs to be valid
for at least next 24 hours from the time of making this call.
:type azure_storage_blob_container_uri: ~azure.keyvault.v7_2.models.SASTokenParameter
for at least next 24 hours from the time of making this call. Default value is None.
:type azure_storage_blob_container_uri: ~azure.keyvault.v7_3.models.SASTokenParameter
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be LROBasePolling.
Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of LROPoller that returns either FullBackupOperation or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.FullBackupOperation]
:raises ~azure.core.exceptions.HttpResponseError:
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either FullBackupOperation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.FullBackupOperation]
:raises: ~azure.core.exceptions.HttpResponseError
"""
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
elif api_version == '7.3':
from .v7_3.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 @@ -70,29 +70,33 @@ def begin_full_restore_operation(
restore_blob_details=None, # type: Optional["_models.RestoreOperationParameters"]
**kwargs # type: Any
):
# type: (...) -> LROPoller["_models.RestoreOperation"]
"""Restores all key materials using the SAS token pointing to a previously stored Azure Blob
storage backup folder.

:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.
:type vault_base_url: str
:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous
successful full backup was stored.
:type restore_blob_details: ~azure.keyvault.v7_2.models.RestoreOperationParameters
successful full backup was stored. Default value is None.
:type restore_blob_details: ~azure.keyvault.v7_3.models.RestoreOperationParameters
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be LROBasePolling.
Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of LROPoller that returns either RestoreOperation or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.RestoreOperation]
:raises ~azure.core.exceptions.HttpResponseError:
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either RestoreOperation or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.RestoreOperation]
:raises: ~azure.core.exceptions.HttpResponseError
"""
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
elif api_version == '7.3':
from .v7_3.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 @@ -110,6 +114,7 @@ def begin_selective_key_restore_operation(
restore_blob_details=None, # type: Optional["_models.SelectiveKeyRestoreOperationParameters"]
**kwargs # type: Any
):
# type: (...) -> LROPoller["_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 @@ -118,23 +123,26 @@ def begin_selective_key_restore_operation(
:param key_name: The name of the key to be restored from the user supplied backup.
:type key_name: str
:param restore_blob_details: The Azure blob SAS token pointing to a folder where the previous
successful full backup was stored.
:type restore_blob_details: ~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperationParameters
successful full backup was stored. Default value is None.
:type restore_blob_details: ~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperationParameters
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be LROBasePolling.
Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy.
:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_2.models.SelectiveKeyRestoreOperation]
:raises ~azure.core.exceptions.HttpResponseError:
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either SelectiveKeyRestoreOperation or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.keyvault.v7_3.models.SelectiveKeyRestoreOperation]
:raises: ~azure.core.exceptions.HttpResponseError
"""
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
elif api_version == '7.3':
from .v7_3.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 @@ -151,6 +159,7 @@ def full_backup_status(
job_id, # type: str
**kwargs # type: Any
):
# type: (...) -> "_models.FullBackupOperation"
"""Returns the status of full backup operation.

:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.
Expand All @@ -159,14 +168,14 @@ def full_backup_status(
:type job_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: FullBackupOperation, or the result of cls(response)
:rtype: ~azure.keyvault.v7_2.models.FullBackupOperation
:rtype: ~azure.keyvault.v7_3.models.FullBackupOperation
:raises: ~azure.core.exceptions.HttpResponseError
"""
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
elif api_version == '7.3':
from .v7_3.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 @@ -183,6 +192,7 @@ def restore_status(
job_id, # type: str
**kwargs # type: Any
):
# type: (...) -> "_models.RestoreOperation"
"""Returns the status of restore operation.

:param vault_base_url: The vault name, for example https://myvault.vault.azure.net.
Expand All @@ -191,14 +201,14 @@ def restore_status(
:type job_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: RestoreOperation, or the result of cls(response)
:rtype: ~azure.keyvault.v7_2.models.RestoreOperation
:rtype: ~azure.keyvault.v7_3.models.RestoreOperation
:raises: ~azure.core.exceptions.HttpResponseError
"""
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
elif api_version == '7.3':
from .v7_3.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