Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR keyvault/resource-manager] KV multiapi Readme #2928

Merged
merged 2 commits into from
Jul 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,63 @@ class KeyVaultManagementClient(MultiApiClientMixin, SDKClient):
)

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__(
credentials=credentials,
subscription_id=subscription_id,
credentials,
self.config,
api_version=api_version,
base_url=base_url,
profile=profile
)

self.config = KeyVaultManagementClient(credentials, subscription_id, base_url)
self._client = ServiceClient(self.config.credentials, self.config)

############ 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)))
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
@@ -0,0 +1,54 @@
# 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.serialization import Model


class AccessPolicyEntry(Model):
"""An identity that have access to the key vault. All identities in the array
must use the same tenant ID as the key vault's tenant ID.

All required parameters must be populated in order to send to Azure.

:param tenant_id: Required. The Azure Active Directory tenant ID that
should be used for authenticating requests to the key vault.
:type tenant_id: str
:param object_id: Required. The object ID of a user, service principal or
security group in the Azure Active Directory tenant for the vault. The
object ID must be unique for the list of access policies.
:type object_id: str
:param application_id: Application ID of the client making request on
behalf of a principal
:type application_id: str
:param permissions: Required. Permissions the identity has for keys,
secrets and certificates.
:type permissions: ~azure.mgmt.keyvault.v2016_10_01.models.Permissions
"""

_validation = {
'tenant_id': {'required': True},
'object_id': {'required': True},
'permissions': {'required': True},
}

_attribute_map = {
'tenant_id': {'key': 'tenantId', 'type': 'str'},
'object_id': {'key': 'objectId', 'type': 'str'},
'application_id': {'key': 'applicationId', 'type': 'str'},
'permissions': {'key': 'permissions', 'type': 'Permissions'},
}

def __init__(self, **kwargs):
super(AccessPolicyEntry, self).__init__(**kwargs)
self.tenant_id = kwargs.get('tenant_id', None)
self.object_id = kwargs.get('object_id', None)
self.application_id = kwargs.get('application_id', None)
self.permissions = kwargs.get('permissions', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# 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.serialization import Model


class AccessPolicyEntry(Model):
"""An identity that have access to the key vault. All identities in the array
must use the same tenant ID as the key vault's tenant ID.

All required parameters must be populated in order to send to Azure.

:param tenant_id: Required. The Azure Active Directory tenant ID that
should be used for authenticating requests to the key vault.
:type tenant_id: str
:param object_id: Required. The object ID of a user, service principal or
security group in the Azure Active Directory tenant for the vault. The
object ID must be unique for the list of access policies.
:type object_id: str
:param application_id: Application ID of the client making request on
behalf of a principal
:type application_id: str
:param permissions: Required. Permissions the identity has for keys,
secrets and certificates.
:type permissions: ~azure.mgmt.keyvault.v2016_10_01.models.Permissions
"""

_validation = {
'tenant_id': {'required': True},
'object_id': {'required': True},
'permissions': {'required': True},
}

_attribute_map = {
'tenant_id': {'key': 'tenantId', 'type': 'str'},
'object_id': {'key': 'objectId', 'type': 'str'},
'application_id': {'key': 'applicationId', 'type': 'str'},
'permissions': {'key': 'permissions', 'type': 'Permissions'},
}

def __init__(self, *, tenant_id: str, object_id: str, permissions, application_id: str=None, **kwargs) -> None:
super(AccessPolicyEntry, self).__init__(**kwargs)
self.tenant_id = tenant_id
self.object_id = object_id
self.application_id = application_id
self.permissions = permissions
Loading