Skip to content

Commit 9295f98

Browse files
author
Zim Kalinowski
committed
preview.7
1 parent 71c9a31 commit 9295f98

File tree

53 files changed

+1811
-1229
lines changed

Some content is hidden

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

53 files changed

+1811
-1229
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@
88

99
from ._key_vault_management_client import KeyVaultManagementClient
1010
__all__ = ['KeyVaultManagementClient']
11+
12+
try:
13+
from ._patch import patch_sdk
14+
patch_sdk()
15+
except ImportError:
16+
pass

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class KeyVaultManagementClientConfiguration(Configuration):
2323
attributes.
2424
2525
:param credential: Credential needed for the client to connect to Azure.
26-
:type credential: azure.core.credentials.TokenCredential
26+
:type credential: ~azure.core.credentials.TokenCredential
2727
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
2828
:type subscription_id: str
2929
"""
@@ -44,6 +44,7 @@ def __init__(
4444
self.credential = credential
4545
self.subscription_id = subscription_id
4646
self.credential_scopes = ['https://management.azure.com/.default']
47+
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
4748
kwargs.setdefault('sdk_moniker', 'azure-mgmt-keyvault/{}'.format(VERSION))
4849
self._configure(**kwargs)
4950

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@ class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient):
3535
group is not described in the profile.
3636
3737
: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
40-
Microsoft Azure subscription. The subscription ID forms part of the URI
41-
for every service call.
38+
:type credential: ~azure.core.credentials.TokenCredential
39+
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
4240
:type subscription_id: str
4341
:param str api_version: API version to use if no profile is provided, or if
4442
missing in profile.
4543
:param str base_url: Service URL
4644
:param profile: A profile definition, from KnownProfiles to dict.
4745
:type profile: azure.profiles.KnownProfiles
46+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
4847
"""
4948

5049
DEFAULT_API_VERSION = '2019-09-01'
@@ -56,7 +55,15 @@ class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient):
5655
_PROFILE_TAG + " latest"
5756
)
5857

59-
def __init__(self, credential, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default, **kwargs):
58+
def __init__(
59+
self,
60+
credential, # type: "TokenCredential"
61+
subscription_id, # type: str
62+
api_version=None,
63+
base_url=None,
64+
profile=KnownProfiles.default,
65+
**kwargs # type: Any
66+
):
6067
if not base_url:
6168
base_url = 'https://management.azure.com'
6269
self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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 license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from ._key_vault_management_client_async import KeyVaultManagementClient
10+
__all__ = ['KeyVaultManagementClient']
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
from typing import Any
12+
13+
from azure.core.configuration import Configuration
14+
from azure.core.pipeline import policies
15+
16+
from .._version import VERSION
17+
18+
19+
class KeyVaultManagementClientConfiguration(Configuration):
20+
"""Configuration for KeyVaultManagementClient.
21+
22+
Note that all parameters used to create this instance are saved as instance
23+
attributes.
24+
25+
:param credential: Credential needed for the client to connect to Azure.
26+
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
27+
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
28+
:type subscription_id: str
29+
"""
30+
31+
def __init__(
32+
self,
33+
credential, # type: "AsyncTokenCredential"
34+
subscription_id, # type: str
35+
**kwargs # type: Any
36+
) -> None:
37+
# type: (...) -> None
38+
if credential is None:
39+
raise ValueError("Parameter 'credential' must not be None.")
40+
if subscription_id is None:
41+
raise ValueError("Parameter 'subscription_id' must not be None.")
42+
super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs)
43+
44+
self.credential = credential
45+
self.subscription_id = subscription_id
46+
self.credential_scopes = ['https://management.azure.com/.default']
47+
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
48+
kwargs.setdefault('sdk_moniker', 'azure-mgmt-keyvault/{}'.format(VERSION))
49+
self._configure(**kwargs)
50+
51+
def _configure(
52+
self,
53+
**kwargs: Any
54+
) -> 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.AsyncRetryPolicy(**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.AsyncRedirectPolicy(**kwargs)
62+
self.authentication_policy = kwargs.get('authentication_policy')
63+
if self.credential and not self.authentication_policy:
64+
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
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+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from azure.mgmt.core import AsyncARMPipelineClient
13+
from msrest import Serializer, Deserializer
14+
15+
from azure.profiles import KnownProfiles, ProfileDefinition
16+
from azure.profiles.multiapiclient import MultiApiClientMixin
17+
from ._configuration_async import KeyVaultManagementClientConfiguration
18+
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
25+
26+
class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient):
27+
"""The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.
28+
29+
This ready contains multiple API versions, to help you deal with all of the Azure clouds
30+
(Azure Stack, Azure Government, Azure China, etc.).
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.
34+
The api-version parameter sets the default API version if the operation
35+
group is not described in the profile.
36+
37+
:param credential: Credential needed for the client to connect to Azure.
38+
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
39+
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
40+
:type subscription_id: str
41+
:param str api_version: API version to use if no profile is provided, or if
42+
missing in profile.
43+
:param str base_url: Service URL
44+
:param profile: A profile definition, from KnownProfiles to dict.
45+
:type profile: azure.profiles.KnownProfiles
46+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
47+
"""
48+
49+
DEFAULT_API_VERSION = '2019-09-01'
50+
_PROFILE_TAG = "azure.mgmt.keyvault.KeyVaultManagementClient"
51+
LATEST_PROFILE = ProfileDefinition({
52+
_PROFILE_TAG: {
53+
None: DEFAULT_API_VERSION,
54+
}},
55+
_PROFILE_TAG + " latest"
56+
)
57+
58+
def __init__(
59+
self,
60+
credential, # type: "AsyncTokenCredential"
61+
subscription_id, # type: str
62+
api_version=None,
63+
base_url=None,
64+
profile=KnownProfiles.default,
65+
**kwargs # type: Any
66+
) -> None:
67+
if not base_url:
68+
base_url = 'https://management.azure.com'
69+
self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs)
70+
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
71+
super(KeyVaultManagementClient, self).__init__(
72+
credential,
73+
self._config,
74+
api_version=api_version,
75+
profile=profile
76+
)
77+
78+
@classmethod
79+
def _models_dict(cls, api_version):
80+
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
81+
82+
@classmethod
83+
def models(cls, api_version=DEFAULT_API_VERSION):
84+
"""Module depends on the API version:
85+
86+
* 2016-10-01: :mod:`v2016_10_01.models<azure.mgmt.keyvault.v2016_10_01.models>`
87+
* 2018-02-14: :mod:`v2018_02_14.models<azure.mgmt.keyvault.v2018_02_14.models>`
88+
* 2019-09-01: :mod:`v2019_09_01.models<azure.mgmt.keyvault.v2019_09_01.models>`
89+
"""
90+
if api_version == '2016-10-01':
91+
from ..v2016_10_01 import models
92+
return models
93+
elif api_version == '2018-02-14':
94+
from ..v2018_02_14 import models
95+
return models
96+
elif api_version == '2019-09-01':
97+
from ..v2019_09_01 import models
98+
return models
99+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
100+
101+
@property
102+
def operations(self):
103+
"""Instance depends on the API version:
104+
105+
* 2016-10-01: :class:`Operations<azure.mgmt.keyvault.v2016_10_01.aio.operations_async.Operations>`
106+
* 2018-02-14: :class:`Operations<azure.mgmt.keyvault.v2018_02_14.aio.operations_async.Operations>`
107+
* 2019-09-01: :class:`Operations<azure.mgmt.keyvault.v2019_09_01.aio.operations_async.Operations>`
108+
"""
109+
api_version = self._get_api_version('operations')
110+
if api_version == '2016-10-01':
111+
from ..v2016_10_01.aio.operations_async import Operations as OperationClass
112+
elif api_version == '2018-02-14':
113+
from ..v2018_02_14.aio.operations_async import Operations as OperationClass
114+
elif api_version == '2019-09-01':
115+
from ..v2019_09_01.aio.operations_async import Operations as OperationClass
116+
else:
117+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
118+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
119+
120+
@property
121+
def private_endpoint_connections(self):
122+
"""Instance depends on the API version:
123+
124+
* 2018-02-14: :class:`PrivateEndpointConnectionsOperations<azure.mgmt.keyvault.v2018_02_14.aio.operations_async.PrivateEndpointConnectionsOperations>`
125+
* 2019-09-01: :class:`PrivateEndpointConnectionsOperations<azure.mgmt.keyvault.v2019_09_01.aio.operations_async.PrivateEndpointConnectionsOperations>`
126+
"""
127+
api_version = self._get_api_version('private_endpoint_connections')
128+
if api_version == '2018-02-14':
129+
from ..v2018_02_14.aio.operations_async import PrivateEndpointConnectionsOperations as OperationClass
130+
elif api_version == '2019-09-01':
131+
from ..v2019_09_01.aio.operations_async import PrivateEndpointConnectionsOperations as OperationClass
132+
else:
133+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
134+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
135+
136+
@property
137+
def private_link_resources(self):
138+
"""Instance depends on the API version:
139+
140+
* 2018-02-14: :class:`PrivateLinkResourcesOperations<azure.mgmt.keyvault.v2018_02_14.aio.operations_async.PrivateLinkResourcesOperations>`
141+
* 2019-09-01: :class:`PrivateLinkResourcesOperations<azure.mgmt.keyvault.v2019_09_01.aio.operations_async.PrivateLinkResourcesOperations>`
142+
"""
143+
api_version = self._get_api_version('private_link_resources')
144+
if api_version == '2018-02-14':
145+
from ..v2018_02_14.aio.operations_async import PrivateLinkResourcesOperations as OperationClass
146+
elif api_version == '2019-09-01':
147+
from ..v2019_09_01.aio.operations_async import PrivateLinkResourcesOperations as OperationClass
148+
else:
149+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
150+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
151+
152+
@property
153+
def vaults(self):
154+
"""Instance depends on the API version:
155+
156+
* 2016-10-01: :class:`VaultsOperations<azure.mgmt.keyvault.v2016_10_01.aio.operations_async.VaultsOperations>`
157+
* 2018-02-14: :class:`VaultsOperations<azure.mgmt.keyvault.v2018_02_14.aio.operations_async.VaultsOperations>`
158+
* 2019-09-01: :class:`VaultsOperations<azure.mgmt.keyvault.v2019_09_01.aio.operations_async.VaultsOperations>`
159+
"""
160+
api_version = self._get_api_version('vaults')
161+
if api_version == '2016-10-01':
162+
from ..v2016_10_01.aio.operations_async import VaultsOperations as OperationClass
163+
elif api_version == '2018-02-14':
164+
from ..v2018_02_14.aio.operations_async import VaultsOperations as OperationClass
165+
elif api_version == '2019-09-01':
166+
from ..v2019_09_01.aio.operations_async import VaultsOperations as OperationClass
167+
else:
168+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
169+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
170+
171+
async def close(self):
172+
await self._client.close()
173+
async def __aenter__(self):
174+
await self._client.__aenter__()
175+
return self
176+
async def __aexit__(self, *exc_details):
177+
await self._client.__aexit__(*exc_details)

sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,9 @@
88

99
from ._key_vault_management_client import KeyVaultManagementClient
1010
__all__ = ['KeyVaultManagementClient']
11+
12+
try:
13+
from ._patch import patch_sdk
14+
patch_sdk()
15+
except ImportError:
16+
pass

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import Any
9+
from typing import TYPE_CHECKING
1010

1111
from azure.core.configuration import Configuration
1212
from azure.core.pipeline import policies
1313

14+
if TYPE_CHECKING:
15+
# pylint: disable=unused-import,ungrouped-imports
16+
from typing import Any
17+
18+
from azure.core.credentials import TokenCredential
19+
1420
VERSION = "unknown"
1521

1622
class KeyVaultManagementClientConfiguration(Configuration):
@@ -20,7 +26,7 @@ class KeyVaultManagementClientConfiguration(Configuration):
2026
attributes.
2127
2228
:param credential: Credential needed for the client to connect to Azure.
23-
:type credential: azure.core.credentials.TokenCredential
29+
:type credential: ~azure.core.credentials.TokenCredential
2430
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
2531
:type subscription_id: str
2632
"""
@@ -42,6 +48,7 @@ def __init__(
4248
self.subscription_id = subscription_id
4349
self.api_version = "2016-10-01"
4450
self.credential_scopes = ['https://management.azure.com/.default']
51+
self.credential_scopes.extend(kwargs.pop('credential_scopes', []))
4552
kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION))
4653
self._configure(**kwargs)
4754

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import Any, Optional
9+
from typing import TYPE_CHECKING
1010

1111
from azure.mgmt.core import ARMPipelineClient
1212
from msrest import Deserializer, Serializer
1313

14+
if TYPE_CHECKING:
15+
# pylint: disable=unused-import,ungrouped-imports
16+
from typing import Any, Optional
17+
18+
from azure.core.credentials import TokenCredential
19+
1420
from ._configuration import KeyVaultManagementClientConfiguration
1521
from .operations import VaultsOperations
1622
from .operations import Operations
@@ -25,10 +31,11 @@ class KeyVaultManagementClient(object):
2531
:ivar operations: Operations operations
2632
:vartype operations: azure.mgmt.keyvault.v2016_10_01.operations.Operations
2733
:param credential: Credential needed for the client to connect to Azure.
28-
:type credential: azure.core.credentials.TokenCredential
34+
:type credential: ~azure.core.credentials.TokenCredential
2935
:param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
3036
:type subscription_id: str
3137
:param str base_url: Service URL
38+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
3239
"""
3340

3441
def __init__(

0 commit comments

Comments
 (0)