Skip to content

Commit 6867dbc

Browse files
authored
KeyVault Mgmt multiapi (#2927)
* KeyVault multiapi template * [AutoPR keyvault/resource-manager] KV multiapi Readme (#2928) * Generated from dc6eeefac40f35620e785bd22e81c8dc97984c79 KV multiapi Readme * Fix multiapi client * Generated from dc6eeefac40f35620e785bd22e81c8dc97984c79 (#3014) KV multiapi Readme
1 parent eed1e22 commit 6867dbc

File tree

110 files changed

+3648
-100
lines changed

Some content is hidden

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

110 files changed

+3648
-100
lines changed

azure-mgmt-keyvault/azure/mgmt/keyvault/key_vault_management_client.py

+76-22
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
from msrest.service_client import SDKClient
1313
from msrest import Serializer, Deserializer
1414
from msrestazure import AzureConfiguration
15+
16+
from azure.profiles import KnownProfiles, ProfileDefinition
17+
from azure.profiles.multiapiclient import MultiApiClientMixin
1518
from .version import VERSION
16-
from .operations.vaults_operations import VaultsOperations
17-
from .operations.operations import Operations
18-
from . import models
1919

2020

2121
class KeyVaultManagementClientConfiguration(AzureConfiguration):
@@ -52,39 +52,93 @@ def __init__(
5252
self.subscription_id = subscription_id
5353

5454

55-
class KeyVaultManagementClient(SDKClient):
55+
class KeyVaultManagementClient(MultiApiClientMixin, SDKClient):
5656
"""The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.
5757
5858
:ivar config: Configuration for client.
5959
:vartype config: KeyVaultManagementClientConfiguration
6060
61-
:ivar vaults: Vaults operations
62-
:vartype vaults: azure.mgmt.keyvault.operations.VaultsOperations
63-
:ivar operations: Operations operations
64-
:vartype operations: azure.mgmt.keyvault.operations.Operations
65-
6661
:param credentials: Credentials needed for the client to connect to Azure.
6762
:type credentials: :mod:`A msrestazure Credentials
6863
object<msrestazure.azure_active_directory>`
6964
:param subscription_id: Subscription credentials which uniquely identify
7065
Microsoft Azure subscription. The subscription ID forms part of the URI
7166
for every service call.
7267
:type subscription_id: str
68+
:param str api_version: API version to use if no profile is provided, or if
69+
missing in profile.
7370
:param str base_url: Service URL
71+
:param profile: A profile definition, from KnownProfiles to dict.
72+
:type profile: azure.profiles.KnownProfiles
7473
"""
7574

76-
def __init__(
77-
self, credentials, subscription_id, base_url=None):
75+
DEFAULT_API_VERSION = '2018-02-14'
76+
_PROFILE_TAG = "azure.mgmt.keyvault.KeyVaultManagementClient"
77+
LATEST_PROFILE = ProfileDefinition({
78+
_PROFILE_TAG: {
79+
None: DEFAULT_API_VERSION
80+
}},
81+
_PROFILE_TAG + " latest"
82+
)
7883

84+
def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default):
7985
self.config = KeyVaultManagementClientConfiguration(credentials, subscription_id, base_url)
80-
super(KeyVaultManagementClient, self).__init__(self.config.credentials, self.config)
81-
82-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
83-
self.api_version = '2018-02-14'
84-
self._serialize = Serializer(client_models)
85-
self._deserialize = Deserializer(client_models)
86-
87-
self.vaults = VaultsOperations(
88-
self._client, self.config, self._serialize, self._deserialize)
89-
self.operations = Operations(
90-
self._client, self.config, self._serialize, self._deserialize)
86+
super(KeyVaultManagementClient, self).__init__(
87+
credentials,
88+
self.config,
89+
api_version=api_version,
90+
profile=profile
91+
)
92+
93+
############ Generated from here ############
94+
95+
@classmethod
96+
def _models_dict(cls, api_version):
97+
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
98+
99+
@classmethod
100+
def models(cls, api_version=DEFAULT_API_VERSION):
101+
"""Module depends on the API version:
102+
103+
* 2016-10-01: :mod:`v2016_10_01.models<azure.mgmt.keyvault.v2016_10_01.models>`
104+
* 2018-02-14: :mod:`v2018_02_14.models<azure.mgmt.keyvault.v2018_02_14.models>`
105+
"""
106+
if api_version == '2016-10-01':
107+
from .v2016_10_01 import models
108+
return models
109+
elif api_version == '2018-02-14':
110+
from .v2018_02_14 import models
111+
return models
112+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
113+
114+
@property
115+
def operations(self):
116+
"""Instance depends on the API version:
117+
118+
* 2016-10-01: :class:`Operations<azure.mgmt.keyvault.v2016_10_01.operations.Operations>`
119+
* 2018-02-14: :class:`Operations<azure.mgmt.keyvault.v2018_02_14.operations.Operations>`
120+
"""
121+
api_version = self._get_api_version('operations')
122+
if api_version == '2016-10-01':
123+
from .v2016_10_01.operations import Operations as OperationClass
124+
elif api_version == '2018-02-14':
125+
from .v2018_02_14.operations import Operations as OperationClass
126+
else:
127+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
128+
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
129+
130+
@property
131+
def vaults(self):
132+
"""Instance depends on the API version:
133+
134+
* 2016-10-01: :class:`VaultsOperations<azure.mgmt.keyvault.v2016_10_01.operations.VaultsOperations>`
135+
* 2018-02-14: :class:`VaultsOperations<azure.mgmt.keyvault.v2018_02_14.operations.VaultsOperations>`
136+
"""
137+
api_version = self._get_api_version('vaults')
138+
if api_version == '2016-10-01':
139+
from .v2016_10_01.operations import VaultsOperations as OperationClass
140+
elif api_version == '2018-02-14':
141+
from .v2018_02_14.operations import VaultsOperations as OperationClass
142+
else:
143+
raise NotImplementedError("APIVersion {} is not available".format(api_version))
144+
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
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+
import warnings
8+
9+
from .v2018_02_14.models import *
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 .key_vault_management_client import KeyVaultManagementClient
13+
from .version import VERSION
14+
15+
__all__ = ['KeyVaultManagementClient']
16+
17+
__version__ = VERSION
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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 msrest.service_client import SDKClient
13+
from msrest import Serializer, Deserializer
14+
from msrestazure import AzureConfiguration
15+
from .version import VERSION
16+
from .operations.vaults_operations import VaultsOperations
17+
from .operations.operations import Operations
18+
from . import models
19+
20+
21+
class KeyVaultManagementClientConfiguration(AzureConfiguration):
22+
"""Configuration for KeyVaultManagementClient
23+
Note that all parameters used to create this instance are saved as instance
24+
attributes.
25+
26+
:param credentials: Credentials needed for the client to connect to Azure.
27+
:type credentials: :mod:`A msrestazure Credentials
28+
object<msrestazure.azure_active_directory>`
29+
:param subscription_id: Subscription credentials which uniquely identify
30+
Microsoft Azure subscription. The subscription ID forms part of the URI
31+
for every service call.
32+
:type subscription_id: str
33+
:param str base_url: Service URL
34+
"""
35+
36+
def __init__(
37+
self, credentials, subscription_id, base_url=None):
38+
39+
if credentials is None:
40+
raise ValueError("Parameter 'credentials' must not be None.")
41+
if subscription_id is None:
42+
raise ValueError("Parameter 'subscription_id' must not be None.")
43+
if not base_url:
44+
base_url = 'https://management.azure.com'
45+
46+
super(KeyVaultManagementClientConfiguration, self).__init__(base_url)
47+
48+
self.add_user_agent('azure-mgmt-keyvault/{}'.format(VERSION))
49+
self.add_user_agent('Azure-SDK-For-Python')
50+
51+
self.credentials = credentials
52+
self.subscription_id = subscription_id
53+
54+
55+
class KeyVaultManagementClient(SDKClient):
56+
"""The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.
57+
58+
:ivar config: Configuration for client.
59+
:vartype config: KeyVaultManagementClientConfiguration
60+
61+
:ivar vaults: Vaults operations
62+
:vartype vaults: azure.mgmt.keyvault.v2016_10_01.operations.VaultsOperations
63+
:ivar operations: Operations operations
64+
:vartype operations: azure.mgmt.keyvault.v2016_10_01.operations.Operations
65+
66+
:param credentials: Credentials needed for the client to connect to Azure.
67+
:type credentials: :mod:`A msrestazure Credentials
68+
object<msrestazure.azure_active_directory>`
69+
:param subscription_id: Subscription credentials which uniquely identify
70+
Microsoft Azure subscription. The subscription ID forms part of the URI
71+
for every service call.
72+
:type subscription_id: str
73+
:param str base_url: Service URL
74+
"""
75+
76+
def __init__(
77+
self, credentials, subscription_id, base_url=None):
78+
79+
self.config = KeyVaultManagementClientConfiguration(credentials, subscription_id, base_url)
80+
super(KeyVaultManagementClient, self).__init__(self.config.credentials, self.config)
81+
82+
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
83+
self.api_version = '2016-10-01'
84+
self._serialize = Serializer(client_models)
85+
self._deserialize = Deserializer(client_models)
86+
87+
self.vaults = VaultsOperations(
88+
self._client, self.config, self._serialize, self._deserialize)
89+
self.operations = Operations(
90+
self._client, self.config, self._serialize, self._deserialize)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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+
try:
13+
from .sku_py3 import Sku
14+
from .permissions_py3 import Permissions
15+
from .access_policy_entry_py3 import AccessPolicyEntry
16+
from .vault_properties_py3 import VaultProperties
17+
from .vault_patch_properties_py3 import VaultPatchProperties
18+
from .vault_access_policy_properties_py3 import VaultAccessPolicyProperties
19+
from .deleted_vault_properties_py3 import DeletedVaultProperties
20+
from .vault_create_or_update_parameters_py3 import VaultCreateOrUpdateParameters
21+
from .vault_patch_parameters_py3 import VaultPatchParameters
22+
from .vault_access_policy_parameters_py3 import VaultAccessPolicyParameters
23+
from .vault_py3 import Vault
24+
from .deleted_vault_py3 import DeletedVault
25+
from .resource_py3 import Resource
26+
from .vault_check_name_availability_parameters_py3 import VaultCheckNameAvailabilityParameters
27+
from .check_name_availability_result_py3 import CheckNameAvailabilityResult
28+
from .operation_display_py3 import OperationDisplay
29+
from .log_specification_py3 import LogSpecification
30+
from .service_specification_py3 import ServiceSpecification
31+
from .operation_py3 import Operation
32+
except (SyntaxError, ImportError):
33+
from .sku import Sku
34+
from .permissions import Permissions
35+
from .access_policy_entry import AccessPolicyEntry
36+
from .vault_properties import VaultProperties
37+
from .vault_patch_properties import VaultPatchProperties
38+
from .vault_access_policy_properties import VaultAccessPolicyProperties
39+
from .deleted_vault_properties import DeletedVaultProperties
40+
from .vault_create_or_update_parameters import VaultCreateOrUpdateParameters
41+
from .vault_patch_parameters import VaultPatchParameters
42+
from .vault_access_policy_parameters import VaultAccessPolicyParameters
43+
from .vault import Vault
44+
from .deleted_vault import DeletedVault
45+
from .resource import Resource
46+
from .vault_check_name_availability_parameters import VaultCheckNameAvailabilityParameters
47+
from .check_name_availability_result import CheckNameAvailabilityResult
48+
from .operation_display import OperationDisplay
49+
from .log_specification import LogSpecification
50+
from .service_specification import ServiceSpecification
51+
from .operation import Operation
52+
from .vault_paged import VaultPaged
53+
from .deleted_vault_paged import DeletedVaultPaged
54+
from .resource_paged import ResourcePaged
55+
from .operation_paged import OperationPaged
56+
from .key_vault_management_client_enums import (
57+
SkuName,
58+
KeyPermissions,
59+
SecretPermissions,
60+
CertificatePermissions,
61+
StoragePermissions,
62+
CreateMode,
63+
Reason,
64+
AccessPolicyUpdateKind,
65+
)
66+
67+
__all__ = [
68+
'Sku',
69+
'Permissions',
70+
'AccessPolicyEntry',
71+
'VaultProperties',
72+
'VaultPatchProperties',
73+
'VaultAccessPolicyProperties',
74+
'DeletedVaultProperties',
75+
'VaultCreateOrUpdateParameters',
76+
'VaultPatchParameters',
77+
'VaultAccessPolicyParameters',
78+
'Vault',
79+
'DeletedVault',
80+
'Resource',
81+
'VaultCheckNameAvailabilityParameters',
82+
'CheckNameAvailabilityResult',
83+
'OperationDisplay',
84+
'LogSpecification',
85+
'ServiceSpecification',
86+
'Operation',
87+
'VaultPaged',
88+
'DeletedVaultPaged',
89+
'ResourcePaged',
90+
'OperationPaged',
91+
'SkuName',
92+
'KeyPermissions',
93+
'SecretPermissions',
94+
'CertificatePermissions',
95+
'StoragePermissions',
96+
'CreateMode',
97+
'Reason',
98+
'AccessPolicyUpdateKind',
99+
]

azure-mgmt-keyvault/azure/mgmt/keyvault/models/access_policy_entry.py renamed to azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/access_policy_entry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AccessPolicyEntry(Model):
3030
:type application_id: str
3131
:param permissions: Required. Permissions the identity has for keys,
3232
secrets and certificates.
33-
:type permissions: ~azure.mgmt.keyvault.models.Permissions
33+
:type permissions: ~azure.mgmt.keyvault.v2016_10_01.models.Permissions
3434
"""
3535

3636
_validation = {

azure-mgmt-keyvault/azure/mgmt/keyvault/models/access_policy_entry_py3.py renamed to azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/access_policy_entry_py3.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class AccessPolicyEntry(Model):
3030
:type application_id: str
3131
:param permissions: Required. Permissions the identity has for keys,
3232
secrets and certificates.
33-
:type permissions: ~azure.mgmt.keyvault.models.Permissions
33+
:type permissions: ~azure.mgmt.keyvault.v2016_10_01.models.Permissions
3434
"""
3535

3636
_validation = {

azure-mgmt-keyvault/azure/mgmt/keyvault/models/check_name_availability_result.py renamed to azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/check_name_availability_result.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CheckNameAvailabilityResult(Model):
2525
:ivar reason: The reason that a vault name could not be used. The Reason
2626
element is only returned if NameAvailable is false. Possible values
2727
include: 'AccountNameInvalid', 'AlreadyExists'
28-
:vartype reason: str or ~azure.mgmt.keyvault.models.Reason
28+
:vartype reason: str or ~azure.mgmt.keyvault.v2016_10_01.models.Reason
2929
:ivar message: An error message explaining the Reason value in more
3030
detail.
3131
:vartype message: str

azure-mgmt-keyvault/azure/mgmt/keyvault/models/check_name_availability_result_py3.py renamed to azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/check_name_availability_result_py3.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CheckNameAvailabilityResult(Model):
2525
:ivar reason: The reason that a vault name could not be used. The Reason
2626
element is only returned if NameAvailable is false. Possible values
2727
include: 'AccountNameInvalid', 'AlreadyExists'
28-
:vartype reason: str or ~azure.mgmt.keyvault.models.Reason
28+
:vartype reason: str or ~azure.mgmt.keyvault.v2016_10_01.models.Reason
2929
:ivar message: An error message explaining the Reason value in more
3030
detail.
3131
:vartype message: str

azure-mgmt-keyvault/azure/mgmt/keyvault/models/deleted_vault.py renamed to azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/deleted_vault.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ class DeletedVault(Model):
2525
:ivar type: The resource type of the key vault.
2626
:vartype type: str
2727
:param properties: Properties of the vault
28-
:type properties: ~azure.mgmt.keyvault.models.DeletedVaultProperties
28+
:type properties:
29+
~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultProperties
2930
"""
3031

3132
_validation = {

0 commit comments

Comments
 (0)