Skip to content

Commit 912fd07

Browse files
AutorestCIlmazuel
authored andcommitted
[AutoPR keyvault/resource-manager] KV multiapi Readme (#2928)
* Generated from dc6eeefac40f35620e785bd22e81c8dc97984c79 KV multiapi Readme * Fix multiapi client
1 parent 3e7a525 commit 912fd07

File tree

107 files changed

+7047
-6
lines changed

Some content is hidden

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

107 files changed

+7047
-6
lines changed

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

+54-6
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,63 @@ class KeyVaultManagementClient(MultiApiClientMixin, SDKClient):
8282
)
8383

8484
def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default):
85+
self.config = KeyVaultManagementClientConfiguration(credentials, subscription_id, base_url)
8586
super(KeyVaultManagementClient, self).__init__(
86-
credentials=credentials,
87-
subscription_id=subscription_id,
87+
credentials,
88+
self.config,
8889
api_version=api_version,
89-
base_url=base_url,
9090
profile=profile
9191
)
9292

93-
self.config = KeyVaultManagementClient(credentials, subscription_id, base_url)
94-
self._client = ServiceClient(self.config.credentials, self.config)
95-
9693
############ 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,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+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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.serialization import Model
13+
14+
15+
class AccessPolicyEntry(Model):
16+
"""An identity that have access to the key vault. All identities in the array
17+
must use the same tenant ID as the key vault's tenant ID.
18+
19+
All required parameters must be populated in order to send to Azure.
20+
21+
:param tenant_id: Required. The Azure Active Directory tenant ID that
22+
should be used for authenticating requests to the key vault.
23+
:type tenant_id: str
24+
:param object_id: Required. The object ID of a user, service principal or
25+
security group in the Azure Active Directory tenant for the vault. The
26+
object ID must be unique for the list of access policies.
27+
:type object_id: str
28+
:param application_id: Application ID of the client making request on
29+
behalf of a principal
30+
:type application_id: str
31+
:param permissions: Required. Permissions the identity has for keys,
32+
secrets and certificates.
33+
:type permissions: ~azure.mgmt.keyvault.v2016_10_01.models.Permissions
34+
"""
35+
36+
_validation = {
37+
'tenant_id': {'required': True},
38+
'object_id': {'required': True},
39+
'permissions': {'required': True},
40+
}
41+
42+
_attribute_map = {
43+
'tenant_id': {'key': 'tenantId', 'type': 'str'},
44+
'object_id': {'key': 'objectId', 'type': 'str'},
45+
'application_id': {'key': 'applicationId', 'type': 'str'},
46+
'permissions': {'key': 'permissions', 'type': 'Permissions'},
47+
}
48+
49+
def __init__(self, **kwargs):
50+
super(AccessPolicyEntry, self).__init__(**kwargs)
51+
self.tenant_id = kwargs.get('tenant_id', None)
52+
self.object_id = kwargs.get('object_id', None)
53+
self.application_id = kwargs.get('application_id', None)
54+
self.permissions = kwargs.get('permissions', None)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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.serialization import Model
13+
14+
15+
class AccessPolicyEntry(Model):
16+
"""An identity that have access to the key vault. All identities in the array
17+
must use the same tenant ID as the key vault's tenant ID.
18+
19+
All required parameters must be populated in order to send to Azure.
20+
21+
:param tenant_id: Required. The Azure Active Directory tenant ID that
22+
should be used for authenticating requests to the key vault.
23+
:type tenant_id: str
24+
:param object_id: Required. The object ID of a user, service principal or
25+
security group in the Azure Active Directory tenant for the vault. The
26+
object ID must be unique for the list of access policies.
27+
:type object_id: str
28+
:param application_id: Application ID of the client making request on
29+
behalf of a principal
30+
:type application_id: str
31+
:param permissions: Required. Permissions the identity has for keys,
32+
secrets and certificates.
33+
:type permissions: ~azure.mgmt.keyvault.v2016_10_01.models.Permissions
34+
"""
35+
36+
_validation = {
37+
'tenant_id': {'required': True},
38+
'object_id': {'required': True},
39+
'permissions': {'required': True},
40+
}
41+
42+
_attribute_map = {
43+
'tenant_id': {'key': 'tenantId', 'type': 'str'},
44+
'object_id': {'key': 'objectId', 'type': 'str'},
45+
'application_id': {'key': 'applicationId', 'type': 'str'},
46+
'permissions': {'key': 'permissions', 'type': 'Permissions'},
47+
}
48+
49+
def __init__(self, *, tenant_id: str, object_id: str, permissions, application_id: str=None, **kwargs) -> None:
50+
super(AccessPolicyEntry, self).__init__(**kwargs)
51+
self.tenant_id = tenant_id
52+
self.object_id = object_id
53+
self.application_id = application_id
54+
self.permissions = permissions

0 commit comments

Comments
 (0)