Skip to content

Commit

Permalink
CodeGen from PR 13389 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[Hub Generated] Review request for Microsoft.KeyVault to add version preview/2020-04-01-preview (Azure#13389)

* Add systemData to keyVault Vault property

* Update to our own systemData definition

* Fix copy/paste error and refactor out the identity type
  • Loading branch information
SDKAuto committed Mar 26, 2021
1 parent 0caa4ba commit 86586b4
Show file tree
Hide file tree
Showing 60 changed files with 2,905 additions and 612 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ def models(cls, api_version=DEFAULT_API_VERSION):
return models
raise ValueError("API version {} is not available".format(api_version))

@property
def keys(self):
"""Instance depends on the API version:
* 2019-09-01: :class:`KeysOperations<azure.mgmt.keyvault.v2019_09_01.operations.KeysOperations>`
"""
api_version = self._get_api_version('keys')
if api_version == '2019-09-01':
from .v2019_09_01.operations import KeysOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'keys'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def managed_hsms(self):
"""Instance depends on the API version:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ def models(cls, api_version=DEFAULT_API_VERSION):
return models
raise ValueError("API version {} is not available".format(api_version))

@property
def keys(self):
"""Instance depends on the API version:
* 2019-09-01: :class:`KeysOperations<azure.mgmt.keyvault.v2019_09_01.aio.operations.KeysOperations>`
"""
api_version = self._get_api_version('keys')
if api_version == '2019-09-01':
from ..v2019_09_01.aio.operations import KeysOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'keys'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def managed_hsms(self):
"""Instance depends on the API version:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.vaults = VaultsOperations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,33 @@
"base_url": "\u0027https://management.azure.com\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": true
"has_lro_operations": true,
"client_side_validation": false
},
"global_parameters": {
"sync_method": {
"sync": {
"credential": {
"method_signature": "credential, # type: \"TokenCredential\"",
"signature": "credential, # type: \"TokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials.TokenCredential",
"required": true
},
"subscription_id": {
"method_signature": "subscription_id, # type: str",
"signature": "subscription_id, # type: str",
"description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
"docstring_type": "str",
"required": true
}
},
"async_method": {
"async": {
"credential": {
"method_signature": "credential, # type: \"AsyncTokenCredential\"",
"signature": "credential, # type: \"AsyncTokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
"required": true
},
"subscription_id": {
"method_signature": "subscription_id, # type: str",
"signature": "subscription_id, # type: str",
"description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
"docstring_type": "str",
"required": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def __init__(

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.vaults = VaultsOperations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat

from ... import models
from ... import models as _models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
Expand All @@ -33,7 +33,7 @@ class Operations:
:param deserializer: An object model deserializer.
"""

models = models
models = _models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
Expand All @@ -44,15 +44,15 @@ def __init__(self, client, config, serializer, deserializer) -> None:
def list(
self,
**kwargs
) -> AsyncIterable["models.OperationListResult"]:
) -> AsyncIterable["_models.OperationListResult"]:
"""Lists all of the available Key Vault Rest API operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationListResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling

from ... import models
from ... import models as _models

T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
Expand All @@ -35,7 +35,7 @@ class VaultsOperations:
:param deserializer: An object model deserializer.
"""

models = models
models = _models

def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
Expand All @@ -47,9 +47,9 @@ async def create_or_update(
self,
resource_group_name: str,
vault_name: str,
parameters: "models.VaultCreateOrUpdateParameters",
parameters: "_models.VaultCreateOrUpdateParameters",
**kwargs
) -> "models.Vault":
) -> "_models.Vault":
"""Create or update a key vault in the specified subscription.
:param resource_group_name: The name of the Resource Group to which the server belongs.
Expand All @@ -63,7 +63,7 @@ async def create_or_update(
:rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -117,9 +117,9 @@ async def update(
self,
resource_group_name: str,
vault_name: str,
parameters: "models.VaultPatchParameters",
parameters: "_models.VaultPatchParameters",
**kwargs
) -> "models.Vault":
) -> "_models.Vault":
"""Update a key vault in the specified subscription.
:param resource_group_name: The name of the Resource Group to which the server belongs.
Expand All @@ -133,7 +133,7 @@ async def update(
:rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -241,7 +241,7 @@ async def get(
resource_group_name: str,
vault_name: str,
**kwargs
) -> "models.Vault":
) -> "_models.Vault":
"""Gets the specified Azure key vault.
:param resource_group_name: The name of the Resource Group to which the vault belongs.
Expand All @@ -253,7 +253,7 @@ async def get(
:rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -298,10 +298,10 @@ async def update_access_policy(
self,
resource_group_name: str,
vault_name: str,
operation_kind: Union[str, "models.AccessPolicyUpdateKind"],
parameters: "models.VaultAccessPolicyParameters",
operation_kind: Union[str, "_models.AccessPolicyUpdateKind"],
parameters: "_models.VaultAccessPolicyParameters",
**kwargs
) -> "models.VaultAccessPolicyParameters":
) -> "_models.VaultAccessPolicyParameters":
"""Update access policies in a key vault in the specified subscription.
:param resource_group_name: The name of the Resource Group to which the vault belongs.
Expand All @@ -317,7 +317,7 @@ async def update_access_policy(
:rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -373,7 +373,7 @@ def list_by_resource_group(
resource_group_name: str,
top: Optional[int] = None,
**kwargs
) -> AsyncIterable["models.VaultListResult"]:
) -> AsyncIterable["_models.VaultListResult"]:
"""The List operation gets information about the vaults associated with the subscription and
within the specified resource group.
Expand All @@ -386,7 +386,7 @@ def list_by_resource_group(
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -448,7 +448,7 @@ def list_by_subscription(
self,
top: Optional[int] = None,
**kwargs
) -> AsyncIterable["models.VaultListResult"]:
) -> AsyncIterable["_models.VaultListResult"]:
"""The List operation gets information about the vaults associated with the subscription.
:param top: Maximum number of results to return.
Expand All @@ -458,7 +458,7 @@ def list_by_subscription(
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -518,15 +518,15 @@ async def get_next(next_link=None):
def list_deleted(
self,
**kwargs
) -> AsyncIterable["models.DeletedVaultListResult"]:
) -> AsyncIterable["_models.DeletedVaultListResult"]:
"""Gets information about the deleted vaults in a subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DeletedVaultListResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -586,7 +586,7 @@ async def get_deleted(
vault_name: str,
location: str,
**kwargs
) -> "models.DeletedVault":
) -> "_models.DeletedVault":
"""Gets the deleted Azure key vault.
:param vault_name: The name of the vault.
Expand All @@ -598,7 +598,7 @@ async def get_deleted(
:rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -725,7 +725,13 @@ def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})

if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs)
path_format_arguments = {
'vaultName': self._serialize.url("vault_name", vault_name, 'str'),
'location': self._serialize.url("location", location, 'str'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
}

if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
Expand All @@ -743,7 +749,7 @@ def list(
self,
top: Optional[int] = None,
**kwargs
) -> AsyncIterable["models.ResourceListResult"]:
) -> AsyncIterable["_models.ResourceListResult"]:
"""The List operation gets information about the vaults associated with the subscription.
:param top: Maximum number of results to return.
Expand All @@ -753,7 +759,7 @@ def list(
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down Expand Up @@ -814,9 +820,9 @@ async def get_next(next_link=None):

async def check_name_availability(
self,
vault_name: "models.VaultCheckNameAvailabilityParameters",
vault_name: "_models.VaultCheckNameAvailabilityParameters",
**kwargs
) -> "models.CheckNameAvailabilityResult":
) -> "_models.CheckNameAvailabilityResult":
"""Checks that the vault name is valid and is not already in use.
:param vault_name: The name of the vault.
Expand All @@ -826,7 +832,7 @@ async def check_name_availability(
:rtype: ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"]
cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def __init__(
**kwargs
):
super(Sku, self).__init__(**kwargs)
self.family = kwargs['family']
self.family = kwargs.get('family', "A")
self.name = kwargs['name']


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ class Sku(msrest.serialization.Model):
def __init__(
self,
*,
family: Union[str, "SkuFamily"],
family: Union[str, "SkuFamily"] = "A",
name: Union[str, "SkuName"],
**kwargs
):
Expand Down

0 comments on commit 86586b4

Please sign in to comment.