Skip to content

Commit 71c9a31

Browse files
author
Zim Kalinowski
committed
updated keyvault
1 parent 717c419 commit 71c9a31

File tree

76 files changed

+9669
-4622
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+9669
-4622
lines changed

sdk/keyvault/azure-mgmt-keyvault/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Microsoft Azure SDK for Python
22

3-
This is the Microsoft Azure Key Vault Management Client Library.
3+
This is the Microsoft Azure MyService Management Client Library.
44
This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8.
55
For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/)
66

77

88
# Usage
99

10-
For code examples, see [Key Vault Management](https://docs.microsoft.com/python/api/overview/azure/key-vault)
10+
For code examples, see [MyService Management](https://docs.microsoft.com/python/api/overview/azure/)
1111
on docs.microsoft.com.
1212

1313

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
118

12-
from ._configuration import KeyVaultManagementClientConfiguration
139
from ._key_vault_management_client import KeyVaultManagementClient
14-
__all__ = ['KeyVaultManagementClient', 'KeyVaultManagementClientConfiguration']
15-
16-
from .version import VERSION
17-
18-
__version__ = VERSION
19-
10+
__all__ = ['KeyVaultManagementClient']

sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,57 @@
88
# Changes may cause incorrect behavior and will be lost if the code is
99
# regenerated.
1010
# --------------------------------------------------------------------------
11-
from msrestazure import AzureConfiguration
11+
from typing import Any
1212

13-
from .version import VERSION
13+
from azure.core.configuration import Configuration
14+
from azure.core.pipeline import policies
1415

16+
from ._version import VERSION
17+
18+
19+
class KeyVaultManagementClientConfiguration(Configuration):
20+
"""Configuration for KeyVaultManagementClient.
1521
16-
class KeyVaultManagementClientConfiguration(AzureConfiguration):
17-
"""Configuration for KeyVaultManagementClient
1822
Note that all parameters used to create this instance are saved as instance
1923
attributes.
2024
21-
:param credentials: Credentials needed for the client to connect to Azure.
22-
:type credentials: :mod:`A msrestazure Credentials
23-
object<msrestazure.azure_active_directory>`
24-
:param subscription_id: Subscription credentials which uniquely identify
25-
Microsoft Azure subscription. The subscription ID forms part of the URI
26-
for every service call.
25+
:param credential: Credential needed for the client to connect to Azure.
26+
:type credential: azure.core.credentials.TokenCredential
27+
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
2728
:type subscription_id: str
28-
:param str base_url: Service URL
2929
"""
3030

3131
def __init__(
32-
self, credentials, subscription_id, base_url=None):
33-
34-
if credentials is None:
35-
raise ValueError("Parameter 'credentials' must not be None.")
32+
self,
33+
credential, # type: "TokenCredential"
34+
subscription_id, # type: str
35+
**kwargs # type: Any
36+
):
37+
# type: (...) -> None
38+
if credential is None:
39+
raise ValueError("Parameter 'credential' must not be None.")
3640
if subscription_id is None:
3741
raise ValueError("Parameter 'subscription_id' must not be None.")
38-
if not base_url:
39-
base_url = 'https://management.azure.com'
40-
41-
super(KeyVaultManagementClientConfiguration, self).__init__(base_url)
42+
super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs)
4243

43-
# Starting Autorest.Python 4.0.64, make connection pool activated by default
44-
self.keep_alive = True
45-
46-
self.add_user_agent('azure-mgmt-keyvault/{}'.format(VERSION))
47-
self.add_user_agent('Azure-SDK-For-Python')
48-
49-
self.credentials = credentials
44+
self.credential = credential
5045
self.subscription_id = subscription_id
46+
self.credential_scopes = ['https://management.azure.com/.default']
47+
kwargs.setdefault('sdk_moniker', 'azure-mgmt-keyvault/{}'.format(VERSION))
48+
self._configure(**kwargs)
49+
50+
def _configure(
51+
self,
52+
**kwargs # type: Any
53+
):
54+
# type: (...) -> None
55+
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
56+
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
57+
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
58+
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
59+
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
60+
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
61+
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
62+
self.authentication_policy = kwargs.get('authentication_policy')
63+
if self.credential and not self.authentication_policy:
64+
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)

sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,34 @@
99
# regenerated.
1010
# --------------------------------------------------------------------------
1111

12-
from msrest.service_client import SDKClient
12+
from azure.mgmt.core import ARMPipelineClient
1313
from msrest import Serializer, Deserializer
1414

1515
from azure.profiles import KnownProfiles, ProfileDefinition
1616
from azure.profiles.multiapiclient import MultiApiClientMixin
1717
from ._configuration import KeyVaultManagementClientConfiguration
1818

19+
class _SDKClient(object):
20+
def __init__(self, *args, **kwargs):
21+
"""This is a fake class to support current implemetation of MultiApiClientMixin."
22+
Will be removed in final version of multiapi azure-core based client
23+
"""
24+
pass
1925

20-
21-
class KeyVaultManagementClient(MultiApiClientMixin, SDKClient):
26+
class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient):
2227
"""The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.
2328
24-
This ready contains multiple API versions, to help you deal with all Azure clouds
29+
This ready contains multiple API versions, to help you deal with all of the Azure clouds
2530
(Azure Stack, Azure Government, Azure China, etc.).
26-
By default, uses latest API version available on public Azure.
27-
For production, you should stick a particular api-version and/or profile.
28-
The profile sets a mapping between the operation group and an API version.
31+
By default, it uses the latest API version available on public Azure.
32+
For production, you should stick to a particular api-version and/or profile.
33+
The profile sets a mapping between an operation group and its API version.
2934
The api-version parameter sets the default API version if the operation
3035
group is not described in the profile.
3136
32-
:ivar config: Configuration for client.
33-
:vartype config: KeyVaultManagementClientConfiguration
34-
35-
:param credentials: Credentials needed for the client to connect to Azure.
36-
:type credentials: :mod:`A msrestazure Credentials
37-
object<msrestazure.azure_active_directory>`
38-
:param subscription_id: Subscription credentials which uniquely identify
37+
:param credential: Credential needed for the client to connect to Azure.
38+
:type credential: azure.core.credentials.TokenCredential
39+
:param subscription_id: Subscription credential which uniquely identify
3940
Microsoft Azure subscription. The subscription ID forms part of the URI
4041
for every service call.
4142
:type subscription_id: str
@@ -55,11 +56,14 @@ class KeyVaultManagementClient(MultiApiClientMixin, SDKClient):
5556
_PROFILE_TAG + " latest"
5657
)
5758

58-
def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default):
59-
self.config = KeyVaultManagementClientConfiguration(credentials, subscription_id, base_url)
59+
def __init__(self, credential, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default, **kwargs):
60+
if not base_url:
61+
base_url = 'https://management.azure.com'
62+
self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs)
63+
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
6064
super(KeyVaultManagementClient, self).__init__(
61-
credentials,
62-
self.config,
65+
credential,
66+
self._config,
6367
api_version=api_version,
6468
profile=profile
6569
)
@@ -104,7 +108,7 @@ def operations(self):
104108
from .v2019_09_01.operations import Operations as OperationClass
105109
else:
106110
raise NotImplementedError("APIVersion {} is not available".format(api_version))
107-
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
111+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
108112

109113
@property
110114
def private_endpoint_connections(self):
@@ -120,7 +124,7 @@ def private_endpoint_connections(self):
120124
from .v2019_09_01.operations import PrivateEndpointConnectionsOperations as OperationClass
121125
else:
122126
raise NotImplementedError("APIVersion {} is not available".format(api_version))
123-
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
127+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
124128

125129
@property
126130
def private_link_resources(self):
@@ -136,7 +140,7 @@ def private_link_resources(self):
136140
from .v2019_09_01.operations import PrivateLinkResourcesOperations as OperationClass
137141
else:
138142
raise NotImplementedError("APIVersion {} is not available".format(api_version))
139-
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
143+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
140144

141145
@property
142146
def vaults(self):
@@ -155,4 +159,12 @@ def vaults(self):
155159
from .v2019_09_01.operations import VaultsOperations as OperationClass
156160
else:
157161
raise NotImplementedError("APIVersion {} is not available".format(api_version))
158-
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
162+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
163+
164+
def close(self):
165+
self._client.close()
166+
def __enter__(self):
167+
self._client.__enter__()
168+
return self
169+
def __exit__(self, *exc_details):
170+
self._client.__exit__(*exc_details)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
# --------------------------------------------------------------------------
7+
8+
VERSION = "3.0.0b1"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Marker file for PEP 561.
Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
118

12-
from ._configuration import KeyVaultManagementClientConfiguration
139
from ._key_vault_management_client import KeyVaultManagementClient
14-
__all__ = ['KeyVaultManagementClient', 'KeyVaultManagementClientConfiguration']
15-
16-
from .version import VERSION
17-
18-
__version__ = VERSION
19-
10+
__all__ = ['KeyVaultManagementClient']
Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,62 @@
11
# coding=utf-8
22
# --------------------------------------------------------------------------
33
# Copyright (c) Microsoft Corporation. All rights reserved.
4-
# Licensed under the MIT License. See License.txt in the project root for
5-
# license information.
6-
#
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
75
# Code generated by Microsoft (R) AutoRest Code Generator.
8-
# Changes may cause incorrect behavior and will be lost if the code is
9-
# regenerated.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
107
# --------------------------------------------------------------------------
11-
from msrestazure import AzureConfiguration
128

13-
from .version import VERSION
9+
from typing import Any
1410

11+
from azure.core.configuration import Configuration
12+
from azure.core.pipeline import policies
13+
14+
VERSION = "unknown"
15+
16+
class KeyVaultManagementClientConfiguration(Configuration):
17+
"""Configuration for KeyVaultManagementClient.
1518
16-
class KeyVaultManagementClientConfiguration(AzureConfiguration):
17-
"""Configuration for KeyVaultManagementClient
1819
Note that all parameters used to create this instance are saved as instance
1920
attributes.
2021
21-
:param credentials: Credentials needed for the client to connect to Azure.
22-
:type credentials: :mod:`A msrestazure Credentials
23-
object<msrestazure.azure_active_directory>`
24-
:param subscription_id: Subscription credentials which uniquely identify
25-
Microsoft Azure subscription. The subscription ID forms part of the URI
26-
for every service call.
22+
:param credential: Credential needed for the client to connect to Azure.
23+
:type credential: azure.core.credentials.TokenCredential
24+
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
2725
:type subscription_id: str
28-
:param str base_url: Service URL
2926
"""
3027

3128
def __init__(
32-
self, credentials, subscription_id, base_url=None):
33-
34-
if credentials is None:
35-
raise ValueError("Parameter 'credentials' must not be None.")
29+
self,
30+
credential, # type: "TokenCredential"
31+
subscription_id, # type: str
32+
**kwargs # type: Any
33+
):
34+
# type: (...) -> None
35+
if credential is None:
36+
raise ValueError("Parameter 'credential' must not be None.")
3637
if subscription_id is None:
3738
raise ValueError("Parameter 'subscription_id' must not be None.")
38-
if not base_url:
39-
base_url = 'https://management.azure.com'
40-
41-
super(KeyVaultManagementClientConfiguration, self).__init__(base_url)
42-
43-
# Starting Autorest.Python 4.0.64, make connection pool activated by default
44-
self.keep_alive = True
45-
46-
self.add_user_agent('azure-mgmt-keyvault/{}'.format(VERSION))
47-
self.add_user_agent('Azure-SDK-For-Python')
39+
super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs)
4840

49-
self.credentials = credentials
41+
self.credential = credential
5042
self.subscription_id = subscription_id
43+
self.api_version = "2016-10-01"
44+
self.credential_scopes = ['https://management.azure.com/.default']
45+
kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION))
46+
self._configure(**kwargs)
47+
48+
def _configure(
49+
self,
50+
**kwargs # type: Any
51+
):
52+
# type: (...) -> None
53+
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
54+
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
55+
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
56+
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
57+
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
58+
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
59+
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
60+
self.authentication_policy = kwargs.get('authentication_policy')
61+
if self.credential and not self.authentication_policy:
62+
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)

0 commit comments

Comments
 (0)