Skip to content

Commit f412402

Browse files
authored
[Key Vault] Support 7.5 API version in Administration (#34057)
1 parent 0cb2dec commit f412402

34 files changed

+4336
-4747
lines changed

sdk/keyvault/azure-keyvault-administration/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,17 @@
33
## 4.4.0b3 (Unreleased)
44

55
### Features Added
6+
- Added support for service API version `7.5`
67

78
### Breaking Changes
89

910
### Bugs Fixed
1011

1112
### Other Changes
1213
- Python 3.7 is no longer supported. Please use Python version 3.8 or later.
14+
- Key Vault API version `7.5` is now the default
15+
- Updated minimum `azure-core` version to 1.29.5
16+
- Dropped `azure-common` requirement
1317

1418
## 4.4.0b2 (2023-11-03)
1519

sdk/keyvault/azure-keyvault-administration/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "python",
44
"TagPrefix": "python/keyvault/azure-keyvault-administration",
5-
"Tag": "python/keyvault/azure-keyvault-administration_fe726effe9"
5+
"Tag": "python/keyvault/azure-keyvault-administration_b16e831fc9"
66
}

sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_backup_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def begin_backup(self, blob_storage_url: str, *args: str, **kwargs: Any) -> LROP
7474
:keyword use_managed_identity: Indicates which authentication method should be used. If set to True, Managed HSM
7575
will use the configured user-assigned managed identity to authenticate with Azure Storage. Otherwise, a SAS
7676
token has to be specified.
77-
:paramtype use_managed_identity: Literal[True]
77+
:paramtype use_managed_identity: bool
7878
:keyword str continuation_token: A continuation token to restart polling from a saved state.
7979
8080
:returns: An :class:`~azure.core.polling.LROPoller` instance. Call `result()` on this object to wait for the
@@ -169,7 +169,7 @@ def begin_restore(self, folder_url: str, *args: str, **kwargs: Any) -> LROPoller
169169
:keyword use_managed_identity: Indicates which authentication method should be used. If set to True, Managed HSM
170170
will use the configured user-assigned managed identity to authenticate with Azure Storage. Otherwise, a SAS
171171
token has to be specified.
172-
:paramtype use_managed_identity: Literal[True]
172+
:paramtype use_managed_identity: bool
173173
:keyword str key_name: Name of a single key in the backup. When set, only this key will be restored.
174174
:keyword str continuation_token: A continuation token to restart polling from a saved state.
175175

sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from ._key_vault_client import KeyVaultClient
9+
from ._client import KeyVaultClient
1010

1111
try:
1212
from ._patch import __all__ as _patch_all
Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from typing import Any
1111

1212
from azure.core import PipelineClient
13+
from azure.core.pipeline import policies
1314
from azure.core.rest import HttpRequest, HttpResponse
1415

1516
from . import models as _models
@@ -23,11 +24,11 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-a
2324
Vault service.
2425
2526
:ivar role_definitions: RoleDefinitionsOperations operations
26-
:vartype role_definitions: key_vault_client.operations.RoleDefinitionsOperations
27+
:vartype role_definitions: azure.keyvault.v7_5.operations.RoleDefinitionsOperations
2728
:ivar role_assignments: RoleAssignmentsOperations operations
28-
:vartype role_assignments: key_vault_client.operations.RoleAssignmentsOperations
29-
:keyword api_version: Api Version. Default value is "7.5-preview.1". Note that overriding this
30-
default value may result in unsupported behavior.
29+
:vartype role_assignments: azure.keyvault.v7_5.operations.RoleAssignmentsOperations
30+
:keyword api_version: Api Version. Default value is "7.5". Note that overriding this default
31+
value may result in unsupported behavior.
3132
:paramtype api_version: str
3233
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
3334
Retry-After header is present.
@@ -36,9 +37,27 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): # pylint: disable=client-a
3637
def __init__(self, **kwargs: Any) -> None: # pylint: disable=missing-client-constructor-parameter-credential
3738
_endpoint = "{vaultBaseUrl}"
3839
self._config = KeyVaultClientConfiguration(**kwargs)
39-
self._client: PipelineClient = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
40-
41-
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
40+
_policies = kwargs.pop("policies", None)
41+
if _policies is None:
42+
_policies = [
43+
policies.RequestIdPolicy(**kwargs),
44+
self._config.headers_policy,
45+
self._config.user_agent_policy,
46+
self._config.proxy_policy,
47+
policies.ContentDecodePolicy(**kwargs),
48+
self._config.redirect_policy,
49+
self._config.retry_policy,
50+
self._config.authentication_policy,
51+
self._config.custom_hook_policy,
52+
self._config.logging_policy,
53+
policies.DistributedTracingPolicy(**kwargs),
54+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
55+
self._config.http_logging_policy,
56+
]
57+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
58+
59+
client_models = {k: v for k, v in _models._models.__dict__.items() if isinstance(v, type)}
60+
client_models.update({k: v for k, v in _models.__dict__.items() if isinstance(v, type)})
4261
self._serialize = Serializer(client_models)
4362
self._deserialize = Deserializer(client_models)
4463
self._serialize.client_side_validation = False
@@ -49,13 +68,13 @@ def __init__(self, **kwargs: Any) -> None: # pylint: disable=missing-client-con
4968
self._client, self._config, self._serialize, self._deserialize
5069
)
5170

52-
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
71+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
5372
"""Runs the network request through the client's chained policies.
5473
5574
>>> from azure.core.rest import HttpRequest
5675
>>> request = HttpRequest("GET", "https://www.example.org/")
5776
<HttpRequest [GET], url: 'https://www.example.org/'>
58-
>>> response = client._send_request(request)
77+
>>> response = client.send_request(request)
5978
<HttpResponse: 200 OK>
6079
6180
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
@@ -69,7 +88,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
6988

7089
request_copy = deepcopy(request)
7190
request_copy.url = self._client.format_url(request_copy.url)
72-
return self._client.send_request(request_copy, **kwargs)
91+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
7392

7493
def close(self) -> None:
7594
self._client.close()

sdk/keyvault/azure-keyvault-administration/azure/keyvault/administration/_generated/_configuration.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,28 @@
88

99
from typing import Any
1010

11-
from azure.core.configuration import Configuration
1211
from azure.core.pipeline import policies
1312

1413
VERSION = "unknown"
1514

1615

17-
class KeyVaultClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
16+
class KeyVaultClientConfiguration: # pylint: disable=too-many-instance-attributes
1817
"""Configuration for KeyVaultClient.
1918
2019
Note that all parameters used to create this instance are saved as instance
2120
attributes.
2221
23-
:keyword api_version: Api Version. Default value is "7.5-preview.1". Note that overriding this
24-
default value may result in unsupported behavior.
22+
:keyword api_version: Api Version. Default value is "7.5". Note that overriding this default
23+
value may result in unsupported behavior.
2524
:paramtype api_version: str
2625
"""
2726

2827
def __init__(self, **kwargs: Any) -> None:
29-
super(KeyVaultClientConfiguration, self).__init__(**kwargs)
30-
api_version: str = kwargs.pop("api_version", "7.5-preview.1")
28+
api_version: str = kwargs.pop("api_version", "7.5")
3129

3230
self.api_version = api_version
3331
kwargs.setdefault("sdk_moniker", "keyvault/{}".format(VERSION))
32+
self.polling_interval = kwargs.get("polling_interval", 30)
3433
self._configure(**kwargs)
3534

3635
def _configure(self, **kwargs: Any) -> None:
@@ -39,7 +38,7 @@ def _configure(self, **kwargs: Any) -> None:
3938
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
4039
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
4140
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
42-
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
4341
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
4442
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
43+
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
4544
self.authentication_policy = kwargs.get("authentication_policy")

0 commit comments

Comments
 (0)