Skip to content

Commit

Permalink
KeyVault Mgmt multiapi (#2927)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
lmazuel authored Jul 26, 2018
1 parent eed1e22 commit 6867dbc
Show file tree
Hide file tree
Showing 110 changed files with 3,648 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from msrest.service_client import SDKClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration

from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from .version import VERSION
from .operations.vaults_operations import VaultsOperations
from .operations.operations import Operations
from . import models


class KeyVaultManagementClientConfiguration(AzureConfiguration):
Expand Down Expand Up @@ -52,39 +52,93 @@ def __init__(
self.subscription_id = subscription_id


class KeyVaultManagementClient(SDKClient):
class KeyVaultManagementClient(MultiApiClientMixin, SDKClient):
"""The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.
:ivar config: Configuration for client.
:vartype config: KeyVaultManagementClientConfiguration
:ivar vaults: Vaults operations
:vartype vaults: azure.mgmt.keyvault.operations.VaultsOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.keyvault.operations.Operations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Subscription credentials which uniquely identify
Microsoft Azure subscription. The subscription ID forms part of the URI
for every service call.
:type subscription_id: str
:param str api_version: API version to use if no profile is provided, or if
missing in profile.
:param str base_url: Service URL
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
"""

def __init__(
self, credentials, subscription_id, base_url=None):
DEFAULT_API_VERSION = '2018-02-14'
_PROFILE_TAG = "azure.mgmt.keyvault.KeyVaultManagementClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION
}},
_PROFILE_TAG + " latest"
)

def __init__(self, credentials, subscription_id, api_version=None, base_url=None, profile=KnownProfiles.default):
self.config = KeyVaultManagementClientConfiguration(credentials, subscription_id, base_url)
super(KeyVaultManagementClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2018-02-14'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.vaults = VaultsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
super(KeyVaultManagementClient, self).__init__(
credentials,
self.config,
api_version=api_version,
profile=profile
)

############ Generated from here ############

@classmethod
def _models_dict(cls, api_version):
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}

@classmethod
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2016-10-01: :mod:`v2016_10_01.models<azure.mgmt.keyvault.v2016_10_01.models>`
* 2018-02-14: :mod:`v2018_02_14.models<azure.mgmt.keyvault.v2018_02_14.models>`
"""
if api_version == '2016-10-01':
from .v2016_10_01 import models
return models
elif api_version == '2018-02-14':
from .v2018_02_14 import models
return models
raise NotImplementedError("APIVersion {} is not available".format(api_version))

@property
def operations(self):
"""Instance depends on the API version:
* 2016-10-01: :class:`Operations<azure.mgmt.keyvault.v2016_10_01.operations.Operations>`
* 2018-02-14: :class:`Operations<azure.mgmt.keyvault.v2018_02_14.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2016-10-01':
from .v2016_10_01.operations import Operations as OperationClass
elif api_version == '2018-02-14':
from .v2018_02_14.operations import Operations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def vaults(self):
"""Instance depends on the API version:
* 2016-10-01: :class:`VaultsOperations<azure.mgmt.keyvault.v2016_10_01.operations.VaultsOperations>`
* 2018-02-14: :class:`VaultsOperations<azure.mgmt.keyvault.v2018_02_14.operations.VaultsOperations>`
"""
api_version = self._get_api_version('vaults')
if api_version == '2016-10-01':
from .v2016_10_01.operations import VaultsOperations as OperationClass
elif api_version == '2018-02-14':
from .v2018_02_14.operations import VaultsOperations as OperationClass
else:
raise NotImplementedError("APIVersion {} is not available".format(api_version))
return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
9 changes: 9 additions & 0 deletions azure-mgmt-keyvault/azure/mgmt/keyvault/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import warnings

from .v2018_02_14.models import *
18 changes: 18 additions & 0 deletions azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .key_vault_management_client import KeyVaultManagementClient
from .version import VERSION

__all__ = ['KeyVaultManagementClient']

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import SDKClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from .operations.vaults_operations import VaultsOperations
from .operations.operations import Operations
from . import models


class KeyVaultManagementClientConfiguration(AzureConfiguration):
"""Configuration for KeyVaultManagementClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Subscription credentials which uniquely identify
Microsoft Azure subscription. The subscription ID forms part of the URI
for every service call.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

super(KeyVaultManagementClientConfiguration, self).__init__(base_url)

self.add_user_agent('azure-mgmt-keyvault/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id


class KeyVaultManagementClient(SDKClient):
"""The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.
:ivar config: Configuration for client.
:vartype config: KeyVaultManagementClientConfiguration
:ivar vaults: Vaults operations
:vartype vaults: azure.mgmt.keyvault.v2016_10_01.operations.VaultsOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.keyvault.v2016_10_01.operations.Operations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Subscription credentials which uniquely identify
Microsoft Azure subscription. The subscription ID forms part of the URI
for every service call.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):

self.config = KeyVaultManagementClientConfiguration(credentials, subscription_id, base_url)
super(KeyVaultManagementClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2016-10-01'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.vaults = VaultsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

try:
from .sku_py3 import Sku
from .permissions_py3 import Permissions
from .access_policy_entry_py3 import AccessPolicyEntry
from .vault_properties_py3 import VaultProperties
from .vault_patch_properties_py3 import VaultPatchProperties
from .vault_access_policy_properties_py3 import VaultAccessPolicyProperties
from .deleted_vault_properties_py3 import DeletedVaultProperties
from .vault_create_or_update_parameters_py3 import VaultCreateOrUpdateParameters
from .vault_patch_parameters_py3 import VaultPatchParameters
from .vault_access_policy_parameters_py3 import VaultAccessPolicyParameters
from .vault_py3 import Vault
from .deleted_vault_py3 import DeletedVault
from .resource_py3 import Resource
from .vault_check_name_availability_parameters_py3 import VaultCheckNameAvailabilityParameters
from .check_name_availability_result_py3 import CheckNameAvailabilityResult
from .operation_display_py3 import OperationDisplay
from .log_specification_py3 import LogSpecification
from .service_specification_py3 import ServiceSpecification
from .operation_py3 import Operation
except (SyntaxError, ImportError):
from .sku import Sku
from .permissions import Permissions
from .access_policy_entry import AccessPolicyEntry
from .vault_properties import VaultProperties
from .vault_patch_properties import VaultPatchProperties
from .vault_access_policy_properties import VaultAccessPolicyProperties
from .deleted_vault_properties import DeletedVaultProperties
from .vault_create_or_update_parameters import VaultCreateOrUpdateParameters
from .vault_patch_parameters import VaultPatchParameters
from .vault_access_policy_parameters import VaultAccessPolicyParameters
from .vault import Vault
from .deleted_vault import DeletedVault
from .resource import Resource
from .vault_check_name_availability_parameters import VaultCheckNameAvailabilityParameters
from .check_name_availability_result import CheckNameAvailabilityResult
from .operation_display import OperationDisplay
from .log_specification import LogSpecification
from .service_specification import ServiceSpecification
from .operation import Operation
from .vault_paged import VaultPaged
from .deleted_vault_paged import DeletedVaultPaged
from .resource_paged import ResourcePaged
from .operation_paged import OperationPaged
from .key_vault_management_client_enums import (
SkuName,
KeyPermissions,
SecretPermissions,
CertificatePermissions,
StoragePermissions,
CreateMode,
Reason,
AccessPolicyUpdateKind,
)

__all__ = [
'Sku',
'Permissions',
'AccessPolicyEntry',
'VaultProperties',
'VaultPatchProperties',
'VaultAccessPolicyProperties',
'DeletedVaultProperties',
'VaultCreateOrUpdateParameters',
'VaultPatchParameters',
'VaultAccessPolicyParameters',
'Vault',
'DeletedVault',
'Resource',
'VaultCheckNameAvailabilityParameters',
'CheckNameAvailabilityResult',
'OperationDisplay',
'LogSpecification',
'ServiceSpecification',
'Operation',
'VaultPaged',
'DeletedVaultPaged',
'ResourcePaged',
'OperationPaged',
'SkuName',
'KeyPermissions',
'SecretPermissions',
'CertificatePermissions',
'StoragePermissions',
'CreateMode',
'Reason',
'AccessPolicyUpdateKind',
]
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AccessPolicyEntry(Model):
:type application_id: str
:param permissions: Required. Permissions the identity has for keys,
secrets and certificates.
:type permissions: ~azure.mgmt.keyvault.models.Permissions
:type permissions: ~azure.mgmt.keyvault.v2016_10_01.models.Permissions
"""

_validation = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AccessPolicyEntry(Model):
:type application_id: str
:param permissions: Required. Permissions the identity has for keys,
secrets and certificates.
:type permissions: ~azure.mgmt.keyvault.models.Permissions
:type permissions: ~azure.mgmt.keyvault.v2016_10_01.models.Permissions
"""

_validation = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CheckNameAvailabilityResult(Model):
:ivar reason: The reason that a vault name could not be used. The Reason
element is only returned if NameAvailable is false. Possible values
include: 'AccountNameInvalid', 'AlreadyExists'
:vartype reason: str or ~azure.mgmt.keyvault.models.Reason
:vartype reason: str or ~azure.mgmt.keyvault.v2016_10_01.models.Reason
:ivar message: An error message explaining the Reason value in more
detail.
:vartype message: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CheckNameAvailabilityResult(Model):
:ivar reason: The reason that a vault name could not be used. The Reason
element is only returned if NameAvailable is false. Possible values
include: 'AccountNameInvalid', 'AlreadyExists'
:vartype reason: str or ~azure.mgmt.keyvault.models.Reason
:vartype reason: str or ~azure.mgmt.keyvault.v2016_10_01.models.Reason
:ivar message: An error message explaining the Reason value in more
detail.
:vartype message: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class DeletedVault(Model):
:ivar type: The resource type of the key vault.
:vartype type: str
:param properties: Properties of the vault
:type properties: ~azure.mgmt.keyvault.models.DeletedVaultProperties
:type properties:
~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultProperties
"""

_validation = {
Expand Down
Loading

0 comments on commit 6867dbc

Please sign in to comment.