diff --git a/sdk/keyvault/azure-mgmt-keyvault/_meta.json b/sdk/keyvault/azure-mgmt-keyvault/_meta.json index 1d7d6f241a1af..79b0dbd0fde4c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/_meta.json +++ b/sdk/keyvault/azure-mgmt-keyvault/_meta.json @@ -4,7 +4,7 @@ "@autorest/python@5.8.4", "@autorest/modelerfour@4.19.2" ], - "commit": "277fe93bafa204e9e9a8544155ff07c33c5b54f1", + "commit": "b880db84dbf8840eaf6527db3afb44b0a5e8f5d4", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest_command": "autorest specification/keyvault/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", "readme": "specification/keyvault/resource-manager/readme.md" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py index da7b7fa9efbec..2cca4d6ed3cb8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py @@ -96,6 +96,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-09-01: :mod:`v2019_09_01.models` * 2020-04-01-preview: :mod:`v2020_04_01_preview.models` * 2021-04-01-preview: :mod:`v2021_04_01_preview.models` + * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` """ if api_version == '2016-10-01': from .v2016_10_01 import models @@ -112,6 +113,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-04-01-preview': from .v2021_04_01_preview import models return models + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -120,12 +124,15 @@ def keys(self): * 2019-09-01: :class:`KeysOperations` * 2020-04-01-preview: :class:`KeysOperations` + * 2021-06-01-preview: :class:`KeysOperations` """ api_version = self._get_api_version('keys') if api_version == '2019-09-01': from .v2019_09_01.operations import KeysOperations as OperationClass elif api_version == '2020-04-01-preview': from .v2020_04_01_preview.operations import KeysOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.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))) @@ -136,12 +143,15 @@ def managed_hsms(self): * 2020-04-01-preview: :class:`ManagedHsmsOperations` * 2021-04-01-preview: :class:`ManagedHsmsOperations` + * 2021-06-01-preview: :class:`ManagedHsmsOperations` """ api_version = self._get_api_version('managed_hsms') if api_version == '2020-04-01-preview': from .v2020_04_01_preview.operations import ManagedHsmsOperations as OperationClass elif api_version == '2021-04-01-preview': from .v2021_04_01_preview.operations import ManagedHsmsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import ManagedHsmsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_hsms'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -151,10 +161,13 @@ def mhsm_private_endpoint_connections(self): """Instance depends on the API version: * 2021-04-01-preview: :class:`MHSMPrivateEndpointConnectionsOperations` + * 2021-06-01-preview: :class:`MHSMPrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('mhsm_private_endpoint_connections') if api_version == '2021-04-01-preview': from .v2021_04_01_preview.operations import MHSMPrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import MHSMPrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'mhsm_private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -164,10 +177,13 @@ def mhsm_private_link_resources(self): """Instance depends on the API version: * 2021-04-01-preview: :class:`MHSMPrivateLinkResourcesOperations` + * 2021-06-01-preview: :class:`MHSMPrivateLinkResourcesOperations` """ api_version = self._get_api_version('mhsm_private_link_resources') if api_version == '2021-04-01-preview': from .v2021_04_01_preview.operations import MHSMPrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import MHSMPrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'mhsm_private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -181,6 +197,7 @@ def operations(self): * 2019-09-01: :class:`Operations` * 2020-04-01-preview: :class:`Operations` * 2021-04-01-preview: :class:`Operations` + * 2021-06-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2016-10-01': @@ -193,6 +210,8 @@ def operations(self): from .v2020_04_01_preview.operations import Operations as OperationClass elif api_version == '2021-04-01-preview': from .v2021_04_01_preview.operations import Operations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -205,6 +224,7 @@ def private_endpoint_connections(self): * 2019-09-01: :class:`PrivateEndpointConnectionsOperations` * 2020-04-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-04-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-06-01-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2018-02-14': @@ -215,6 +235,8 @@ def private_endpoint_connections(self): from .v2020_04_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-04-01-preview': from .v2021_04_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -227,6 +249,7 @@ def private_link_resources(self): * 2019-09-01: :class:`PrivateLinkResourcesOperations` * 2020-04-01-preview: :class:`PrivateLinkResourcesOperations` * 2021-04-01-preview: :class:`PrivateLinkResourcesOperations` + * 2021-06-01-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2018-02-14': @@ -237,6 +260,8 @@ def private_link_resources(self): from .v2020_04_01_preview.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2021-04-01-preview': from .v2021_04_01_preview.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -246,10 +271,13 @@ def secrets(self): """Instance depends on the API version: * 2020-04-01-preview: :class:`SecretsOperations` + * 2021-06-01-preview: :class:`SecretsOperations` """ api_version = self._get_api_version('secrets') if api_version == '2020-04-01-preview': from .v2020_04_01_preview.operations import SecretsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import SecretsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'secrets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -263,6 +291,7 @@ def vaults(self): * 2019-09-01: :class:`VaultsOperations` * 2020-04-01-preview: :class:`VaultsOperations` * 2021-04-01-preview: :class:`VaultsOperations` + * 2021-06-01-preview: :class:`VaultsOperations` """ api_version = self._get_api_version('vaults') if api_version == '2016-10-01': @@ -275,6 +304,8 @@ def vaults(self): from .v2020_04_01_preview.operations import VaultsOperations as OperationClass elif api_version == '2021-04-01-preview': from .v2021_04_01_preview.operations import VaultsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from .v2021_06_01_preview.operations import VaultsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'vaults'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py index fa7afc6810aef..0dc03b7341d60 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py @@ -94,6 +94,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2019-09-01: :mod:`v2019_09_01.models` * 2020-04-01-preview: :mod:`v2020_04_01_preview.models` * 2021-04-01-preview: :mod:`v2021_04_01_preview.models` + * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` """ if api_version == '2016-10-01': from ..v2016_10_01 import models @@ -110,6 +111,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-04-01-preview': from ..v2021_04_01_preview import models return models + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -118,12 +122,15 @@ def keys(self): * 2019-09-01: :class:`KeysOperations` * 2020-04-01-preview: :class:`KeysOperations` + * 2021-06-01-preview: :class:`KeysOperations` """ api_version = self._get_api_version('keys') if api_version == '2019-09-01': from ..v2019_09_01.aio.operations import KeysOperations as OperationClass elif api_version == '2020-04-01-preview': from ..v2020_04_01_preview.aio.operations import KeysOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.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))) @@ -134,12 +141,15 @@ def managed_hsms(self): * 2020-04-01-preview: :class:`ManagedHsmsOperations` * 2021-04-01-preview: :class:`ManagedHsmsOperations` + * 2021-06-01-preview: :class:`ManagedHsmsOperations` """ api_version = self._get_api_version('managed_hsms') if api_version == '2020-04-01-preview': from ..v2020_04_01_preview.aio.operations import ManagedHsmsOperations as OperationClass elif api_version == '2021-04-01-preview': from ..v2021_04_01_preview.aio.operations import ManagedHsmsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import ManagedHsmsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_hsms'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -149,10 +159,13 @@ def mhsm_private_endpoint_connections(self): """Instance depends on the API version: * 2021-04-01-preview: :class:`MHSMPrivateEndpointConnectionsOperations` + * 2021-06-01-preview: :class:`MHSMPrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('mhsm_private_endpoint_connections') if api_version == '2021-04-01-preview': from ..v2021_04_01_preview.aio.operations import MHSMPrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import MHSMPrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'mhsm_private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -162,10 +175,13 @@ def mhsm_private_link_resources(self): """Instance depends on the API version: * 2021-04-01-preview: :class:`MHSMPrivateLinkResourcesOperations` + * 2021-06-01-preview: :class:`MHSMPrivateLinkResourcesOperations` """ api_version = self._get_api_version('mhsm_private_link_resources') if api_version == '2021-04-01-preview': from ..v2021_04_01_preview.aio.operations import MHSMPrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import MHSMPrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'mhsm_private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -179,6 +195,7 @@ def operations(self): * 2019-09-01: :class:`Operations` * 2020-04-01-preview: :class:`Operations` * 2021-04-01-preview: :class:`Operations` + * 2021-06-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2016-10-01': @@ -191,6 +208,8 @@ def operations(self): from ..v2020_04_01_preview.aio.operations import Operations as OperationClass elif api_version == '2021-04-01-preview': from ..v2021_04_01_preview.aio.operations import Operations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -203,6 +222,7 @@ def private_endpoint_connections(self): * 2019-09-01: :class:`PrivateEndpointConnectionsOperations` * 2020-04-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-04-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-06-01-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2018-02-14': @@ -213,6 +233,8 @@ def private_endpoint_connections(self): from ..v2020_04_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-04-01-preview': from ..v2021_04_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -225,6 +247,7 @@ def private_link_resources(self): * 2019-09-01: :class:`PrivateLinkResourcesOperations` * 2020-04-01-preview: :class:`PrivateLinkResourcesOperations` * 2021-04-01-preview: :class:`PrivateLinkResourcesOperations` + * 2021-06-01-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2018-02-14': @@ -235,6 +258,8 @@ def private_link_resources(self): from ..v2020_04_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2021-04-01-preview': from ..v2021_04_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -244,10 +269,13 @@ def secrets(self): """Instance depends on the API version: * 2020-04-01-preview: :class:`SecretsOperations` + * 2021-06-01-preview: :class:`SecretsOperations` """ api_version = self._get_api_version('secrets') if api_version == '2020-04-01-preview': from ..v2020_04_01_preview.aio.operations import SecretsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import SecretsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'secrets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -261,6 +289,7 @@ def vaults(self): * 2019-09-01: :class:`VaultsOperations` * 2020-04-01-preview: :class:`VaultsOperations` * 2021-04-01-preview: :class:`VaultsOperations` + * 2021-06-01-preview: :class:`VaultsOperations` """ api_version = self._get_api_version('vaults') if api_version == '2016-10-01': @@ -273,6 +302,8 @@ def vaults(self): from ..v2020_04_01_preview.aio.operations import VaultsOperations as OperationClass elif api_version == '2021-04-01-preview': from ..v2021_04_01_preview.aio.operations import VaultsOperations as OperationClass + elif api_version == '2021-06-01-preview': + from ..v2021_06_01_preview.aio.operations import VaultsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'vaults'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py index f89ed38360abd..e5754a47ce68f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py index f89ed38360abd..e5754a47ce68f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py index f89ed38360abd..e5754a47ce68f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py index f89ed38360abd..e5754a47ce68f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py index f89ed38360abd..e5754a47ce68f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/__init__.py new file mode 100644 index 0000000000000..1283ff09177b4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/__init__.py @@ -0,0 +1,19 @@ +# 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 + +__version__ = VERSION +__all__ = ['KeyVaultManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_configuration.py new file mode 100644 index 0000000000000..1111dd6fa3f47 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_configuration.py @@ -0,0 +1,71 @@ +# 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 typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class KeyVaultManagementClientConfiguration(Configuration): + """Configuration for KeyVaultManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :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 + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-06-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_key_vault_management_client.py new file mode 100644 index 0000000000000..9dce69cc8cbc4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_key_vault_management_client.py @@ -0,0 +1,129 @@ +# 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 typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import KeysOperations +from .operations import VaultsOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import ManagedHsmsOperations +from .operations import MHSMPrivateEndpointConnectionsOperations +from .operations import MHSMPrivateLinkResourcesOperations +from .operations import Operations +from .operations import SecretsOperations +from . import models + + +class KeyVaultManagementClient(object): + """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + + :ivar keys: KeysOperations operations + :vartype keys: azure.mgmt.keyvault.v2021_06_01_preview.operations.KeysOperations + :ivar vaults: VaultsOperations operations + :vartype vaults: azure.mgmt.keyvault.v2021_06_01_preview.operations.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.keyvault.v2021_06_01_preview.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.keyvault.v2021_06_01_preview.operations.PrivateLinkResourcesOperations + :ivar managed_hsms: ManagedHsmsOperations operations + :vartype managed_hsms: azure.mgmt.keyvault.v2021_06_01_preview.operations.ManagedHsmsOperations + :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations + :vartype mhsm_private_endpoint_connections: azure.mgmt.keyvault.v2021_06_01_preview.operations.MHSMPrivateEndpointConnectionsOperations + :ivar mhsm_private_link_resources: MHSMPrivateLinkResourcesOperations operations + :vartype mhsm_private_link_resources: azure.mgmt.keyvault.v2021_06_01_preview.operations.MHSMPrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2021_06_01_preview.operations.Operations + :ivar secrets: SecretsOperations operations + :vartype secrets: azure.mgmt.keyvault.v2021_06_01_preview.operations.SecretsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :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 + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + 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.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.managed_hsms = ManagedHsmsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.secrets = SecretsOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> KeyVaultManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_metadata.json new file mode 100644 index 0000000000000..9791ad668ce75 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_metadata.json @@ -0,0 +1,111 @@ +{ + "chosen_version": "2021-06-01-preview", + "total_api_version_list": ["2021-06-01-preview"], + "client": { + "name": "KeyVaultManagementClient", + "filename": "_key_vault_management_client", + "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "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": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: 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 + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "keys": "KeysOperations", + "vaults": "VaultsOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "managed_hsms": "ManagedHsmsOperations", + "mhsm_private_endpoint_connections": "MHSMPrivateEndpointConnectionsOperations", + "mhsm_private_link_resources": "MHSMPrivateLinkResourcesOperations", + "operations": "Operations", + "secrets": "SecretsOperations" + } +} \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py new file mode 100644 index 0000000000000..e5754a47ce68f --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py @@ -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. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/__init__.py new file mode 100644 index 0000000000000..f54ed88d6ad25 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 +__all__ = ['KeyVaultManagementClient'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_configuration.py new file mode 100644 index 0000000000000..da6ab06618bea --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_configuration.py @@ -0,0 +1,67 @@ +# 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 typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultManagementClientConfiguration(Configuration): + """Configuration for KeyVaultManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :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 + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-06-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-keyvault/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_key_vault_management_client.py new file mode 100644 index 0000000000000..d104a7fe4fe0f --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_key_vault_management_client.py @@ -0,0 +1,122 @@ +# 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 typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import KeysOperations +from .operations import VaultsOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import ManagedHsmsOperations +from .operations import MHSMPrivateEndpointConnectionsOperations +from .operations import MHSMPrivateLinkResourcesOperations +from .operations import Operations +from .operations import SecretsOperations +from .. import models + + +class KeyVaultManagementClient(object): + """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + + :ivar keys: KeysOperations operations + :vartype keys: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.KeysOperations + :ivar vaults: VaultsOperations operations + :vartype vaults: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.PrivateLinkResourcesOperations + :ivar managed_hsms: ManagedHsmsOperations operations + :vartype managed_hsms: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.ManagedHsmsOperations + :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations + :vartype mhsm_private_endpoint_connections: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.MHSMPrivateEndpointConnectionsOperations + :ivar mhsm_private_link_resources: MHSMPrivateLinkResourcesOperations operations + :vartype mhsm_private_link_resources: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.MHSMPrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.Operations + :ivar secrets: SecretsOperations operations + :vartype secrets: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.SecretsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :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 + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + 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.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.managed_hsms = ManagedHsmsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.secrets = SecretsOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "KeyVaultManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/__init__.py new file mode 100644 index 0000000000000..8e1d8528d9454 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/__init__.py @@ -0,0 +1,29 @@ +# 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 ._keys_operations import KeysOperations +from ._vaults_operations import VaultsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._managed_hsms_operations import ManagedHsmsOperations +from ._mhsm_private_endpoint_connections_operations import MHSMPrivateEndpointConnectionsOperations +from ._mhsm_private_link_resources_operations import MHSMPrivateLinkResourcesOperations +from ._operations import Operations +from ._secrets_operations import SecretsOperations + +__all__ = [ + 'KeysOperations', + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ManagedHsmsOperations', + 'MHSMPrivateEndpointConnectionsOperations', + 'MHSMPrivateLinkResourcesOperations', + 'Operations', + 'SecretsOperations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_keys_operations.py new file mode 100644 index 0000000000000..a445eefaa21d7 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_keys_operations.py @@ -0,0 +1,399 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class KeysOperations: + """KeysOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: "_models.KeyCreateParameters", + **kwargs: Any + ) -> "_models.Key": + """Creates the first version of a new key if it does not exist. If it already exists, then the + existing key is returned without any write operations being performed. This API does not create + subsequent versions, and does not update existing keys. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the key vault which contains the key to be created. + :type vault_name: str + :param key_name: The name of the key to be created. + :type key_name: str + :param parameters: The parameters used to create the specified key. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_if_not_exist.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'KeyCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any + ) -> "_models.Key": + """Gets the current version of the specified key from the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. + :type vault_name: str + :param key_name: The name of the key to be retrieved. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + def list( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.KeyListResult"]: + """Lists the keys in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the keys to be retrieved. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} # type: ignore + + async def get_version( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + key_version: str, + **kwargs: Any + ) -> "_models.Key": + """Gets the specified version of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key version to be retrieved. + :type vault_name: str + :param key_name: The name of the key version to be retrieved. + :type key_name: str + :param key_version: The version of the key to be retrieved. + :type key_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_version.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + 'keyVersion': self._serialize.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} # type: ignore + + def list_versions( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.KeyListResult"]: + """Lists the versions of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key versions to be retrieved. + :type vault_name: str + :param key_name: The name of the key versions to be retrieved. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_versions.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_versions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py new file mode 100644 index 0000000000000..641a2f941560f --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py @@ -0,0 +1,858 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedHsmsOperations: + """ManagedHsmsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> "_models.ManagedHsm": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ManagedHsm') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> AsyncLROPoller["_models.ManagedHsm"]: + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, '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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> "_models.ManagedHsm": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ManagedHsm') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> AsyncLROPoller["_models.ManagedHsm"]: + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param parameters: Parameters to patch the managed HSM Pool. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, '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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: The name of the managed HSM Pool to delete. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, '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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> Optional["_models.ManagedHsm"]: + """Gets the specified managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedHsm, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ManagedHsmListResult"]: + """The List operation gets information about the managed HSM Pools associated with the + subscription and within the specified resource group. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + + def list_by_subscription( + self, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ManagedHsmListResult"]: + """The List operation gets information about the managed HSM Pools associated with the + subscription. + + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + + def list_deleted( + self, + **kwargs: Any + ) -> AsyncIterable["_models.DeletedManagedHsmListResult"]: + """The List operation gets information about the deleted managed HSMs associated with the + subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedManagedHsmListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsmListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_deleted.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedManagedHsmListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs'} # type: ignore + + async def get_deleted( + self, + name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedManagedHsm": + """Gets the specified deleted managed HSM. + + :param name: The name of the deleted managed HSM. + :type name: str + :param location: The location of the deleted managed HSM. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedManagedHsm, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsm + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsm"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_deleted.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeletedManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}'} # type: ignore + + async def _purge_deleted_initial( + self, + name: str, + location: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._purge_deleted_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge'} # type: ignore + + async def begin_purge_deleted( + self, + name: str, + location: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Permanently deletes the specified managed HSM. + + :param name: The name of the soft-deleted managed HSM. + :type name: str + :param location: The location of the soft-deleted managed HSM. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._purge_deleted_initial( + name=name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'name': self._serialize.url("name", 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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py new file mode 100644 index 0000000000000..17458b7c0a485 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -0,0 +1,387 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MHSMPrivateEndpointConnectionsOperations: + """MHSMPrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MHSMPrivateEndpointConnectionsListResult"]: + """The List operation gets information about the private endpoint connections associated with the + managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MHSMPrivateEndpointConnectionsListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnectionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MHSMPrivateEndpointConnectionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections'} # type: ignore + + async def get( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.MHSMPrivateEndpointConnection": + """Gets the specified private endpoint connection associated with the managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MHSMPrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def put( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: "_models.MHSMPrivateEndpointConnection", + **kwargs: Any + ) -> "_models.MHSMPrivateEndpointConnection": + """Updates the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MHSMPrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.put.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.MHSMPrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MHSMPrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.MHSMPrivateEndpointConnection"]: + """Deletes the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MHSMPrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_link_resources_operations.py new file mode 100644 index 0000000000000..04d230f587831 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_link_resources_operations.py @@ -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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MHSMPrivateLinkResourcesOperations: + """MHSMPrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list_by_mhsm_resource( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> "_models.MHSMPrivateLinkResourceListResult": + """Gets the private link resources supported for the managed hsm pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MHSMPrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_mhsm_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MHSMPrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_mhsm_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_operations.py new file mode 100644 index 0000000000000..79cd2937801c7 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> 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.v2021_06_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 0000000000000..c614bcaf65309 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,387 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: + """Gets the specified private endpoint connection associated with the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Updates the specified private endpoint connection associated with the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.put.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(properties, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + """Deletes the specified private endpoint connection associated with the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, '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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def list_by_resource( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + """The List operation gets information about the private endpoint connections associated with the + vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py new file mode 100644 index 0000000000000..95d13af7f369a --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py @@ -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. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def list_by_vault( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": + """Gets the private link resources supported for the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_vault.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py new file mode 100644 index 0000000000000..252c5d2d17d7f --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py @@ -0,0 +1,338 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SecretsOperations: + """SecretsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: "_models.SecretCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.Secret": + """Create or update a secret in a key vault in the specified subscription. NOTE: This API is + intended for internal use in ARM deployments. Users should use the data-plane REST service for + interaction with vault secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param secret_name: Name of the secret. + :type secret_name: str + :param parameters: Parameters to create or update the secret. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'secretName': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Secret', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: "_models.SecretPatchParameters", + **kwargs: Any + ) -> "_models.Secret": + """Update a secret in the specified subscription. NOTE: This API is intended for internal use in + ARM deployments. Users should use the data-plane REST service for interaction with vault + secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param secret_name: Name of the secret. + :type secret_name: str + :param parameters: Parameters to patch the secret. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'secretName': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SecretPatchParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Secret', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + **kwargs: Any + ) -> "_models.Secret": + """Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. + Users should use the data-plane REST service for interaction with vault secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :param secret_name: The name of the secret. + :type secret_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'secretName': self._serialize.url("secret_name", secret_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + def list( + self, + resource_group_name: str, + vault_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SecretListResult"]: + """The List operation gets information about the secrets in a vault. NOTE: This API is intended + for internal use in ARM deployments. Users should use the data-plane REST service for + interaction with vault secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SecretListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py new file mode 100644 index 0000000000000..42138478bb6ae --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py @@ -0,0 +1,939 @@ +# 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 typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VaultsOperations: + """VaultsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def _create_or_update_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.Vault": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> AsyncLROPoller["_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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to create or update the vault. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + '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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultPatchParameters", + **kwargs: Any + ) -> "_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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to patch the vault. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultPatchParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault to delete. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + async def get( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.Vault": + """Gets the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + async def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", + **kwargs: Any + ) -> "_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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param operation_kind: Name of the operation. + :type operation_kind: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultAccessPolicyParameters, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_access_policy.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VaultListResult"]: + """The List operation gets information about the vaults associated with the subscription and + within the specified resource group. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} # type: ignore + + def list_by_subscription( + self, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.VaultListResult"]: + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + + def list_deleted( + self, + **kwargs: Any + ) -> 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.v2021_06_01_preview.models.DeletedVaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_deleted.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + + async def get_deleted( + self, + vault_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedVault": + """Gets the deleted Azure key vault. + + :param vault_name: The name of the vault. + :type vault_name: str + :param location: The location of the deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_deleted.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeletedVault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} # type: ignore + + async def _purge_deleted_initial( + self, + vault_name: str, + location: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._purge_deleted_initial.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + async def begin_purge_deleted( + self, + vault_name: str, + location: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + + :param vault_name: The name of the soft-deleted vault. + :type vault_name: str + :param location: The location of the soft-deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + def list( + self, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ResourceListResult"]: + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2015-11-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + + async def check_name_availability( + self, + vault_name: "_models.VaultCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": + """Checks that the vault name is valid and is not already in use. + + :param vault_name: The name of the vault. + :type vault_name: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/__init__.py new file mode 100644 index 0000000000000..74d3e28d0abf4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/__init__.py @@ -0,0 +1,294 @@ +# 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 ._models_py3 import AccessPolicyEntry + from ._models_py3 import Action + from ._models_py3 import Attributes + from ._models_py3 import CheckNameAvailabilityResult + from ._models_py3 import CloudErrorBody + from ._models_py3 import DeletedManagedHsm + from ._models_py3 import DeletedManagedHsmListResult + from ._models_py3 import DeletedManagedHsmProperties + from ._models_py3 import DeletedVault + from ._models_py3 import DeletedVaultListResult + from ._models_py3 import DeletedVaultProperties + from ._models_py3 import DimensionProperties + from ._models_py3 import Error + from ._models_py3 import IPRule + from ._models_py3 import Key + from ._models_py3 import KeyAttributes + from ._models_py3 import KeyCreateParameters + from ._models_py3 import KeyListResult + from ._models_py3 import KeyProperties + from ._models_py3 import KeyReleasePolicy + from ._models_py3 import KeyRotationPolicyAttributes + from ._models_py3 import LifetimeAction + from ._models_py3 import LogSpecification + from ._models_py3 import MHSMIPRule + from ._models_py3 import MHSMNetworkRuleSet + from ._models_py3 import MHSMPrivateEndpoint + from ._models_py3 import MHSMPrivateEndpointConnection + from ._models_py3 import MHSMPrivateEndpointConnectionItem + from ._models_py3 import MHSMPrivateEndpointConnectionsListResult + from ._models_py3 import MHSMPrivateLinkResource + from ._models_py3 import MHSMPrivateLinkResourceListResult + from ._models_py3 import MHSMPrivateLinkServiceConnectionState + from ._models_py3 import MHSMVirtualNetworkRule + from ._models_py3 import ManagedHsm + from ._models_py3 import ManagedHsmError + from ._models_py3 import ManagedHsmListResult + from ._models_py3 import ManagedHsmProperties + from ._models_py3 import ManagedHsmResource + from ._models_py3 import ManagedHsmSku + from ._models_py3 import MetricSpecification + from ._models_py3 import NetworkRuleSet + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import Permissions + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionItem + from ._models_py3 import PrivateEndpointConnectionListResult + from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkResourceListResult + from ._models_py3 import PrivateLinkServiceConnectionState + from ._models_py3 import Resource + from ._models_py3 import ResourceListResult + from ._models_py3 import RotationPolicy + from ._models_py3 import Secret + from ._models_py3 import SecretAttributes + from ._models_py3 import SecretCreateOrUpdateParameters + from ._models_py3 import SecretListResult + from ._models_py3 import SecretPatchParameters + from ._models_py3 import SecretPatchProperties + from ._models_py3 import SecretProperties + from ._models_py3 import ServiceSpecification + from ._models_py3 import Sku + from ._models_py3 import SystemData + from ._models_py3 import Trigger + from ._models_py3 import Vault + from ._models_py3 import VaultAccessPolicyParameters + from ._models_py3 import VaultAccessPolicyProperties + from ._models_py3 import VaultCheckNameAvailabilityParameters + from ._models_py3 import VaultCreateOrUpdateParameters + from ._models_py3 import VaultListResult + from ._models_py3 import VaultPatchParameters + from ._models_py3 import VaultPatchProperties + from ._models_py3 import VaultProperties + from ._models_py3 import VirtualNetworkRule +except (SyntaxError, ImportError): + from ._models import AccessPolicyEntry # type: ignore + from ._models import Action # type: ignore + from ._models import Attributes # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import DeletedManagedHsm # type: ignore + from ._models import DeletedManagedHsmListResult # type: ignore + from ._models import DeletedManagedHsmProperties # type: ignore + from ._models import DeletedVault # type: ignore + from ._models import DeletedVaultListResult # type: ignore + from ._models import DeletedVaultProperties # type: ignore + from ._models import DimensionProperties # type: ignore + from ._models import Error # type: ignore + from ._models import IPRule # type: ignore + from ._models import Key # type: ignore + from ._models import KeyAttributes # type: ignore + from ._models import KeyCreateParameters # type: ignore + from ._models import KeyListResult # type: ignore + from ._models import KeyProperties # type: ignore + from ._models import KeyReleasePolicy # type: ignore + from ._models import KeyRotationPolicyAttributes # type: ignore + from ._models import LifetimeAction # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import MHSMIPRule # type: ignore + from ._models import MHSMNetworkRuleSet # type: ignore + from ._models import MHSMPrivateEndpoint # type: ignore + from ._models import MHSMPrivateEndpointConnection # type: ignore + from ._models import MHSMPrivateEndpointConnectionItem # type: ignore + from ._models import MHSMPrivateEndpointConnectionsListResult # type: ignore + from ._models import MHSMPrivateLinkResource # type: ignore + from ._models import MHSMPrivateLinkResourceListResult # type: ignore + from ._models import MHSMPrivateLinkServiceConnectionState # type: ignore + from ._models import MHSMVirtualNetworkRule # type: ignore + from ._models import ManagedHsm # type: ignore + from ._models import ManagedHsmError # type: ignore + from ._models import ManagedHsmListResult # type: ignore + from ._models import ManagedHsmProperties # type: ignore + from ._models import ManagedHsmResource # type: ignore + from ._models import ManagedHsmSku # type: ignore + from ._models import MetricSpecification # type: ignore + from ._models import NetworkRuleSet # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import Permissions # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionItem # type: ignore + from ._models import PrivateEndpointConnectionListResult # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourceListResult # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceListResult # type: ignore + from ._models import RotationPolicy # type: ignore + from ._models import Secret # type: ignore + from ._models import SecretAttributes # type: ignore + from ._models import SecretCreateOrUpdateParameters # type: ignore + from ._models import SecretListResult # type: ignore + from ._models import SecretPatchParameters # type: ignore + from ._models import SecretPatchProperties # type: ignore + from ._models import SecretProperties # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # type: ignore + from ._models import SystemData # type: ignore + from ._models import Trigger # type: ignore + from ._models import Vault # type: ignore + from ._models import VaultAccessPolicyParameters # type: ignore + from ._models import VaultAccessPolicyProperties # type: ignore + from ._models import VaultCheckNameAvailabilityParameters # type: ignore + from ._models import VaultCreateOrUpdateParameters # type: ignore + from ._models import VaultListResult # type: ignore + from ._models import VaultPatchParameters # type: ignore + from ._models import VaultPatchProperties # type: ignore + from ._models import VaultProperties # type: ignore + from ._models import VirtualNetworkRule # type: ignore + +from ._key_vault_management_client_enums import ( + AccessPolicyUpdateKind, + ActionsRequired, + CertificatePermissions, + CreateMode, + DeletionRecoveryLevel, + IdentityType, + JsonWebKeyCurveName, + JsonWebKeyOperation, + JsonWebKeyType, + KeyPermissions, + KeyRotationPolicyActionType, + ManagedHsmSkuFamily, + ManagedHsmSkuName, + NetworkRuleAction, + NetworkRuleBypassOptions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicNetworkAccess, + Reason, + SecretPermissions, + SkuFamily, + SkuName, + StoragePermissions, + VaultProvisioningState, +) + +__all__ = [ + 'AccessPolicyEntry', + 'Action', + 'Attributes', + 'CheckNameAvailabilityResult', + 'CloudErrorBody', + 'DeletedManagedHsm', + 'DeletedManagedHsmListResult', + 'DeletedManagedHsmProperties', + 'DeletedVault', + 'DeletedVaultListResult', + 'DeletedVaultProperties', + 'DimensionProperties', + 'Error', + 'IPRule', + 'Key', + 'KeyAttributes', + 'KeyCreateParameters', + 'KeyListResult', + 'KeyProperties', + 'KeyReleasePolicy', + 'KeyRotationPolicyAttributes', + 'LifetimeAction', + 'LogSpecification', + 'MHSMIPRule', + 'MHSMNetworkRuleSet', + 'MHSMPrivateEndpoint', + 'MHSMPrivateEndpointConnection', + 'MHSMPrivateEndpointConnectionItem', + 'MHSMPrivateEndpointConnectionsListResult', + 'MHSMPrivateLinkResource', + 'MHSMPrivateLinkResourceListResult', + 'MHSMPrivateLinkServiceConnectionState', + 'MHSMVirtualNetworkRule', + 'ManagedHsm', + 'ManagedHsmError', + 'ManagedHsmListResult', + 'ManagedHsmProperties', + 'ManagedHsmResource', + 'ManagedHsmSku', + 'MetricSpecification', + 'NetworkRuleSet', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'Permissions', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionItem', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'Resource', + 'ResourceListResult', + 'RotationPolicy', + 'Secret', + 'SecretAttributes', + 'SecretCreateOrUpdateParameters', + 'SecretListResult', + 'SecretPatchParameters', + 'SecretPatchProperties', + 'SecretProperties', + 'ServiceSpecification', + 'Sku', + 'SystemData', + 'Trigger', + 'Vault', + 'VaultAccessPolicyParameters', + 'VaultAccessPolicyProperties', + 'VaultCheckNameAvailabilityParameters', + 'VaultCreateOrUpdateParameters', + 'VaultListResult', + 'VaultPatchParameters', + 'VaultPatchProperties', + 'VaultProperties', + 'VirtualNetworkRule', + 'AccessPolicyUpdateKind', + 'ActionsRequired', + 'CertificatePermissions', + 'CreateMode', + 'DeletionRecoveryLevel', + 'IdentityType', + 'JsonWebKeyCurveName', + 'JsonWebKeyOperation', + 'JsonWebKeyType', + 'KeyPermissions', + 'KeyRotationPolicyActionType', + 'ManagedHsmSkuFamily', + 'ManagedHsmSkuName', + 'NetworkRuleAction', + 'NetworkRuleBypassOptions', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', + 'ProvisioningState', + 'PublicNetworkAccess', + 'Reason', + 'SecretPermissions', + 'SkuFamily', + 'SkuName', + 'StoragePermissions', + 'VaultProvisioningState', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_key_vault_management_client_enums.py new file mode 100644 index 0000000000000..53478fc893a35 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_key_vault_management_client_enums.py @@ -0,0 +1,282 @@ +# 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 enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class AccessPolicyUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + ADD = "add" + REPLACE = "replace" + REMOVE = "remove" + +class ActionsRequired(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """A message indicating if changes on the service provider require any updates on the consumer. + """ + + NONE = "None" + +class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + ALL = "all" + GET = "get" + LIST = "list" + DELETE = "delete" + CREATE = "create" + IMPORT_ENUM = "import" + UPDATE = "update" + MANAGECONTACTS = "managecontacts" + GETISSUERS = "getissuers" + LISTISSUERS = "listissuers" + SETISSUERS = "setissuers" + DELETEISSUERS = "deleteissuers" + MANAGEISSUERS = "manageissuers" + RECOVER = "recover" + PURGE = "purge" + BACKUP = "backup" + RESTORE = "restore" + +class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The vault's create mode to indicate whether the vault need to be recovered or not. + """ + + RECOVER = "recover" + DEFAULT = "default" + +class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The deletion recovery level currently in effect for the object. If it contains 'Purgeable', + then the object can be permanently deleted by a privileged user; otherwise, only the system can + purge the object at the end of the retention interval. + """ + + PURGEABLE = "Purgeable" + RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" + RECOVERABLE = "Recoverable" + RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" + +class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class JsonWebKeyCurveName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The elliptic curve name. For valid values, see JsonWebKeyCurveName. + """ + + P256 = "P-256" + P384 = "P-384" + P521 = "P-521" + P256_K = "P-256K" + +class JsonWebKeyOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The permitted JSON web key operations of the key. For more information, see + JsonWebKeyOperation. + """ + + ENCRYPT = "encrypt" + DECRYPT = "decrypt" + SIGN = "sign" + VERIFY = "verify" + WRAP_KEY = "wrapKey" + UNWRAP_KEY = "unwrapKey" + IMPORT_ENUM = "import" + +class JsonWebKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the key. For valid values, see JsonWebKeyType. + """ + + EC = "EC" + EC_HSM = "EC-HSM" + RSA = "RSA" + RSA_HSM = "RSA-HSM" + +class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + ALL = "all" + ENCRYPT = "encrypt" + DECRYPT = "decrypt" + WRAP_KEY = "wrapKey" + UNWRAP_KEY = "unwrapKey" + SIGN = "sign" + VERIFY = "verify" + GET = "get" + LIST = "list" + CREATE = "create" + UPDATE = "update" + IMPORT_ENUM = "import" + DELETE = "delete" + BACKUP = "backup" + RESTORE = "restore" + RECOVER = "recover" + PURGE = "purge" + RELEASE = "release" + ROTATE = "rotate" + +class KeyRotationPolicyActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of action. + """ + + ROTATE = "rotate" + NOTIFY = "notify" + +class ManagedHsmSkuFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SKU Family of the managed HSM Pool + """ + + B = "B" + +class ManagedHsmSkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SKU of the managed HSM Pool + """ + + STANDARD_B1 = "Standard_B1" + CUSTOM_B32 = "Custom_B32" + +class NetworkRuleAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The default action when no rule from ipRules and from virtualNetworkRules match. This is only + used after the bypass property has been evaluated. + """ + + ALLOW = "Allow" + DENY = "Deny" + +class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not + specified the default is 'AzureServices'. + """ + + AZURE_SERVICES = "AzureServices" + NONE = "None" + +class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + FAILED = "Failed" + DISCONNECTED = "Disconnected" + +class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The private endpoint connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state. + """ + + #: The managed HSM Pool has been full provisioned. + SUCCEEDED = "Succeeded" + #: The managed HSM Pool is currently being provisioned. + PROVISIONING = "Provisioning" + #: Provisioning of the managed HSM Pool has failed. + FAILED = "Failed" + #: The managed HSM Pool is currently being updated. + UPDATING = "Updating" + #: The managed HSM Pool is currently being deleted. + DELETING = "Deleting" + #: The managed HSM pool is ready for normal use. + ACTIVATED = "Activated" + #: The managed HSM pool is waiting for a security domain restore action. + SECURITY_DOMAIN_RESTORE = "SecurityDomainRestore" + #: The managed HSM pool is being restored from full HSM backup. + RESTORING = "Restoring" + +class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Control permission for data plane traffic coming from public networks while private endpoint is + enabled. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The reason that a vault name could not be used. The Reason element is only returned if + NameAvailable is false. + """ + + ACCOUNT_NAME_INVALID = "AccountNameInvalid" + ALREADY_EXISTS = "AlreadyExists" + +class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + ALL = "all" + GET = "get" + LIST = "list" + SET = "set" + DELETE = "delete" + BACKUP = "backup" + RESTORE = "restore" + RECOVER = "recover" + PURGE = "purge" + +class SkuFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SKU family name + """ + + A = "A" + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """SKU name to specify whether the key vault is a standard vault or a premium vault. + """ + + STANDARD = "standard" + PREMIUM = "premium" + +class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + ALL = "all" + GET = "get" + LIST = "list" + DELETE = "delete" + SET = "set" + UPDATE = "update" + REGENERATEKEY = "regeneratekey" + RECOVER = "recover" + PURGE = "purge" + BACKUP = "backup" + RESTORE = "restore" + SETSAS = "setsas" + LISTSAS = "listsas" + GETSAS = "getsas" + DELETESAS = "deletesas" + +class VaultProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the vault. + """ + + SUCCEEDED = "Succeeded" + REGISTERING_DNS = "RegisteringDns" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models.py new file mode 100644 index 0000000000000..e45a2139da246 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models.py @@ -0,0 +1,2859 @@ +# 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 azure.core.exceptions import HttpResponseError +import msrest.serialization + + +class AccessPolicyEntry(msrest.serialization.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.v2021_06_01_preview.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['tenant_id'] + self.object_id = kwargs['object_id'] + self.application_id = kwargs.get('application_id', None) + self.permissions = kwargs['permissions'] + + +class Action(msrest.serialization.Model): + """Action. + + :param type: The type of action. Possible values include: "rotate", "notify". + :type type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyActionType + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + + +class Attributes(msrest.serialization.Model): + """The object attributes managed by the KeyVault service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: ~datetime.datetime + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: ~datetime.datetime + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: ~datetime.datetime + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'unix-time'}, + 'expires': {'key': 'exp', 'type': 'unix-time'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, + } + + def __init__( + self, + **kwargs + ): + super(Attributes, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.not_before = kwargs.get('not_before', None) + self.expires = kwargs.get('expires', None) + self.created = None + self.updated = None + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """The CheckNameAvailability operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: A boolean value that indicates whether the name is available for you to + use. If true, the name is available. If false, the name has already been taken or is invalid + and cannot be used. + :vartype name_available: bool + :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.v2021_06_01_preview.models.Reason + :ivar message: An error message explaining the Reason value in more detail. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from Key Vault resource provider. + + :param code: Error code. This is a mnemonic that can be consumed programmatically. + :type code: str + :param message: User friendly error message. The message is typically localized and may vary + with service version. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class DeletedManagedHsm(msrest.serialization.Model): + """DeletedManagedHsm. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the deleted managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param properties: Properties of the deleted managed HSM. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeletedManagedHsmProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedManagedHsm, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) + + +class DeletedManagedHsmListResult(msrest.serialization.Model): + """List of deleted managed HSM Pools. + + :param value: The list of deleted managed HSM Pools. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsm] + :param next_link: The URL to get the next set of deleted managed HSM Pools. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedManagedHsm]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedManagedHsmListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class DeletedManagedHsmProperties(msrest.serialization.Model): + """Properties of the deleted managed HSM. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar mhsm_id: The resource id of the original managed HSM. + :vartype mhsm_id: str + :ivar location: The location of the original managed HSM. + :vartype location: str + :ivar deletion_date: The deleted date. + :vartype deletion_date: ~datetime.datetime + :ivar scheduled_purge_date: The scheduled purged date. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar purge_protection_enabled: Purge protection status of the original managed HSM. + :vartype purge_protection_enabled: bool + :ivar tags: A set of tags. Tags of the original managed HSM. + :vartype tags: dict[str, str] + """ + + _validation = { + 'mhsm_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'mhsm_id': {'key': 'mhsmId', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedManagedHsmProperties, self).__init__(**kwargs) + self.mhsm_id = None + self.location = None + self.deletion_date = None + self.scheduled_purge_date = None + self.purge_protection_enabled = None + self.tags = None + + +class DeletedVault(msrest.serialization.Model): + """Deleted vault information with extended details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID for the deleted key vault. + :vartype id: str + :ivar name: The name of the key vault. + :vartype name: str + :ivar type: The resource type of the key vault. + :vartype type: str + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedVault, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = kwargs.get('properties', None) + + +class DeletedVaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of deleted vaults. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVault] + :param next_link: The URL to get the next set of deleted vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedVault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedVaultListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class DeletedVaultProperties(msrest.serialization.Model): + """Properties of the deleted vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar vault_id: The resource id of the original vault. + :vartype vault_id: str + :ivar location: The location of the original vault. + :vartype location: str + :ivar deletion_date: The deleted date. + :vartype deletion_date: ~datetime.datetime + :ivar scheduled_purge_date: The scheduled purged date. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar tags: A set of tags. Tags of the original vault. + :vartype tags: dict[str, str] + :ivar purge_protection_enabled: Purge protection status of the original vault. + :vartype purge_protection_enabled: bool + """ + + _validation = { + 'vault_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, + } + + _attribute_map = { + 'vault_id': {'key': 'vaultId', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedVaultProperties, self).__init__(**kwargs) + self.vault_id = None + self.location = None + self.deletion_date = None + self.scheduled_purge_date = None + self.tags = None + self.purge_protection_enabled = None + + +class DimensionProperties(msrest.serialization.Model): + """Type of operation: get, read, delete, etc. + + :param name: Name of dimension. + :type name: str + :param display_name: Display name of dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported + for Shoebox. + :type to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(DimensionProperties, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) + + +class Error(msrest.serialization.Model): + """The server error. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar inner_error: The inner error, contains a more specific error code. + :vartype inner_error: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Error + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'inner_error': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'inner_error': {'key': 'innererror', 'type': 'Error'}, + } + + def __init__( + self, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.code = None + self.message = None + self.inner_error = None + + +class IPRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific ip address or ip range. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + :type value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IPRule, self).__init__(**kwargs) + self.value = kwargs['value'] + + +class Resource(msrest.serialization.Model): + """Key Vault resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + + +class Key(Resource): + """The key resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :param attributes: The attributes of the key. + :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes + :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM". + :type kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + values include: "P-256", "P-384", "P-521", "P-256K". + :type curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of the key. + :vartype key_uri_with_version: str + :param rotation_policy: Key rotation policy in response. It will be used for both output and + input. Omitted if empty. + :type rotation_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.RotationPolicy + :param release_policy: Key release policy in response. It will be used for both output and + input. Omitted if empty. + :type release_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyReleasePolicy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'attributes': {'key': 'properties.attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'properties.kty', 'type': 'str'}, + 'key_ops': {'key': 'properties.keyOps', 'type': '[str]'}, + 'key_size': {'key': 'properties.keySize', 'type': 'int'}, + 'curve_name': {'key': 'properties.curveName', 'type': 'str'}, + 'key_uri': {'key': 'properties.keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'properties.keyUriWithVersion', 'type': 'str'}, + 'rotation_policy': {'key': 'properties.rotationPolicy', 'type': 'RotationPolicy'}, + 'release_policy': {'key': 'properties.release_policy', 'type': 'KeyReleasePolicy'}, + } + + def __init__( + self, + **kwargs + ): + super(Key, self).__init__(**kwargs) + self.attributes = kwargs.get('attributes', None) + self.kty = kwargs.get('kty', None) + self.key_ops = kwargs.get('key_ops', None) + self.key_size = kwargs.get('key_size', None) + self.curve_name = kwargs.get('curve_name', None) + self.key_uri = None + self.key_uri_with_version = None + self.rotation_policy = kwargs.get('rotation_policy', None) + self.release_policy = kwargs.get('release_policy', None) + + +class KeyAttributes(msrest.serialization.Model): + """The object attributes managed by the Azure Key Vault service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether or not the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: long + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: long + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :ivar recovery_level: The deletion recovery level currently in effect for the object. If it + contains 'Purgeable', then the object can be permanently deleted by a privileged user; + otherwise, only the system can purge the object at the end of the retention interval. Possible + values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletionRecoveryLevel + :param exportable: Indicates if the private key can be exported. + :type exportable: bool + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'recovery_level': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'long'}, + 'expires': {'key': 'exp', 'type': 'long'}, + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + 'exportable': {'key': 'exportable', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyAttributes, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.not_before = kwargs.get('not_before', None) + self.expires = kwargs.get('expires', None) + self.created = None + self.updated = None + self.recovery_level = None + self.exportable = kwargs.get('exportable', None) + + +class KeyCreateParameters(msrest.serialization.Model): + """The parameters used to create a key. + + All required parameters must be populated in order to send to Azure. + + :param tags: A set of tags. The tags that will be assigned to the key. + :type tags: dict[str, str] + :param properties: Required. The properties of the key to be created. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'KeyProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyCreateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.properties = kwargs['properties'] + + +class KeyListResult(msrest.serialization.Model): + """The page of keys. + + :param value: The key resources. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Key] + :param next_link: The URL to get the next page of keys. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Key]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class KeyProperties(msrest.serialization.Model): + """The properties of the key. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param attributes: The attributes of the key. + :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes + :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM". + :type kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + values include: "P-256", "P-384", "P-521", "P-256K". + :type curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of the key. + :vartype key_uri_with_version: str + :param rotation_policy: Key rotation policy in response. It will be used for both output and + input. Omitted if empty. + :type rotation_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.RotationPolicy + :param release_policy: Key release policy in response. It will be used for both output and + input. Omitted if empty. + :type release_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyReleasePolicy + """ + + _validation = { + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'kty', 'type': 'str'}, + 'key_ops': {'key': 'keyOps', 'type': '[str]'}, + 'key_size': {'key': 'keySize', 'type': 'int'}, + 'curve_name': {'key': 'curveName', 'type': 'str'}, + 'key_uri': {'key': 'keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'keyUriWithVersion', 'type': 'str'}, + 'rotation_policy': {'key': 'rotationPolicy', 'type': 'RotationPolicy'}, + 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyProperties, self).__init__(**kwargs) + self.attributes = kwargs.get('attributes', None) + self.kty = kwargs.get('kty', None) + self.key_ops = kwargs.get('key_ops', None) + self.key_size = kwargs.get('key_size', None) + self.curve_name = kwargs.get('curve_name', None) + self.key_uri = None + self.key_uri_with_version = None + self.rotation_policy = kwargs.get('rotation_policy', None) + self.release_policy = kwargs.get('release_policy', None) + + +class KeyReleasePolicy(msrest.serialization.Model): + """KeyReleasePolicy. + + :param content_type: Content type and version of key release policy. + :type content_type: str + :param data: Blob encoding the policy rules under which the key can be released. + :type data: bytes + """ + + _attribute_map = { + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'data': {'key': 'data', 'type': 'base64'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyReleasePolicy, self).__init__(**kwargs) + self.content_type = kwargs.get('content_type', "application/json; charset=utf-8") + self.data = kwargs.get('data', None) + + +class KeyRotationPolicyAttributes(msrest.serialization.Model): + """KeyRotationPolicyAttributes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :param expiry_time: The expiration time for the new key version. It should be in ISO8601 + format. Eg: 'P90D', 'P1Y'. + :type expiry_time: str + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'expiry_time': {'key': 'expiryTime', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyRotationPolicyAttributes, self).__init__(**kwargs) + self.created = None + self.updated = None + self.expiry_time = kwargs.get('expiry_time', None) + + +class LifetimeAction(msrest.serialization.Model): + """LifetimeAction. + + :param trigger: The trigger of key rotation policy lifetimeAction. + :type trigger: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Trigger + :param action: The action of key rotation policy lifetimeAction. + :type action: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Action + """ + + _attribute_map = { + 'trigger': {'key': 'trigger', 'type': 'Trigger'}, + 'action': {'key': 'action', 'type': 'Action'}, + } + + def __init__( + self, + **kwargs + ): + super(LifetimeAction, self).__init__(**kwargs) + self.trigger = kwargs.get('trigger', None) + self.action = kwargs.get('action', None) + + +class LogSpecification(msrest.serialization.Model): + """Log specification of operation. + + :param name: Name of log specification. + :type name: str + :param display_name: Display name of log specification. + :type display_name: str + :param blob_duration: Blob duration of specification. + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.blob_duration = kwargs.get('blob_duration', None) + + +class ManagedHsmResource(msrest.serialization.Model): + """Managed HSM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param location: The supported Azure location where the managed HSM Pool should be created. + :type location: str + :param sku: SKU details. + :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the key vault + resource. + :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedHsmResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.sku = kwargs.get('sku', None) + self.tags = kwargs.get('tags', None) + self.system_data = None + + +class ManagedHsm(ManagedHsmResource): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param location: The supported Azure location where the managed HSM Pool should be created. + :type location: str + :param sku: SKU details. + :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the key vault + resource. + :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData + :param properties: Properties of the managed HSM. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ManagedHsmProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedHsm, self).__init__(**kwargs) + self.properties = kwargs.get('properties', None) + + +class ManagedHsmError(msrest.serialization.Model): + """The error exception. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: The server error. + :vartype error: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Error + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedHsmError, self).__init__(**kwargs) + self.error = None + + +class ManagedHsmListResult(msrest.serialization.Model): + """List of managed HSM Pools. + + :param value: The list of managed HSM Pools. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] + :param next_link: The URL to get the next set of managed HSM Pools. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagedHsm]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedHsmListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ManagedHsmProperties(msrest.serialization.Model): + """Properties of the managed HSM Pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the managed HSM pool. + :type tenant_id: str + :param initial_admin_object_ids: Array of initial administrators object ids for this managed + hsm pool. + :type initial_admin_object_ids: list[str] + :ivar hsm_uri: The URI of the managed hsm pool for performing operations on keys. + :vartype hsm_uri: str + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this managed HSM pool. If it's not set to any value(true or false) when creating + new managed HSM pool, it will be set to true by default. Once set to true, it cannot be + reverted to false. + :type enable_soft_delete: bool + :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :type soft_delete_retention_in_days: int + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this managed HSM pool. Setting this property to true activates protection against purge for + this managed HSM pool and its content - only the Managed HSM service may initiate a hard, + irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling + this functionality is irreversible. + :type enable_purge_protection: bool + :param create_mode: The create mode to indicate whether the resource is being created or is + being recovered from a deleted resource. Possible values include: "recover", "default". + :type create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode + :ivar status_message: Resource Status Message. + :vartype status_message: str + :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", + "Provisioning", "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", + "Restoring". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.ProvisioningState + :param network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :type network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMNetworkRuleSet + :ivar private_endpoint_connections: List of private endpoint connections associated with the + managed hsm pool. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionItem] + :param public_network_access: Control permission for data plane traffic coming from public + networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PublicNetworkAccess + :ivar scheduled_purge_date: The scheduled purge date in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + """ + + _validation = { + 'hsm_uri': {'readonly': True}, + 'status_message': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'initial_admin_object_ids': {'key': 'initialAdminObjectIds', 'type': '[str]'}, + 'hsm_uri': {'key': 'hsmUri', 'type': 'str'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'network_acls': {'key': 'networkAcls', 'type': 'MHSMNetworkRuleSet'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[MHSMPrivateEndpointConnectionItem]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedHsmProperties, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.initial_admin_object_ids = kwargs.get('initial_admin_object_ids', None) + self.hsm_uri = None + self.enable_soft_delete = kwargs.get('enable_soft_delete', True) + self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', 90) + self.enable_purge_protection = kwargs.get('enable_purge_protection', True) + self.create_mode = kwargs.get('create_mode', None) + self.status_message = None + self.provisioning_state = None + self.network_acls = kwargs.get('network_acls', None) + self.private_endpoint_connections = None + self.public_network_access = kwargs.get('public_network_access', None) + self.scheduled_purge_date = None + + +class ManagedHsmSku(msrest.serialization.Model): + """SKU details. + + All required parameters must be populated in order to send to Azure. + + :param family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :type family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuFamily + :param name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + "Custom_B32". + :type name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuName + """ + + _validation = { + 'family': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedHsmSku, self).__init__(**kwargs) + self.family = kwargs.get('family', "B") + self.name = kwargs['name'] + + +class MetricSpecification(msrest.serialization.Model): + """Metric specification of operation. + + :param name: Name of metric specification. + :type name: str + :param display_name: Display name of metric specification. + :type display_name: str + :param display_description: Display description of metric specification. + :type display_description: str + :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :type unit: str + :param aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :type aggregation_type: str + :param supported_aggregation_types: The supported aggregation types for the metrics. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: The supported time grain types for the metrics. + :type supported_time_grain_types: list[str] + :param lock_aggregation_type: The metric lock aggregation type. + :type lock_aggregation_type: str + :param dimensions: The dimensions of metric. + :type dimensions: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DimensionProperties] + :param fill_gap_with_zero: Property to specify whether to fill gap with zero. + :type fill_gap_with_zero: bool + :param internal_metric_name: The internal metric name. + :type internal_metric_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.display_description = kwargs.get('display_description', None) + self.unit = kwargs.get('unit', None) + self.aggregation_type = kwargs.get('aggregation_type', None) + self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) + self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) + self.lock_aggregation_type = kwargs.get('lock_aggregation_type', None) + self.dimensions = kwargs.get('dimensions', None) + self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) + self.internal_metric_name = kwargs.get('internal_metric_name', None) + + +class MHSMIPRule(msrest.serialization.Model): + """A rule governing the accessibility of a managed hsm pool from a specific ip address or ip range. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + :type value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MHSMIPRule, self).__init__(**kwargs) + self.value = kwargs['value'] + + +class MHSMNetworkRuleSet(msrest.serialization.Model): + """A set of rules governing the network accessibility of a managed hsm pool. + + :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + 'None'. If not specified the default is 'AzureServices'. Possible values include: + "AzureServices", "None". + :type bypass: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions + :param default_action: The default action when no rule from ipRules and from + virtualNetworkRules match. This is only used after the bypass property has been evaluated. + Possible values include: "Allow", "Deny". + :type default_action: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMIPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMVirtualNetworkRule] + """ + + _attribute_map = { + 'bypass': {'key': 'bypass', 'type': 'str'}, + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'ip_rules': {'key': 'ipRules', 'type': '[MHSMIPRule]'}, + 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[MHSMVirtualNetworkRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(MHSMNetworkRuleSet, self).__init__(**kwargs) + self.bypass = kwargs.get('bypass', None) + self.default_action = kwargs.get('default_action', None) + self.ip_rules = kwargs.get('ip_rules', None) + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + + +class MHSMPrivateEndpoint(msrest.serialization.Model): + """Private endpoint object properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full identifier of the private endpoint resource. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MHSMPrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class MHSMPrivateEndpointConnection(ManagedHsmResource): + """Private endpoint connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param location: The supported Azure location where the managed HSM Pool should be created. + :type location: str + :param sku: SKU details. + :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the key vault + resource. + :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState + :param provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MHSMPrivateEndpointConnection, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): + """Private endpoint connection item. + + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState + :param provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _attribute_map = { + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MHSMPrivateEndpointConnectionItem, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class MHSMPrivateEndpointConnectionsListResult(msrest.serialization.Model): + """List of private endpoint connections associated with a managed HSM Pools. + + :param value: The private endpoint connection associated with a managed HSM Pools. + :type value: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] + :param next_link: The URL to get the next set of managed HSM Pools. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MHSMPrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MHSMPrivateEndpointConnectionsListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class MHSMPrivateLinkResource(ManagedHsmResource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param location: The supported Azure location where the managed HSM Pool should be created. + :type location: str + :param sku: SKU details. + :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the key vault + resource. + :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData + :ivar group_id: Group identifier of private link resource. + :vartype group_id: str + :ivar required_members: Required member names of private link resource. + :vartype required_members: list[str] + :param required_zone_names: Required DNS zone names of the the private link resource. + :type required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(MHSMPrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class MHSMPrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :param value: Array of private link resources. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MHSMPrivateLinkResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(MHSMPrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): + """An object that represents the approval state of the private link connection. + + :param status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval or rejection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None". + :type actions_required: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MHSMPrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = kwargs.get('actions_required', None) + + +class MHSMVirtualNetworkRule(msrest.serialization.Model): + """A rule governing the accessibility of a managed hsm pool from a specific virtual network. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MHSMVirtualNetworkRule, self).__init__(**kwargs) + self.id = kwargs['id'] + + +class NetworkRuleSet(msrest.serialization.Model): + """A set of rules governing the network accessibility of a vault. + + :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + 'None'. If not specified the default is 'AzureServices'. Possible values include: + "AzureServices", "None". + :type bypass: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions + :param default_action: The default action when no rule from ipRules and from + virtualNetworkRules match. This is only used after the bypass property has been evaluated. + Possible values include: "Allow", "Deny". + :type default_action: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.IPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.VirtualNetworkRule] + """ + + _attribute_map = { + 'bypass': {'key': 'bypass', 'type': 'str'}, + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, + 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.bypass = kwargs.get('bypass', None) + self.default_action = kwargs.get('default_action', None) + self.ip_rules = kwargs.get('ip_rules', None) + self.virtual_network_rules = kwargs.get('virtual_network_rules', None) + + +class Operation(msrest.serialization.Model): + """Key Vault REST API operation definition. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: Display metadata associated with the operation. + :type display: ~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationDisplay + :param origin: The origin of operations. + :type origin: str + :param is_data_action: Property to specify whether the action is a data action. + :type is_data_action: bool + :param service_specification: One property of operation, include metric specifications. + :type service_specification: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.ServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.service_specification = kwargs.get('service_specification', None) + + +class OperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :param provider: Service provider: Microsoft Key Vault. + :type provider: str + :param resource: Resource on which the operation is performed etc. + :type resource: str + :param operation: Type of operation: get, read, delete, etc. + :type operation: str + :param description: Description of operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Storage operations supported by the Storage resource provider. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Operation] + :param next_link: The URL to get the next set of operations. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class Permissions(msrest.serialization.Model): + """Permissions the identity has for keys, secrets, certificates and storage. + + :param keys: Permissions to keys. + :type keys: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.StoragePermissions] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + 'secrets': {'key': 'secrets', 'type': '[str]'}, + 'certificates': {'key': 'certificates', 'type': '[str]'}, + 'storage': {'key': 'storage', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(Permissions, self).__init__(**kwargs) + self.keys = kwargs.get('keys', None) + self.secrets = kwargs.get('secrets', None) + self.certificates = kwargs.get('certificates', None) + self.storage = kwargs.get('storage', None) + + +class PrivateEndpoint(msrest.serialization.Model): + """Private endpoint object properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full identifier of the private endpoint resource. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """Private endpoint connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState + :param provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.etag = kwargs.get('etag', None) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class PrivateEndpointConnectionItem(msrest.serialization.Model): + """Private endpoint connection item. + + :param id: Id of private endpoint connection. + :type id: str + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState + :param provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionItem, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.etag = kwargs.get('etag', None) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connections. + + :param value: The list of private endpoint connections. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] + :param next_link: The URL to get the next set of private endpoint connections. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :ivar group_id: Group identifier of private link resource. + :vartype group_id: str + :ivar required_members: Required member names of private link resource. + :vartype required_members: list[str] + :param required_zone_names: Required DNS zone names of the the private link resource. + :type required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :param value: Array of private link resources. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """An object that represents the approval state of the private link connection. + + :param status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval or rejection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None". + :type actions_required: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = kwargs.get('actions_required', None) + + +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Resource] + :param next_link: The URL to get the next set of vault resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Resource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class RotationPolicy(msrest.serialization.Model): + """RotationPolicy. + + :param attributes: The attributes of key rotation policy. + :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyAttributes + :param lifetime_actions: The lifetimeActions for key rotation action. + :type lifetime_actions: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.LifetimeAction] + """ + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': 'KeyRotationPolicyAttributes'}, + 'lifetime_actions': {'key': 'lifetimeActions', 'type': '[LifetimeAction]'}, + } + + def __init__( + self, + **kwargs + ): + super(RotationPolicy, self).__init__(**kwargs) + self.attributes = kwargs.get('attributes', None) + self.lifetime_actions = kwargs.get('lifetime_actions', None) + + +class Secret(Resource): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :param properties: Required. Properties of the secret. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'SecretProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(Secret, self).__init__(**kwargs) + self.properties = kwargs['properties'] + + +class SecretAttributes(Attributes): + """The secret management attributes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: ~datetime.datetime + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: ~datetime.datetime + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: ~datetime.datetime + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'unix-time'}, + 'expires': {'key': 'exp', 'type': 'unix-time'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, + } + + def __init__( + self, + **kwargs + ): + super(SecretAttributes, self).__init__(**kwargs) + + +class SecretCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters for creating or updating a secret. + + All required parameters must be populated in order to send to Azure. + + :param tags: A set of tags. The tags that will be assigned to the secret. + :type tags: dict[str, str] + :param properties: Required. Properties of the secret. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'SecretProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(SecretCreateOrUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.properties = kwargs['properties'] + + +class SecretListResult(msrest.serialization.Model): + """List of secrets. + + :param value: The list of secrets. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret] + :param next_link: The URL to get the next set of secrets. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Secret]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SecretListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class SecretPatchParameters(msrest.serialization.Model): + """Parameters for patching a secret. + + :param tags: A set of tags. The tags that will be assigned to the secret. + :type tags: dict[str, str] + :param properties: Properties of the secret. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPatchProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'SecretPatchProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(SecretPatchParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class SecretPatchProperties(msrest.serialization.Model): + """Properties of the secret. + + :param value: The value of the secret. + :type value: str + :param content_type: The content type of the secret. + :type content_type: str + :param attributes: The attributes of the secret. + :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretAttributes + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, + } + + def __init__( + self, + **kwargs + ): + super(SecretPatchProperties, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.content_type = kwargs.get('content_type', None) + self.attributes = kwargs.get('attributes', None) + + +class SecretProperties(msrest.serialization.Model): + """Properties of the secret. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The value of the secret. NOTE: 'value' will never be returned from the service, + as APIs using this model are is intended for internal use in ARM deployments. Users should use + the data-plane REST service for interaction with vault secrets. + :type value: str + :param content_type: The content type of the secret. + :type content_type: str + :param attributes: The attributes of the secret. + :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretAttributes + :ivar secret_uri: The URI to retrieve the current version of the secret. + :vartype secret_uri: str + :ivar secret_uri_with_version: The URI to retrieve the specific version of the secret. + :vartype secret_uri_with_version: str + """ + + _validation = { + 'secret_uri': {'readonly': True}, + 'secret_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, + 'secret_uri': {'key': 'secretUri', 'type': 'str'}, + 'secret_uri_with_version': {'key': 'secretUriWithVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SecretProperties, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.content_type = kwargs.get('content_type', None) + self.attributes = kwargs.get('attributes', None) + self.secret_uri = None + self.secret_uri_with_version = None + + +class ServiceSpecification(msrest.serialization.Model): + """One property of operation, include log specifications. + + :param log_specifications: Log specifications of operation. + :type log_specifications: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.LogSpecification] + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = kwargs.get('log_specifications', None) + self.metric_specifications = kwargs.get('metric_specifications', None) + + +class Sku(msrest.serialization.Model): + """SKU details. + + All required parameters must be populated in order to send to Azure. + + :param family: Required. SKU family name. Possible values include: "A". + :type family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuFamily + :param name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: "standard", "premium". + :type name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuName + """ + + _validation = { + 'family': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.family = kwargs.get('family', "A") + self.name = kwargs['name'] + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the key vault resource. + + :param created_by: The identity that created the key vault resource. + :type created_by: str + :param created_by_type: The type of identity that created the key vault resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType + :param created_at: The timestamp of the key vault resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the key vault resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the key vault resource. + Possible values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType + :param last_modified_at: The timestamp of the key vault resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class Trigger(msrest.serialization.Model): + """Trigger. + + :param time_after_create: The time duration after key creation to rotate the key. It only + applies to rotate. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + :type time_after_create: str + :param time_before_expiry: The time duration before key expiring to rotate or notify. It will + be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + :type time_before_expiry: str + """ + + _attribute_map = { + 'time_after_create': {'key': 'timeAfterCreate', 'type': 'str'}, + 'time_before_expiry': {'key': 'timeBeforeExpiry', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Trigger, self).__init__(**kwargs) + self.time_after_create = kwargs.get('time_after_create', None) + self.time_before_expiry = kwargs.get('time_before_expiry', None) + + +class Vault(msrest.serialization.Model): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :param location: Azure location of the key vault resource. + :type location: str + :param tags: A set of tags. Tags assigned to the key vault resource. + :type tags: dict[str, str] + :ivar system_data: System metadata for the key vault. + :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData + :param properties: Required. Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'VaultProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(Vault, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.system_data = None + self.properties = kwargs['properties'] + + +class VaultAccessPolicyParameters(msrest.serialization.Model): + """Parameters for updating the access policy in a vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource id of the access policy. + :vartype id: str + :ivar name: The resource name of the access policy. + :vartype name: str + :ivar type: The resource name of the access policy. + :vartype type: str + :ivar location: The resource type of the access policy. + :vartype location: str + :param properties: Required. Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultAccessPolicyParameters, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.properties = kwargs['properties'] + + +class VaultAccessPolicyProperties(msrest.serialization.Model): + """Properties of the vault access policy. + + All required parameters must be populated in order to send to Azure. + + :param access_policies: Required. An array of 0 to 16 identities 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. + :type access_policies: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] + """ + + _validation = { + 'access_policies': {'required': True}, + } + + _attribute_map = { + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultAccessPolicyProperties, self).__init__(**kwargs) + self.access_policies = kwargs['access_policies'] + + +class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): + """The parameters used to check the availability of the vault name. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The vault name. + :type name: str + :ivar type: The type of resource, Microsoft.KeyVault/vaults. Has constant value: + "Microsoft.KeyVault/vaults". + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.KeyVault/vaults" + + def __init__( + self, + **kwargs + ): + super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class VaultCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters for creating or updating a vault. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The supported Azure location where the key vault should be created. + :type location: str + :param tags: A set of tags. The tags that will be assigned to the key vault. + :type tags: dict[str, str] + :param properties: Required. Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProperties + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'VaultProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + self.properties = kwargs['properties'] + + +class VaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of vaults. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] + :param next_link: The URL to get the next set of vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Vault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class VaultPatchParameters(msrest.serialization.Model): + """Parameters for creating or updating a vault. + + :param tags: A set of tags. The tags that will be assigned to the key vault. + :type tags: dict[str, str] + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultPatchProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultPatchParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class VaultPatchProperties(msrest.serialization.Model): + """Properties of the vault. + + :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. + :type tenant_id: str + :param sku: SKU details. + :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Sku + :param access_policies: An array of 0 to 16 identities 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. + :type access_policies: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. + :type enabled_for_deployment: bool + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :type enabled_for_disk_encryption: bool + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :type enabled_for_template_deployment: bool + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. Once set to true, it cannot be reverted to false. + :type enable_soft_delete: bool + :param enable_rbac_authorization: Property that controls how data actions are authorized. When + true, the key vault will use Role Based Access Control (RBAC) for authorization of data + actions, and the access policies specified in vault properties will be ignored (warning: this + is a preview feature). When false, the key vault will use the access policies specified in + vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or + not specified, the value of this property will not change. + :type enable_rbac_authorization: bool + :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :type soft_delete_retention_in_days: int + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: "recover", "default". + :type create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. + :type enable_purge_protection: bool + :param network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. + :type network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet + :param public_network_access: Property to specify whether the vault will accept traffic from + public internet. If set to 'disabled' all traffic except private endpoint traffic and that that + originates from trusted services will be blocked. This will override the set firewall rules, + meaning that even if the firewall rules are present we will not honor the rules. + :type public_network_access: str + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, + 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, + 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultPatchProperties, self).__init__(**kwargs) + self.tenant_id = kwargs.get('tenant_id', None) + self.sku = kwargs.get('sku', None) + self.access_policies = kwargs.get('access_policies', None) + self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) + self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) + self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) + self.enable_soft_delete = kwargs.get('enable_soft_delete', None) + self.enable_rbac_authorization = kwargs.get('enable_rbac_authorization', None) + self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', None) + self.create_mode = kwargs.get('create_mode', None) + self.enable_purge_protection = kwargs.get('enable_purge_protection', None) + self.network_acls = kwargs.get('network_acls', None) + self.public_network_access = kwargs.get('public_network_access', None) + + +class VaultProperties(msrest.serialization.Model): + """Properties of the vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + 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 sku: Required. SKU details. + :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Sku + :param access_policies: An array of 0 to 1024 identities 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. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :type access_policies: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] + :param vault_uri: The URI of the vault for performing operations on keys and secrets. + :type vault_uri: str + :ivar hsm_pool_resource_id: The resource id of HSM Pool. + :vartype hsm_pool_resource_id: str + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. + :type enabled_for_deployment: bool + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :type enabled_for_disk_encryption: bool + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :type enabled_for_template_deployment: bool + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. If it's not set to any value(true or false) when creating new key + vault, it will be set to true by default. Once set to true, it cannot be reverted to false. + :type enable_soft_delete: bool + :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :type soft_delete_retention_in_days: int + :param enable_rbac_authorization: Property that controls how data actions are authorized. When + true, the key vault will use Role Based Access Control (RBAC) for authorization of data + actions, and the access policies specified in vault properties will be ignored (warning: this + is a preview feature). When false, the key vault will use the access policies specified in + vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or + not specified, the vault is created with the default value of false. Note that management + actions are always authorized with RBAC. + :type enable_rbac_authorization: bool + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: "recover", "default". + :type create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. + :type enable_purge_protection: bool + :param network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :type network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet + :param provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProvisioningState + :ivar private_endpoint_connections: List of private endpoint connections associated with the + key vault. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionItem] + :param public_network_access: Property to specify whether the vault will accept traffic from + public internet. If set to 'disabled' all traffic except private endpoint traffic and that that + originates from trusted services will be blocked. This will override the set firewall rules, + meaning that even if the firewall rules are present we will not honor the rules. + :type public_network_access: str + """ + + _validation = { + 'tenant_id': {'required': True}, + 'sku': {'required': True}, + 'hsm_pool_resource_id': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'hsm_pool_resource_id': {'key': 'hsmPoolResourceId', 'type': 'str'}, + 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, + 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, + 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultProperties, self).__init__(**kwargs) + self.tenant_id = kwargs['tenant_id'] + self.sku = kwargs['sku'] + self.access_policies = kwargs.get('access_policies', None) + self.vault_uri = kwargs.get('vault_uri', None) + self.hsm_pool_resource_id = None + self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) + self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) + self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) + self.enable_soft_delete = kwargs.get('enable_soft_delete', True) + self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', 90) + self.enable_rbac_authorization = kwargs.get('enable_rbac_authorization', False) + self.create_mode = kwargs.get('create_mode', None) + self.enable_purge_protection = kwargs.get('enable_purge_protection', None) + self.network_acls = kwargs.get('network_acls', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + self.private_endpoint_connections = None + self.public_network_access = kwargs.get('public_network_access', "enabled") + + +class VirtualNetworkRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific virtual network. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :type id: str + :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + check if parent subnet has serviceEndpoints configured. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = kwargs['id'] + self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models_py3.py new file mode 100644 index 0000000000000..4817f37814508 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models_py3.py @@ -0,0 +1,3148 @@ +# 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. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._key_vault_management_client_enums import * + + +class AccessPolicyEntry(msrest.serialization.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.v2021_06_01_preview.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: "Permissions", + application_id: Optional[str] = None, + **kwargs + ): + super(AccessPolicyEntry, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.object_id = object_id + self.application_id = application_id + self.permissions = permissions + + +class Action(msrest.serialization.Model): + """Action. + + :param type: The type of action. Possible values include: "rotate", "notify". + :type type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyActionType + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "KeyRotationPolicyActionType"]] = None, + **kwargs + ): + super(Action, self).__init__(**kwargs) + self.type = type + + +class Attributes(msrest.serialization.Model): + """The object attributes managed by the KeyVault service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: ~datetime.datetime + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: ~datetime.datetime + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: ~datetime.datetime + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'unix-time'}, + 'expires': {'key': 'exp', 'type': 'unix-time'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): + super(Attributes, self).__init__(**kwargs) + self.enabled = enabled + self.not_before = not_before + self.expires = expires + self.created = None + self.updated = None + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """The CheckNameAvailability operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: A boolean value that indicates whether the name is available for you to + use. If true, the name is available. If false, the name has already been taken or is invalid + and cannot be used. + :vartype name_available: bool + :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.v2021_06_01_preview.models.Reason + :ivar message: An error message explaining the Reason value in more detail. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from Key Vault resource provider. + + :param code: Error code. This is a mnemonic that can be consumed programmatically. + :type code: str + :param message: User friendly error message. The message is typically localized and may vary + with service version. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + + +class DeletedManagedHsm(msrest.serialization.Model): + """DeletedManagedHsm. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the deleted managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param properties: Properties of the deleted managed HSM. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeletedManagedHsmProperties'}, + } + + def __init__( + self, + *, + properties: Optional["DeletedManagedHsmProperties"] = None, + **kwargs + ): + super(DeletedManagedHsm, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class DeletedManagedHsmListResult(msrest.serialization.Model): + """List of deleted managed HSM Pools. + + :param value: The list of deleted managed HSM Pools. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsm] + :param next_link: The URL to get the next set of deleted managed HSM Pools. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedManagedHsm]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeletedManagedHsm"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DeletedManagedHsmListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeletedManagedHsmProperties(msrest.serialization.Model): + """Properties of the deleted managed HSM. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar mhsm_id: The resource id of the original managed HSM. + :vartype mhsm_id: str + :ivar location: The location of the original managed HSM. + :vartype location: str + :ivar deletion_date: The deleted date. + :vartype deletion_date: ~datetime.datetime + :ivar scheduled_purge_date: The scheduled purged date. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar purge_protection_enabled: Purge protection status of the original managed HSM. + :vartype purge_protection_enabled: bool + :ivar tags: A set of tags. Tags of the original managed HSM. + :vartype tags: dict[str, str] + """ + + _validation = { + 'mhsm_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'mhsm_id': {'key': 'mhsmId', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedManagedHsmProperties, self).__init__(**kwargs) + self.mhsm_id = None + self.location = None + self.deletion_date = None + self.scheduled_purge_date = None + self.purge_protection_enabled = None + self.tags = None + + +class DeletedVault(msrest.serialization.Model): + """Deleted vault information with extended details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID for the deleted key vault. + :vartype id: str + :ivar name: The name of the key vault. + :vartype name: str + :ivar type: The resource type of the key vault. + :vartype type: str + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, + } + + def __init__( + self, + *, + properties: Optional["DeletedVaultProperties"] = None, + **kwargs + ): + super(DeletedVault, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class DeletedVaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of deleted vaults. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVault] + :param next_link: The URL to get the next set of deleted vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedVault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["DeletedVault"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(DeletedVaultListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeletedVaultProperties(msrest.serialization.Model): + """Properties of the deleted vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar vault_id: The resource id of the original vault. + :vartype vault_id: str + :ivar location: The location of the original vault. + :vartype location: str + :ivar deletion_date: The deleted date. + :vartype deletion_date: ~datetime.datetime + :ivar scheduled_purge_date: The scheduled purged date. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar tags: A set of tags. Tags of the original vault. + :vartype tags: dict[str, str] + :ivar purge_protection_enabled: Purge protection status of the original vault. + :vartype purge_protection_enabled: bool + """ + + _validation = { + 'vault_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, + } + + _attribute_map = { + 'vault_id': {'key': 'vaultId', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(DeletedVaultProperties, self).__init__(**kwargs) + self.vault_id = None + self.location = None + self.deletion_date = None + self.scheduled_purge_date = None + self.tags = None + self.purge_protection_enabled = None + + +class DimensionProperties(msrest.serialization.Model): + """Type of operation: get, read, delete, etc. + + :param name: Name of dimension. + :type name: str + :param display_name: Display name of dimension. + :type display_name: str + :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported + for Shoebox. + :type to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): + super(DimensionProperties, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox + + +class Error(msrest.serialization.Model): + """The server error. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar inner_error: The inner error, contains a more specific error code. + :vartype inner_error: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Error + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'inner_error': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'inner_error': {'key': 'innererror', 'type': 'Error'}, + } + + def __init__( + self, + **kwargs + ): + super(Error, self).__init__(**kwargs) + self.code = None + self.message = None + self.inner_error = None + + +class IPRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific ip address or ip range. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + :type value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + value: str, + **kwargs + ): + super(IPRule, self).__init__(**kwargs) + self.value = value + + +class Resource(msrest.serialization.Model): + """Key Vault resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + + +class Key(Resource): + """The key resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :param attributes: The attributes of the key. + :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes + :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM". + :type kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + values include: "P-256", "P-384", "P-521", "P-256K". + :type curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of the key. + :vartype key_uri_with_version: str + :param rotation_policy: Key rotation policy in response. It will be used for both output and + input. Omitted if empty. + :type rotation_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.RotationPolicy + :param release_policy: Key release policy in response. It will be used for both output and + input. Omitted if empty. + :type release_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyReleasePolicy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'attributes': {'key': 'properties.attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'properties.kty', 'type': 'str'}, + 'key_ops': {'key': 'properties.keyOps', 'type': '[str]'}, + 'key_size': {'key': 'properties.keySize', 'type': 'int'}, + 'curve_name': {'key': 'properties.curveName', 'type': 'str'}, + 'key_uri': {'key': 'properties.keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'properties.keyUriWithVersion', 'type': 'str'}, + 'rotation_policy': {'key': 'properties.rotationPolicy', 'type': 'RotationPolicy'}, + 'release_policy': {'key': 'properties.release_policy', 'type': 'KeyReleasePolicy'}, + } + + def __init__( + self, + *, + attributes: Optional["KeyAttributes"] = None, + kty: Optional[Union[str, "JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + key_size: Optional[int] = None, + curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + rotation_policy: Optional["RotationPolicy"] = None, + release_policy: Optional["KeyReleasePolicy"] = None, + **kwargs + ): + super(Key, self).__init__(**kwargs) + self.attributes = attributes + self.kty = kty + self.key_ops = key_ops + self.key_size = key_size + self.curve_name = curve_name + self.key_uri = None + self.key_uri_with_version = None + self.rotation_policy = rotation_policy + self.release_policy = release_policy + + +class KeyAttributes(msrest.serialization.Model): + """The object attributes managed by the Azure Key Vault service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether or not the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: long + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: long + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :ivar recovery_level: The deletion recovery level currently in effect for the object. If it + contains 'Purgeable', then the object can be permanently deleted by a privileged user; + otherwise, only the system can purge the object at the end of the retention interval. Possible + values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletionRecoveryLevel + :param exportable: Indicates if the private key can be exported. + :type exportable: bool + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'recovery_level': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'long'}, + 'expires': {'key': 'exp', 'type': 'long'}, + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + 'exportable': {'key': 'exportable', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[int] = None, + expires: Optional[int] = None, + exportable: Optional[bool] = None, + **kwargs + ): + super(KeyAttributes, self).__init__(**kwargs) + self.enabled = enabled + self.not_before = not_before + self.expires = expires + self.created = None + self.updated = None + self.recovery_level = None + self.exportable = exportable + + +class KeyCreateParameters(msrest.serialization.Model): + """The parameters used to create a key. + + All required parameters must be populated in order to send to Azure. + + :param tags: A set of tags. The tags that will be assigned to the key. + :type tags: dict[str, str] + :param properties: Required. The properties of the key to be created. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'KeyProperties'}, + } + + def __init__( + self, + *, + properties: "KeyProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(KeyCreateParameters, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class KeyListResult(msrest.serialization.Model): + """The page of keys. + + :param value: The key resources. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Key] + :param next_link: The URL to get the next page of keys. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Key]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Key"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(KeyListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class KeyProperties(msrest.serialization.Model): + """The properties of the key. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param attributes: The attributes of the key. + :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes + :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + "EC", "EC-HSM", "RSA", "RSA-HSM". + :type kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] + :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :type key_size: int + :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + values include: "P-256", "P-384", "P-521", "P-256K". + :type curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of the key. + :vartype key_uri_with_version: str + :param rotation_policy: Key rotation policy in response. It will be used for both output and + input. Omitted if empty. + :type rotation_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.RotationPolicy + :param release_policy: Key release policy in response. It will be used for both output and + input. Omitted if empty. + :type release_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyReleasePolicy + """ + + _validation = { + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'kty', 'type': 'str'}, + 'key_ops': {'key': 'keyOps', 'type': '[str]'}, + 'key_size': {'key': 'keySize', 'type': 'int'}, + 'curve_name': {'key': 'curveName', 'type': 'str'}, + 'key_uri': {'key': 'keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'keyUriWithVersion', 'type': 'str'}, + 'rotation_policy': {'key': 'rotationPolicy', 'type': 'RotationPolicy'}, + 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, + } + + def __init__( + self, + *, + attributes: Optional["KeyAttributes"] = None, + kty: Optional[Union[str, "JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + key_size: Optional[int] = None, + curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + rotation_policy: Optional["RotationPolicy"] = None, + release_policy: Optional["KeyReleasePolicy"] = None, + **kwargs + ): + super(KeyProperties, self).__init__(**kwargs) + self.attributes = attributes + self.kty = kty + self.key_ops = key_ops + self.key_size = key_size + self.curve_name = curve_name + self.key_uri = None + self.key_uri_with_version = None + self.rotation_policy = rotation_policy + self.release_policy = release_policy + + +class KeyReleasePolicy(msrest.serialization.Model): + """KeyReleasePolicy. + + :param content_type: Content type and version of key release policy. + :type content_type: str + :param data: Blob encoding the policy rules under which the key can be released. + :type data: bytes + """ + + _attribute_map = { + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'data': {'key': 'data', 'type': 'base64'}, + } + + def __init__( + self, + *, + content_type: Optional[str] = "application/json; charset=utf-8", + data: Optional[bytes] = None, + **kwargs + ): + super(KeyReleasePolicy, self).__init__(**kwargs) + self.content_type = content_type + self.data = data + + +class KeyRotationPolicyAttributes(msrest.serialization.Model): + """KeyRotationPolicyAttributes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :param expiry_time: The expiration time for the new key version. It should be in ISO8601 + format. Eg: 'P90D', 'P1Y'. + :type expiry_time: str + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'expiry_time': {'key': 'expiryTime', 'type': 'str'}, + } + + def __init__( + self, + *, + expiry_time: Optional[str] = None, + **kwargs + ): + super(KeyRotationPolicyAttributes, self).__init__(**kwargs) + self.created = None + self.updated = None + self.expiry_time = expiry_time + + +class LifetimeAction(msrest.serialization.Model): + """LifetimeAction. + + :param trigger: The trigger of key rotation policy lifetimeAction. + :type trigger: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Trigger + :param action: The action of key rotation policy lifetimeAction. + :type action: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Action + """ + + _attribute_map = { + 'trigger': {'key': 'trigger', 'type': 'Trigger'}, + 'action': {'key': 'action', 'type': 'Action'}, + } + + def __init__( + self, + *, + trigger: Optional["Trigger"] = None, + action: Optional["Action"] = None, + **kwargs + ): + super(LifetimeAction, self).__init__(**kwargs) + self.trigger = trigger + self.action = action + + +class LogSpecification(msrest.serialization.Model): + """Log specification of operation. + + :param name: Name of log specification. + :type name: str + :param display_name: Display name of log specification. + :type display_name: str + :param blob_duration: Blob duration of specification. + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class ManagedHsmResource(msrest.serialization.Model): + """Managed HSM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param location: The supported Azure location where the managed HSM Pool should be created. + :type location: str + :param sku: SKU details. + :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the key vault + resource. + :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + sku: Optional["ManagedHsmSku"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ManagedHsmResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.sku = sku + self.tags = tags + self.system_data = None + + +class ManagedHsm(ManagedHsmResource): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param location: The supported Azure location where the managed HSM Pool should be created. + :type location: str + :param sku: SKU details. + :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the key vault + resource. + :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData + :param properties: Properties of the managed HSM. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ManagedHsmProperties'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + sku: Optional["ManagedHsmSku"] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["ManagedHsmProperties"] = None, + **kwargs + ): + super(ManagedHsm, self).__init__(location=location, sku=sku, tags=tags, **kwargs) + self.properties = properties + + +class ManagedHsmError(msrest.serialization.Model): + """The error exception. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: The server error. + :vartype error: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Error + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedHsmError, self).__init__(**kwargs) + self.error = None + + +class ManagedHsmListResult(msrest.serialization.Model): + """List of managed HSM Pools. + + :param value: The list of managed HSM Pools. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] + :param next_link: The URL to get the next set of managed HSM Pools. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagedHsm]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ManagedHsm"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ManagedHsmListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ManagedHsmProperties(msrest.serialization.Model): + """Properties of the managed HSM Pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the managed HSM pool. + :type tenant_id: str + :param initial_admin_object_ids: Array of initial administrators object ids for this managed + hsm pool. + :type initial_admin_object_ids: list[str] + :ivar hsm_uri: The URI of the managed hsm pool for performing operations on keys. + :vartype hsm_uri: str + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this managed HSM pool. If it's not set to any value(true or false) when creating + new managed HSM pool, it will be set to true by default. Once set to true, it cannot be + reverted to false. + :type enable_soft_delete: bool + :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :type soft_delete_retention_in_days: int + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this managed HSM pool. Setting this property to true activates protection against purge for + this managed HSM pool and its content - only the Managed HSM service may initiate a hard, + irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling + this functionality is irreversible. + :type enable_purge_protection: bool + :param create_mode: The create mode to indicate whether the resource is being created or is + being recovered from a deleted resource. Possible values include: "recover", "default". + :type create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode + :ivar status_message: Resource Status Message. + :vartype status_message: str + :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", + "Provisioning", "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", + "Restoring". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.ProvisioningState + :param network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :type network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMNetworkRuleSet + :ivar private_endpoint_connections: List of private endpoint connections associated with the + managed hsm pool. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionItem] + :param public_network_access: Control permission for data plane traffic coming from public + networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PublicNetworkAccess + :ivar scheduled_purge_date: The scheduled purge date in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + """ + + _validation = { + 'hsm_uri': {'readonly': True}, + 'status_message': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'initial_admin_object_ids': {'key': 'initialAdminObjectIds', 'type': '[str]'}, + 'hsm_uri': {'key': 'hsmUri', 'type': 'str'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'network_acls': {'key': 'networkAcls', 'type': 'MHSMNetworkRuleSet'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[MHSMPrivateEndpointConnectionItem]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + initial_admin_object_ids: Optional[List[str]] = None, + enable_soft_delete: Optional[bool] = True, + soft_delete_retention_in_days: Optional[int] = 90, + enable_purge_protection: Optional[bool] = True, + create_mode: Optional[Union[str, "CreateMode"]] = None, + network_acls: Optional["MHSMNetworkRuleSet"] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + **kwargs + ): + super(ManagedHsmProperties, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.initial_admin_object_ids = initial_admin_object_ids + self.hsm_uri = None + self.enable_soft_delete = enable_soft_delete + self.soft_delete_retention_in_days = soft_delete_retention_in_days + self.enable_purge_protection = enable_purge_protection + self.create_mode = create_mode + self.status_message = None + self.provisioning_state = None + self.network_acls = network_acls + self.private_endpoint_connections = None + self.public_network_access = public_network_access + self.scheduled_purge_date = None + + +class ManagedHsmSku(msrest.serialization.Model): + """SKU details. + + All required parameters must be populated in order to send to Azure. + + :param family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :type family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuFamily + :param name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + "Custom_B32". + :type name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuName + """ + + _validation = { + 'family': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + family: Union[str, "ManagedHsmSkuFamily"] = "B", + name: Union[str, "ManagedHsmSkuName"], + **kwargs + ): + super(ManagedHsmSku, self).__init__(**kwargs) + self.family = family + self.name = name + + +class MetricSpecification(msrest.serialization.Model): + """Metric specification of operation. + + :param name: Name of metric specification. + :type name: str + :param display_name: Display name of metric specification. + :type display_name: str + :param display_description: Display description of metric specification. + :type display_description: str + :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :type unit: str + :param aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :type aggregation_type: str + :param supported_aggregation_types: The supported aggregation types for the metrics. + :type supported_aggregation_types: list[str] + :param supported_time_grain_types: The supported time grain types for the metrics. + :type supported_time_grain_types: list[str] + :param lock_aggregation_type: The metric lock aggregation type. + :type lock_aggregation_type: str + :param dimensions: The dimensions of metric. + :type dimensions: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DimensionProperties] + :param fill_gap_with_zero: Property to specify whether to fill gap with zero. + :type fill_gap_with_zero: bool + :param internal_metric_name: The internal metric name. + :type internal_metric_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + lock_aggregation_type: Optional[str] = None, + dimensions: Optional[List["DimensionProperties"]] = None, + fill_gap_with_zero: Optional[bool] = None, + internal_metric_name: Optional[str] = None, + **kwargs + ): + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.supported_aggregation_types = supported_aggregation_types + self.supported_time_grain_types = supported_time_grain_types + self.lock_aggregation_type = lock_aggregation_type + self.dimensions = dimensions + self.fill_gap_with_zero = fill_gap_with_zero + self.internal_metric_name = internal_metric_name + + +class MHSMIPRule(msrest.serialization.Model): + """A rule governing the accessibility of a managed hsm pool from a specific ip address or ip range. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + :type value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + value: str, + **kwargs + ): + super(MHSMIPRule, self).__init__(**kwargs) + self.value = value + + +class MHSMNetworkRuleSet(msrest.serialization.Model): + """A set of rules governing the network accessibility of a managed hsm pool. + + :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + 'None'. If not specified the default is 'AzureServices'. Possible values include: + "AzureServices", "None". + :type bypass: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions + :param default_action: The default action when no rule from ipRules and from + virtualNetworkRules match. This is only used after the bypass property has been evaluated. + Possible values include: "Allow", "Deny". + :type default_action: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMIPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMVirtualNetworkRule] + """ + + _attribute_map = { + 'bypass': {'key': 'bypass', 'type': 'str'}, + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'ip_rules': {'key': 'ipRules', 'type': '[MHSMIPRule]'}, + 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[MHSMVirtualNetworkRule]'}, + } + + def __init__( + self, + *, + bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "NetworkRuleAction"]] = None, + ip_rules: Optional[List["MHSMIPRule"]] = None, + virtual_network_rules: Optional[List["MHSMVirtualNetworkRule"]] = None, + **kwargs + ): + super(MHSMNetworkRuleSet, self).__init__(**kwargs) + self.bypass = bypass + self.default_action = default_action + self.ip_rules = ip_rules + self.virtual_network_rules = virtual_network_rules + + +class MHSMPrivateEndpoint(msrest.serialization.Model): + """Private endpoint object properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full identifier of the private endpoint resource. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MHSMPrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class MHSMPrivateEndpointConnection(ManagedHsmResource): + """Private endpoint connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param location: The supported Azure location where the managed HSM Pool should be created. + :type location: str + :param sku: SKU details. + :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the key vault + resource. + :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState + :param provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + sku: Optional["ManagedHsmSku"] = None, + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + private_endpoint: Optional["MHSMPrivateEndpoint"] = None, + private_link_service_connection_state: Optional["MHSMPrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + **kwargs + ): + super(MHSMPrivateEndpointConnection, self).__init__(location=location, sku=sku, tags=tags, **kwargs) + self.etag = etag + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): + """Private endpoint connection item. + + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState + :param provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _attribute_map = { + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["MHSMPrivateEndpoint"] = None, + private_link_service_connection_state: Optional["MHSMPrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + **kwargs + ): + super(MHSMPrivateEndpointConnectionItem, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class MHSMPrivateEndpointConnectionsListResult(msrest.serialization.Model): + """List of private endpoint connections associated with a managed HSM Pools. + + :param value: The private endpoint connection associated with a managed HSM Pools. + :type value: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] + :param next_link: The URL to get the next set of managed HSM Pools. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MHSMPrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["MHSMPrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(MHSMPrivateEndpointConnectionsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class MHSMPrivateLinkResource(ManagedHsmResource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :param location: The supported Azure location where the managed HSM Pool should be created. + :type location: str + :param sku: SKU details. + :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the key vault + resource. + :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData + :ivar group_id: Group identifier of private link resource. + :vartype group_id: str + :ivar required_members: Required member names of private link resource. + :vartype required_members: list[str] + :param required_zone_names: Required DNS zone names of the the private link resource. + :type required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + sku: Optional["ManagedHsmSku"] = None, + tags: Optional[Dict[str, str]] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(MHSMPrivateLinkResource, self).__init__(location=location, sku=sku, tags=tags, **kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class MHSMPrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :param value: Array of private link resources. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MHSMPrivateLinkResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["MHSMPrivateLinkResource"]] = None, + **kwargs + ): + super(MHSMPrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + + +class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): + """An object that represents the approval state of the private link connection. + + :param status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval or rejection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None". + :type actions_required: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[Union[str, "ActionsRequired"]] = None, + **kwargs + ): + super(MHSMPrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class MHSMVirtualNetworkRule(msrest.serialization.Model): + """A rule governing the accessibility of a managed hsm pool from a specific virtual network. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + super(MHSMVirtualNetworkRule, self).__init__(**kwargs) + self.id = id + + +class NetworkRuleSet(msrest.serialization.Model): + """A set of rules governing the network accessibility of a vault. + + :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + 'None'. If not specified the default is 'AzureServices'. Possible values include: + "AzureServices", "None". + :type bypass: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions + :param default_action: The default action when no rule from ipRules and from + virtualNetworkRules match. This is only used after the bypass property has been evaluated. + Possible values include: "Allow", "Deny". + :type default_action: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.IPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.VirtualNetworkRule] + """ + + _attribute_map = { + 'bypass': {'key': 'bypass', 'type': 'str'}, + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, + 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + } + + def __init__( + self, + *, + bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "NetworkRuleAction"]] = None, + ip_rules: Optional[List["IPRule"]] = None, + virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, + **kwargs + ): + super(NetworkRuleSet, self).__init__(**kwargs) + self.bypass = bypass + self.default_action = default_action + self.ip_rules = ip_rules + self.virtual_network_rules = virtual_network_rules + + +class Operation(msrest.serialization.Model): + """Key Vault REST API operation definition. + + :param name: Operation name: {provider}/{resource}/{operation}. + :type name: str + :param display: Display metadata associated with the operation. + :type display: ~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationDisplay + :param origin: The origin of operations. + :type origin: str + :param is_data_action: Property to specify whether the action is a data action. + :type is_data_action: bool + :param service_specification: One property of operation, include metric specifications. + :type service_specification: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.ServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + is_data_action: Optional[bool] = None, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + self.is_data_action = is_data_action + self.service_specification = service_specification + + +class OperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :param provider: Service provider: Microsoft Key Vault. + :type provider: str + :param resource: Resource on which the operation is performed etc. + :type resource: str + :param operation: Type of operation: get, read, delete, etc. + :type operation: str + :param description: Description of operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. + + :param value: List of Storage operations supported by the Storage resource provider. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Operation] + :param next_link: The URL to get the next set of operations. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Permissions(msrest.serialization.Model): + """Permissions the identity has for keys, secrets, certificates and storage. + + :param keys: Permissions to keys. + :type keys: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.StoragePermissions] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + 'secrets': {'key': 'secrets', 'type': '[str]'}, + 'certificates': {'key': 'certificates', 'type': '[str]'}, + 'storage': {'key': 'storage', 'type': '[str]'}, + } + + def __init__( + self, + *, + keys: Optional[List[Union[str, "KeyPermissions"]]] = None, + secrets: Optional[List[Union[str, "SecretPermissions"]]] = None, + certificates: Optional[List[Union[str, "CertificatePermissions"]]] = None, + storage: Optional[List[Union[str, "StoragePermissions"]]] = None, + **kwargs + ): + super(Permissions, self).__init__(**kwargs) + self.keys = keys + self.secrets = secrets + self.certificates = certificates + self.storage = storage + + +class PrivateEndpoint(msrest.serialization.Model): + """Private endpoint object properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full identifier of the private endpoint resource. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """Private endpoint connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState + :param provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.etag = etag + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class PrivateEndpointConnectionItem(msrest.serialization.Model): + """Private endpoint connection item. + + :param id: Id of private endpoint connection. + :type id: str + :param etag: Modified whenever there is a change in the state of private endpoint connection. + :type etag: str + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState + :param provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + etag: Optional[str] = None, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + **kwargs + ): + super(PrivateEndpointConnectionItem, self).__init__(**kwargs) + self.id = id + self.etag = etag + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connections. + + :param value: The list of private endpoint connections. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] + :param next_link: The URL to get the next set of private endpoint connections. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :ivar group_id: Group identifier of private link resource. + :vartype group_id: str + :ivar required_members: Required member names of private link resource. + :vartype required_members: list[str] + :param required_zone_names: Required DNS zone names of the the private link resource. + :type required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :param value: Array of private link resources. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """An object that represents the approval state of the private link connection. + + :param status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :type status: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval or rejection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None". + :type actions_required: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[Union[str, "ActionsRequired"]] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Resource] + :param next_link: The URL to get the next set of vault resources. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Resource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Resource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RotationPolicy(msrest.serialization.Model): + """RotationPolicy. + + :param attributes: The attributes of key rotation policy. + :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyAttributes + :param lifetime_actions: The lifetimeActions for key rotation action. + :type lifetime_actions: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.LifetimeAction] + """ + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': 'KeyRotationPolicyAttributes'}, + 'lifetime_actions': {'key': 'lifetimeActions', 'type': '[LifetimeAction]'}, + } + + def __init__( + self, + *, + attributes: Optional["KeyRotationPolicyAttributes"] = None, + lifetime_actions: Optional[List["LifetimeAction"]] = None, + **kwargs + ): + super(RotationPolicy, self).__init__(**kwargs) + self.attributes = attributes + self.lifetime_actions = lifetime_actions + + +class Secret(Resource): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :param properties: Required. Properties of the secret. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'SecretProperties'}, + } + + def __init__( + self, + *, + properties: "SecretProperties", + **kwargs + ): + super(Secret, self).__init__(**kwargs) + self.properties = properties + + +class SecretAttributes(Attributes): + """The secret management attributes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param enabled: Determines whether the object is enabled. + :type enabled: bool + :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :type not_before: ~datetime.datetime + :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :type expires: ~datetime.datetime + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: ~datetime.datetime + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'unix-time'}, + 'expires': {'key': 'exp', 'type': 'unix-time'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): + super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + + +class SecretCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters for creating or updating a secret. + + All required parameters must be populated in order to send to Azure. + + :param tags: A set of tags. The tags that will be assigned to the secret. + :type tags: dict[str, str] + :param properties: Required. Properties of the secret. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'SecretProperties'}, + } + + def __init__( + self, + *, + properties: "SecretProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(SecretCreateOrUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class SecretListResult(msrest.serialization.Model): + """List of secrets. + + :param value: The list of secrets. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret] + :param next_link: The URL to get the next set of secrets. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Secret]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Secret"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(SecretListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SecretPatchParameters(msrest.serialization.Model): + """Parameters for patching a secret. + + :param tags: A set of tags. The tags that will be assigned to the secret. + :type tags: dict[str, str] + :param properties: Properties of the secret. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPatchProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'SecretPatchProperties'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["SecretPatchProperties"] = None, + **kwargs + ): + super(SecretPatchParameters, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class SecretPatchProperties(msrest.serialization.Model): + """Properties of the secret. + + :param value: The value of the secret. + :type value: str + :param content_type: The content type of the secret. + :type content_type: str + :param attributes: The attributes of the secret. + :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretAttributes + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + content_type: Optional[str] = None, + attributes: Optional["SecretAttributes"] = None, + **kwargs + ): + super(SecretPatchProperties, self).__init__(**kwargs) + self.value = value + self.content_type = content_type + self.attributes = attributes + + +class SecretProperties(msrest.serialization.Model): + """Properties of the secret. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: The value of the secret. NOTE: 'value' will never be returned from the service, + as APIs using this model are is intended for internal use in ARM deployments. Users should use + the data-plane REST service for interaction with vault secrets. + :type value: str + :param content_type: The content type of the secret. + :type content_type: str + :param attributes: The attributes of the secret. + :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretAttributes + :ivar secret_uri: The URI to retrieve the current version of the secret. + :vartype secret_uri: str + :ivar secret_uri_with_version: The URI to retrieve the specific version of the secret. + :vartype secret_uri_with_version: str + """ + + _validation = { + 'secret_uri': {'readonly': True}, + 'secret_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, + 'secret_uri': {'key': 'secretUri', 'type': 'str'}, + 'secret_uri_with_version': {'key': 'secretUriWithVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + content_type: Optional[str] = None, + attributes: Optional["SecretAttributes"] = None, + **kwargs + ): + super(SecretProperties, self).__init__(**kwargs) + self.value = value + self.content_type = content_type + self.attributes = attributes + self.secret_uri = None + self.secret_uri_with_version = None + + +class ServiceSpecification(msrest.serialization.Model): + """One property of operation, include log specifications. + + :param log_specifications: Log specifications of operation. + :type log_specifications: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.LogSpecification] + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + metric_specifications: Optional[List["MetricSpecification"]] = None, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + self.metric_specifications = metric_specifications + + +class Sku(msrest.serialization.Model): + """SKU details. + + All required parameters must be populated in order to send to Azure. + + :param family: Required. SKU family name. Possible values include: "A". + :type family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuFamily + :param name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: "standard", "premium". + :type name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuName + """ + + _validation = { + 'family': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + family: Union[str, "SkuFamily"] = "A", + name: Union[str, "SkuName"], + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.family = family + self.name = name + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the key vault resource. + + :param created_by: The identity that created the key vault resource. + :type created_by: str + :param created_by_type: The type of identity that created the key vault resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType + :param created_at: The timestamp of the key vault resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the key vault resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the key vault resource. + Possible values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType + :param last_modified_at: The timestamp of the key vault resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "IdentityType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "IdentityType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class Trigger(msrest.serialization.Model): + """Trigger. + + :param time_after_create: The time duration after key creation to rotate the key. It only + applies to rotate. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + :type time_after_create: str + :param time_before_expiry: The time duration before key expiring to rotate or notify. It will + be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + :type time_before_expiry: str + """ + + _attribute_map = { + 'time_after_create': {'key': 'timeAfterCreate', 'type': 'str'}, + 'time_before_expiry': {'key': 'timeBeforeExpiry', 'type': 'str'}, + } + + def __init__( + self, + *, + time_after_create: Optional[str] = None, + time_before_expiry: Optional[str] = None, + **kwargs + ): + super(Trigger, self).__init__(**kwargs) + self.time_after_create = time_after_create + self.time_before_expiry = time_before_expiry + + +class Vault(msrest.serialization.Model): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :param location: Azure location of the key vault resource. + :type location: str + :param tags: A set of tags. Tags assigned to the key vault resource. + :type tags: dict[str, str] + :ivar system_data: System metadata for the key vault. + :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData + :param properties: Required. Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'VaultProperties'}, + } + + def __init__( + self, + *, + properties: "VaultProperties", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Vault, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.system_data = None + self.properties = properties + + +class VaultAccessPolicyParameters(msrest.serialization.Model): + """Parameters for updating the access policy in a vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource id of the access policy. + :vartype id: str + :ivar name: The resource name of the access policy. + :vartype name: str + :ivar type: The resource name of the access policy. + :vartype type: str + :ivar location: The resource type of the access policy. + :vartype location: str + :param properties: Required. Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, + } + + def __init__( + self, + *, + properties: "VaultAccessPolicyProperties", + **kwargs + ): + super(VaultAccessPolicyParameters, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.properties = properties + + +class VaultAccessPolicyProperties(msrest.serialization.Model): + """Properties of the vault access policy. + + All required parameters must be populated in order to send to Azure. + + :param access_policies: Required. An array of 0 to 16 identities 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. + :type access_policies: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] + """ + + _validation = { + 'access_policies': {'required': True}, + } + + _attribute_map = { + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + } + + def __init__( + self, + *, + access_policies: List["AccessPolicyEntry"], + **kwargs + ): + super(VaultAccessPolicyProperties, self).__init__(**kwargs) + self.access_policies = access_policies + + +class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): + """The parameters used to check the availability of the vault name. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The vault name. + :type name: str + :ivar type: The type of resource, Microsoft.KeyVault/vaults. Has constant value: + "Microsoft.KeyVault/vaults". + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.KeyVault/vaults" + + def __init__( + self, + *, + name: str, + **kwargs + ): + super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) + self.name = name + + +class VaultCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters for creating or updating a vault. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The supported Azure location where the key vault should be created. + :type location: str + :param tags: A set of tags. The tags that will be assigned to the key vault. + :type tags: dict[str, str] + :param properties: Required. Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProperties + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'VaultProperties'}, + } + + def __init__( + self, + *, + location: str, + properties: "VaultProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = location + self.tags = tags + self.properties = properties + + +class VaultListResult(msrest.serialization.Model): + """List of vaults. + + :param value: The list of vaults. + :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] + :param next_link: The URL to get the next set of vaults. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Vault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Vault"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(VaultListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VaultPatchParameters(msrest.serialization.Model): + """Parameters for creating or updating a vault. + + :param tags: A set of tags. The tags that will be assigned to the key vault. + :type tags: dict[str, str] + :param properties: Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultPatchProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["VaultPatchProperties"] = None, + **kwargs + ): + super(VaultPatchParameters, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class VaultPatchProperties(msrest.serialization.Model): + """Properties of the vault. + + :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. + :type tenant_id: str + :param sku: SKU details. + :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Sku + :param access_policies: An array of 0 to 16 identities 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. + :type access_policies: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. + :type enabled_for_deployment: bool + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :type enabled_for_disk_encryption: bool + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :type enabled_for_template_deployment: bool + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. Once set to true, it cannot be reverted to false. + :type enable_soft_delete: bool + :param enable_rbac_authorization: Property that controls how data actions are authorized. When + true, the key vault will use Role Based Access Control (RBAC) for authorization of data + actions, and the access policies specified in vault properties will be ignored (warning: this + is a preview feature). When false, the key vault will use the access policies specified in + vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or + not specified, the value of this property will not change. + :type enable_rbac_authorization: bool + :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :type soft_delete_retention_in_days: int + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: "recover", "default". + :type create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. + :type enable_purge_protection: bool + :param network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. + :type network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet + :param public_network_access: Property to specify whether the vault will accept traffic from + public internet. If set to 'disabled' all traffic except private endpoint traffic and that that + originates from trusted services will be blocked. This will override the set firewall rules, + meaning that even if the firewall rules are present we will not honor the rules. + :type public_network_access: str + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, + 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, + 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + sku: Optional["Sku"] = None, + access_policies: Optional[List["AccessPolicyEntry"]] = None, + enabled_for_deployment: Optional[bool] = None, + enabled_for_disk_encryption: Optional[bool] = None, + enabled_for_template_deployment: Optional[bool] = None, + enable_soft_delete: Optional[bool] = None, + enable_rbac_authorization: Optional[bool] = None, + soft_delete_retention_in_days: Optional[int] = None, + create_mode: Optional[Union[str, "CreateMode"]] = None, + enable_purge_protection: Optional[bool] = None, + network_acls: Optional["NetworkRuleSet"] = None, + public_network_access: Optional[str] = None, + **kwargs + ): + super(VaultPatchProperties, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.sku = sku + self.access_policies = access_policies + self.enabled_for_deployment = enabled_for_deployment + self.enabled_for_disk_encryption = enabled_for_disk_encryption + self.enabled_for_template_deployment = enabled_for_template_deployment + self.enable_soft_delete = enable_soft_delete + self.enable_rbac_authorization = enable_rbac_authorization + self.soft_delete_retention_in_days = soft_delete_retention_in_days + self.create_mode = create_mode + self.enable_purge_protection = enable_purge_protection + self.network_acls = network_acls + self.public_network_access = public_network_access + + +class VaultProperties(msrest.serialization.Model): + """Properties of the vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + 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 sku: Required. SKU details. + :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Sku + :param access_policies: An array of 0 to 1024 identities 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. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :type access_policies: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] + :param vault_uri: The URI of the vault for performing operations on keys and secrets. + :type vault_uri: str + :ivar hsm_pool_resource_id: The resource id of HSM Pool. + :vartype hsm_pool_resource_id: str + :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. + :type enabled_for_deployment: bool + :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :type enabled_for_disk_encryption: bool + :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :type enabled_for_template_deployment: bool + :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. If it's not set to any value(true or false) when creating new key + vault, it will be set to true by default. Once set to true, it cannot be reverted to false. + :type enable_soft_delete: bool + :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :type soft_delete_retention_in_days: int + :param enable_rbac_authorization: Property that controls how data actions are authorized. When + true, the key vault will use Role Based Access Control (RBAC) for authorization of data + actions, and the access policies specified in vault properties will be ignored (warning: this + is a preview feature). When false, the key vault will use the access policies specified in + vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or + not specified, the vault is created with the default value of false. Note that management + actions are always authorized with RBAC. + :type enable_rbac_authorization: bool + :param create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Possible values include: "recover", "default". + :type create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. + :type enable_purge_protection: bool + :param network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :type network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet + :param provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :type provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProvisioningState + :ivar private_endpoint_connections: List of private endpoint connections associated with the + key vault. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionItem] + :param public_network_access: Property to specify whether the vault will accept traffic from + public internet. If set to 'disabled' all traffic except private endpoint traffic and that that + originates from trusted services will be blocked. This will override the set firewall rules, + meaning that even if the firewall rules are present we will not honor the rules. + :type public_network_access: str + """ + + _validation = { + 'tenant_id': {'required': True}, + 'sku': {'required': True}, + 'hsm_pool_resource_id': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'hsm_pool_resource_id': {'key': 'hsmPoolResourceId', 'type': 'str'}, + 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, + 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, + 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: str, + sku: "Sku", + access_policies: Optional[List["AccessPolicyEntry"]] = None, + vault_uri: Optional[str] = None, + enabled_for_deployment: Optional[bool] = None, + enabled_for_disk_encryption: Optional[bool] = None, + enabled_for_template_deployment: Optional[bool] = None, + enable_soft_delete: Optional[bool] = True, + soft_delete_retention_in_days: Optional[int] = 90, + enable_rbac_authorization: Optional[bool] = False, + create_mode: Optional[Union[str, "CreateMode"]] = None, + enable_purge_protection: Optional[bool] = None, + network_acls: Optional["NetworkRuleSet"] = None, + provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, + public_network_access: Optional[str] = "enabled", + **kwargs + ): + super(VaultProperties, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.sku = sku + self.access_policies = access_policies + self.vault_uri = vault_uri + self.hsm_pool_resource_id = None + self.enabled_for_deployment = enabled_for_deployment + self.enabled_for_disk_encryption = enabled_for_disk_encryption + self.enabled_for_template_deployment = enabled_for_template_deployment + self.enable_soft_delete = enable_soft_delete + self.soft_delete_retention_in_days = soft_delete_retention_in_days + self.enable_rbac_authorization = enable_rbac_authorization + self.create_mode = create_mode + self.enable_purge_protection = enable_purge_protection + self.network_acls = network_acls + self.provisioning_state = provisioning_state + self.private_endpoint_connections = None + self.public_network_access = public_network_access + + +class VirtualNetworkRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific virtual network. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :type id: str + :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + check if parent subnet has serviceEndpoints configured. + :type ignore_missing_vnet_service_endpoint: bool + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + *, + id: str, + ignore_missing_vnet_service_endpoint: Optional[bool] = None, + **kwargs + ): + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = id + self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/__init__.py new file mode 100644 index 0000000000000..8e1d8528d9454 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/__init__.py @@ -0,0 +1,29 @@ +# 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 ._keys_operations import KeysOperations +from ._vaults_operations import VaultsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._managed_hsms_operations import ManagedHsmsOperations +from ._mhsm_private_endpoint_connections_operations import MHSMPrivateEndpointConnectionsOperations +from ._mhsm_private_link_resources_operations import MHSMPrivateLinkResourcesOperations +from ._operations import Operations +from ._secrets_operations import SecretsOperations + +__all__ = [ + 'KeysOperations', + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ManagedHsmsOperations', + 'MHSMPrivateEndpointConnectionsOperations', + 'MHSMPrivateLinkResourcesOperations', + 'Operations', + 'SecretsOperations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_keys_operations.py new file mode 100644 index 0000000000000..51a9e0e09639b --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_keys_operations.py @@ -0,0 +1,408 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class KeysOperations(object): + """KeysOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_if_not_exist( + self, + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + parameters, # type: "_models.KeyCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.Key" + """Creates the first version of a new key if it does not exist. If it already exists, then the + existing key is returned without any write operations being performed. This API does not create + subsequent versions, and does not update existing keys. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the key vault which contains the key to be created. + :type vault_name: str + :param key_name: The name of the key to be created. + :type key_name: str + :param parameters: The parameters used to create the specified key. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_if_not_exist.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'KeyCreateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Key" + """Gets the current version of the specified key from the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. + :type vault_name: str + :param key_name: The name of the key to be retrieved. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.KeyListResult"] + """Lists the keys in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the keys to be retrieved. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} # type: ignore + + def get_version( + self, + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + key_version, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Key" + """Gets the specified version of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key version to be retrieved. + :type vault_name: str + :param key_name: The name of the key version to be retrieved. + :type key_name: str + :param key_version: The version of the key to be retrieved. + :type key_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_version.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + 'keyVersion': self._serialize.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} # type: ignore + + def list_versions( + self, + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.KeyListResult"] + """Lists the versions of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key versions to be retrieved. + :type vault_name: str + :param key_name: The name of the key versions to be retrieved. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_versions.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('KeyListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_versions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py new file mode 100644 index 0000000000000..bdaec23b9da7f --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py @@ -0,0 +1,875 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ManagedHsmsOperations(object): + """ManagedHsmsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + name, # type: str + parameters, # type: "_models.ManagedHsm" + **kwargs # type: Any + ): + # type: (...) -> "_models.ManagedHsm" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ManagedHsm') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + name, # type: str + parameters, # type: "_models.ManagedHsm" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ManagedHsm"] + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + def _update_initial( + self, + resource_group_name, # type: str + name, # type: str + parameters, # type: "_models.ManagedHsm" + **kwargs # type: Any + ): + # type: (...) -> "_models.ManagedHsm" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'ManagedHsm') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + name, # type: str + parameters, # type: "_models.ManagedHsm" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ManagedHsm"] + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param parameters: Parameters to patch the managed HSM Pool. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes the specified managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: The name of the managed HSM Pool to delete. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + name=name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.ManagedHsm"] + """Gets the specified managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedHsm, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ManagedHsmListResult"] + """The List operation gets information about the managed HSM Pools associated with the + subscription and within the specified resource group. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + + def list_by_subscription( + self, + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ManagedHsmListResult"] + """The List operation gets information about the managed HSM Pools associated with the + subscription. + + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + + def list_deleted( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DeletedManagedHsmListResult"] + """The List operation gets information about the deleted managed HSMs associated with the + subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedManagedHsmListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsmListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_deleted.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedManagedHsmListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs'} # type: ignore + + def get_deleted( + self, + name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeletedManagedHsm" + """Gets the specified deleted managed HSM. + + :param name: The name of the deleted managed HSM. + :type name: str + :param location: The location of the deleted managed HSM. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedManagedHsm, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsm + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsm"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_deleted.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeletedManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}'} # type: ignore + + def _purge_deleted_initial( + self, + name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._purge_deleted_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'name': self._serialize.url("name", name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge'} # type: ignore + + def begin_purge_deleted( + self, + name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Permanently deletes the specified managed HSM. + + :param name: The name of the soft-deleted managed HSM. + :type name: str + :param location: The location of the soft-deleted managed HSM. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._purge_deleted_initial( + name=name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'name': self._serialize.url("name", 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 = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py new file mode 100644 index 0000000000000..80a9d4a68d287 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py @@ -0,0 +1,396 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MHSMPrivateEndpointConnectionsOperations(object): + """MHSMPrivateEndpointConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.MHSMPrivateEndpointConnectionsListResult"] + """The List operation gets information about the private endpoint connections associated with the + managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MHSMPrivateEndpointConnectionsListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnectionsListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('MHSMPrivateEndpointConnectionsListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections'} # type: ignore + + def get( + self, + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MHSMPrivateEndpointConnection" + """Gets the specified private endpoint connection associated with the managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MHSMPrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def put( + self, + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + properties, # type: "_models.MHSMPrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.MHSMPrivateEndpointConnection" + """Updates the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MHSMPrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.put.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.MHSMPrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MHSMPrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.MHSMPrivateEndpointConnection"] + """Deletes the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either MHSMPrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_link_resources_operations.py new file mode 100644 index 0000000000000..2e5ca8a99b7ac --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_link_resources_operations.py @@ -0,0 +1,104 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MHSMPrivateLinkResourcesOperations(object): + """MHSMPrivateLinkResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_mhsm_resource( + self, + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MHSMPrivateLinkResourceListResult" + """Gets the private link resources supported for the managed hsm pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MHSMPrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_mhsm_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'name': self._serialize.url("name", name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MHSMPrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_mhsm_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_operations.py new file mode 100644 index 0000000000000..b04178d842b3b --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_operations.py @@ -0,0 +1,109 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_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.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/providers/Microsoft.KeyVault/operations'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py new file mode 100644 index 0000000000000..672c3bdb73ab2 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,396 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + """Gets the specified private endpoint connection associated with the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def put( + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + properties, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnection" + """Updates the specified private endpoint connection associated with the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. + :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.put.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(properties, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + """Deletes the specified private endpoint connection associated with the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def list_by_resource( + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + """The List operation gets information about the private endpoint connections associated with the + vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_link_resources_operations.py new file mode 100644 index 0000000000000..06922aaffaf94 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_link_resources_operations.py @@ -0,0 +1,104 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_vault( + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateLinkResourceListResult" + """Gets the private link resources supported for the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.list_by_vault.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py new file mode 100644 index 0000000000000..8ee3a9db6128e --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py @@ -0,0 +1,346 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SecretsOperations(object): + """SecretsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def create_or_update( + self, + resource_group_name, # type: str + vault_name, # type: str + secret_name, # type: str + parameters, # type: "_models.SecretCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.Secret" + """Create or update a secret in a key vault in the specified subscription. NOTE: This API is + intended for internal use in ARM deployments. Users should use the data-plane REST service for + interaction with vault secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param secret_name: Name of the secret. + :type secret_name: str + :param parameters: Parameters to create or update the secret. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'secretName': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Secret', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + vault_name, # type: str + secret_name, # type: str + parameters, # type: "_models.SecretPatchParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.Secret" + """Update a secret in the specified subscription. NOTE: This API is intended for internal use in + ARM deployments. Users should use the data-plane REST service for interaction with vault + secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param secret_name: Name of the secret. + :type secret_name: str + :param parameters: Parameters to patch the secret. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'secretName': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'SecretPatchParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Secret', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vault_name, # type: str + secret_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Secret" + """Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. + Users should use the data-plane REST service for interaction with vault secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :param secret_name: The name of the secret. + :type secret_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'secretName': self._serialize.url("secret_name", secret_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + vault_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SecretListResult"] + """The List operation gets information about the secrets in a vault. NOTE: This API is intended + for internal use in ARM deployments. Users should use the data-plane REST service for + interaction with vault secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SecretListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py new file mode 100644 index 0000000000000..ac58e909351ad --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py @@ -0,0 +1,957 @@ +# 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 typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class VaultsOperations(object): + """VaultsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def _create_or_update_initial( + self, + resource_group_name, # type: str + vault_name, # type: str + parameters, # type: "_models.VaultCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.Vault" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + vault_name, # type: str + parameters, # type: "_models.VaultCreateOrUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to create or update the vault. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either Vault or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + vault_name, # type: str + parameters, # type: "_models.VaultPatchParameters" + **kwargs # type: Any + ): + # type: (...) -> "_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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to patch the vault. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultPatchParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Deletes the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault to delete. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + def get( + self, + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Vault" + """Gets the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + def update_access_policy( + self, + resource_group_name, # type: str + vault_name, # type: str + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + parameters, # type: "_models.VaultAccessPolicyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_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. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param operation_kind: Name of the operation. + :type operation_kind: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. + :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultAccessPolicyParameters, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_access_policy.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_access_policy.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VaultListResult"] + """The List operation gets information about the vaults associated with the subscription and + within the specified resource group. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults'} # type: ignore + + def list_by_subscription( + self, + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.VaultListResult"] + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('VaultListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + + def list_deleted( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_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.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_deleted.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + + def get_deleted( + self, + vault_name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.DeletedVault" + """Gets the deleted Azure key vault. + + :param vault_name: The name of the vault. + :type vault_name: str + :param location: The location of the deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self.get_deleted.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeletedVault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}'} # type: ignore + + def _purge_deleted_initial( + self, + vault_name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + accept = "application/json" + + # Construct URL + url = self._purge_deleted_initial.metadata['url'] # type: ignore + 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'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + def begin_purge_deleted( + self, + vault_name, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + + :param vault_name: The name of the soft-deleted vault. + :type vault_name: str + :param location: The location of the soft-deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. + Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + 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 = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + def list( + self, + top=None, # type: Optional[int] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceListResult"] + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2015-11-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = self._serialize.query("top", top, 'int') + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + + def check_name_availability( + self, + vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.CheckNameAvailabilityResult" + """Checks that the vault name is valid and is not already in use. + + :param vault_name: The name of the vault. + :type vault_name: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-06-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.check_name_availability.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/py.typed b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/py.typed new file mode 100644 index 0000000000000..e5aff4f83af86 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file