diff --git a/sdk/keyvault/azure-mgmt-keyvault/MANIFEST.in b/sdk/keyvault/azure-mgmt-keyvault/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/MANIFEST.in +++ b/sdk/keyvault/azure-mgmt-keyvault/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/keyvault/azure-mgmt-keyvault/_meta.json b/sdk/keyvault/azure-mgmt-keyvault/_meta.json new file mode 100644 index 000000000000..519b97d4ccf4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/_meta.json @@ -0,0 +1,8 @@ +{ + "autorest": "3.0.6369", + "use": "@autorest/python@5.6.2", + "commit": "738823deb56c98b6e7448620ffba21fc11a16715", + "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.6.2 --version=3.0.6369", + "readme": "specification/keyvault/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py index 0a131b868ca1..5d1c3482be02 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,6 +16,11 @@ 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. 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 de68ba06247d..5f2192c9e204 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 @@ -9,13 +9,21 @@ # regenerated. # -------------------------------------------------------------------------- -from azure.mgmt.core import ARMPipelineClient -from msrest import Serializer, Deserializer +from typing import TYPE_CHECKING +from azure.mgmt.core import ARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + from ._configuration import KeyVaultManagementClientConfiguration +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -38,9 +46,10 @@ class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): :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 api_version: API version to use if no profile is provided, or if - missing in profile. - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str :param profile: A profile definition, from KnownProfiles to dict. :type profile: azure.profiles.KnownProfiles :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -59,9 +68,9 @@ def __init__( self, credential, # type: "TokenCredential" subscription_id, # type: str - api_version=None, - base_url=None, - profile=KnownProfiles.default, + api_version=None, # type: Optional[str] + base_url=None, # type: Optional[str] + profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): if not base_url: @@ -85,6 +94,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2018-02-14: :mod:`v2018_02_14.models` * 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` """ if api_version == '2016-10-01': from .v2016_10_01 import models @@ -98,21 +108,66 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-04-01-preview': from .v2020_04_01_preview import models return models + elif api_version == '2021-04-01-preview': + from .v2021_04_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) + @property + def keys(self): + """Instance depends on the API version: + + * 2019-09-01: :class:`KeysOperations` + """ + api_version = self._get_api_version('keys') + if api_version == '2019-09-01': + from .v2019_09_01.operations import KeysOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'keys'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def managed_hsms(self): """Instance depends on the API version: * 2020-04-01-preview: :class:`ManagedHsmsOperations` + * 2021-04-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 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))) + @property + def mhsm_private_endpoint_connections(self): + """Instance depends on the API version: + + * 2021-04-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 + 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))) + + @property + def mhsm_private_link_resources(self): + """Instance depends on the API version: + + * 2021-04-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 + 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))) + @property def operations(self): """Instance depends on the API version: @@ -121,6 +176,7 @@ def operations(self): * 2018-02-14: :class:`Operations` * 2019-09-01: :class:`Operations` * 2020-04-01-preview: :class:`Operations` + * 2021-04-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2016-10-01': @@ -131,6 +187,8 @@ def operations(self): from .v2019_09_01.operations import Operations as OperationClass elif api_version == '2020-04-01-preview': 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 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))) @@ -142,6 +200,7 @@ def private_endpoint_connections(self): * 2018-02-14: :class:`PrivateEndpointConnectionsOperations` * 2019-09-01: :class:`PrivateEndpointConnectionsOperations` * 2020-04-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-04-01-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2018-02-14': @@ -150,6 +209,8 @@ def private_endpoint_connections(self): from .v2019_09_01.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2020-04-01-preview': 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 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))) @@ -161,6 +222,7 @@ def private_link_resources(self): * 2018-02-14: :class:`PrivateLinkResourcesOperations` * 2019-09-01: :class:`PrivateLinkResourcesOperations` * 2020-04-01-preview: :class:`PrivateLinkResourcesOperations` + * 2021-04-01-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2018-02-14': @@ -169,10 +231,25 @@ def private_link_resources(self): from .v2019_09_01.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2020-04-01-preview': 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 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))) + @property + def secrets(self): + """Instance depends on the API version: + + * 2021-04-01-preview: :class:`SecretsOperations` + """ + api_version = self._get_api_version('secrets') + if api_version == '2021-04-01-preview': + from .v2021_04_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))) + @property def vaults(self): """Instance depends on the API version: @@ -181,6 +258,7 @@ def vaults(self): * 2018-02-14: :class:`VaultsOperations` * 2019-09-01: :class:`VaultsOperations` * 2020-04-01-preview: :class:`VaultsOperations` + * 2021-04-01-preview: :class:`VaultsOperations` """ api_version = self._get_api_version('vaults') if api_version == '2016-10-01': @@ -191,6 +269,8 @@ def vaults(self): from .v2019_09_01.operations import VaultsOperations as OperationClass elif api_version == '2020-04-01-preview': 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 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/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py index 313799f24232..97c53efb3b95 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py @@ -8,7 +8,7 @@ # Changes may cause incorrect behavior and will be lost if the code is # regenerated. # -------------------------------------------------------------------------- -from typing import Any +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies @@ -16,6 +16,9 @@ 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. @@ -31,8 +34,8 @@ class KeyVaultManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "AsyncTokenCredential" - subscription_id, # type: str + credential: "AsyncTokenCredential", + subscription_id: str, **kwargs # type: Any ) -> None: if credential is None: 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 a967aa9463c8..00027c0417bc 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 @@ -9,13 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Serializer, Deserializer +from typing import Any, Optional, TYPE_CHECKING +from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin +from msrest import Deserializer, Serializer + from ._configuration import KeyVaultManagementClientConfiguration +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -38,9 +44,10 @@ class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): :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 api_version: API version to use if no profile is provided, or if - missing in profile. - :param str base_url: Service URL + :param api_version: API version to use if no profile is provided, or if missing in profile. + :type api_version: str + :param base_url: Service URL + :type base_url: str :param profile: A profile definition, from KnownProfiles to dict. :type profile: azure.profiles.KnownProfiles :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -57,11 +64,11 @@ class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): def __init__( self, - credential, # type: "AsyncTokenCredential" - subscription_id, # type: str - api_version=None, - base_url=None, - profile=KnownProfiles.default, + credential: "AsyncTokenCredential", + subscription_id: str, + api_version: Optional[str] = None, + base_url: Optional[str] = None, + profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any ) -> None: if not base_url: @@ -85,6 +92,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2018-02-14: :mod:`v2018_02_14.models` * 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` """ if api_version == '2016-10-01': from ..v2016_10_01 import models @@ -98,21 +106,66 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2020-04-01-preview': from ..v2020_04_01_preview import models return models + elif api_version == '2021-04-01-preview': + from ..v2021_04_01_preview import models + return models raise ValueError("API version {} is not available".format(api_version)) + @property + def keys(self): + """Instance depends on the API version: + + * 2019-09-01: :class:`KeysOperations` + """ + api_version = self._get_api_version('keys') + if api_version == '2019-09-01': + from ..v2019_09_01.aio.operations import KeysOperations as OperationClass + else: + raise ValueError("API version {} does not have operation group 'keys'".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def managed_hsms(self): """Instance depends on the API version: * 2020-04-01-preview: :class:`ManagedHsmsOperations` + * 2021-04-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 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))) + @property + def mhsm_private_endpoint_connections(self): + """Instance depends on the API version: + + * 2021-04-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 + 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))) + + @property + def mhsm_private_link_resources(self): + """Instance depends on the API version: + + * 2021-04-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 + 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))) + @property def operations(self): """Instance depends on the API version: @@ -121,6 +174,7 @@ def operations(self): * 2018-02-14: :class:`Operations` * 2019-09-01: :class:`Operations` * 2020-04-01-preview: :class:`Operations` + * 2021-04-01-preview: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2016-10-01': @@ -131,6 +185,8 @@ def operations(self): from ..v2019_09_01.aio.operations import Operations as OperationClass elif api_version == '2020-04-01-preview': 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 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))) @@ -142,6 +198,7 @@ def private_endpoint_connections(self): * 2018-02-14: :class:`PrivateEndpointConnectionsOperations` * 2019-09-01: :class:`PrivateEndpointConnectionsOperations` * 2020-04-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2021-04-01-preview: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2018-02-14': @@ -150,6 +207,8 @@ def private_endpoint_connections(self): from ..v2019_09_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2020-04-01-preview': 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 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))) @@ -161,6 +220,7 @@ def private_link_resources(self): * 2018-02-14: :class:`PrivateLinkResourcesOperations` * 2019-09-01: :class:`PrivateLinkResourcesOperations` * 2020-04-01-preview: :class:`PrivateLinkResourcesOperations` + * 2021-04-01-preview: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2018-02-14': @@ -169,10 +229,25 @@ def private_link_resources(self): from ..v2019_09_01.aio.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2020-04-01-preview': 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 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))) + @property + def secrets(self): + """Instance depends on the API version: + + * 2021-04-01-preview: :class:`SecretsOperations` + """ + api_version = self._get_api_version('secrets') + if api_version == '2021-04-01-preview': + from ..v2021_04_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))) + @property def vaults(self): """Instance depends on the API version: @@ -181,6 +256,7 @@ def vaults(self): * 2018-02-14: :class:`VaultsOperations` * 2019-09-01: :class:`VaultsOperations` * 2020-04-01-preview: :class:`VaultsOperations` + * 2021-04-01-preview: :class:`VaultsOperations` """ api_version = self._get_api_version('vaults') if api_version == '2016-10-01': @@ -191,6 +267,8 @@ def vaults(self): from ..v2019_09_01.aio.operations import VaultsOperations as OperationClass elif api_version == '2020-04-01-preview': 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 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/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py index 500005a28477..b4494449b218 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py @@ -53,6 +53,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json index 2e4ec38bfc58..40cf8cdbbc6d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json @@ -8,32 +8,35 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": false, + "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\"]}}}", + "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\"]}}}" }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id: 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 @@ -41,21 +44,67 @@ }, "constant": { }, - "call": "credential, subscription_id" + "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 + "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": { "vaults": "VaultsOperations", "operations": "Operations" }, "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "None", + "async_imports": "None", + "operations": { + } + } } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py index 88854053a696..ee5493e4b6e8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py @@ -50,6 +50,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py index a542c354f3c3..9b3dbffd14a8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py index 735e97e7cd61..fa3faebb1cdc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class VaultsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,9 +47,9 @@ async def create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -63,7 +63,7 @@ async def create_or_update( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -117,9 +117,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultPatchParameters", + parameters: "_models.VaultPatchParameters", **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -133,7 +133,7 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -241,7 +241,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -253,7 +253,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -298,10 +298,10 @@ async def update_access_policy( self, resource_group_name: str, vault_name: str, - operation_kind: Union[str, "models.AccessPolicyUpdateKind"], - parameters: "models.VaultAccessPolicyParameters", + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", **kwargs - ) -> "models.VaultAccessPolicyParameters": + ) -> "_models.VaultAccessPolicyParameters": """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -317,7 +317,7 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -373,7 +373,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -386,7 +386,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -448,7 +448,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -458,7 +458,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -518,7 +518,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs - ) -> AsyncIterable["models.DeletedVaultListResult"]: + ) -> AsyncIterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -526,7 +526,7 @@ def list_deleted( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -586,7 +586,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs - ) -> "models.DeletedVault": + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -598,7 +598,7 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -695,8 +695,8 @@ async def begin_purge_deleted( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -725,7 +725,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -743,7 +749,7 @@ def list( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -753,7 +759,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -814,9 +820,9 @@ async def get_next(next_link=None): async def check_name_availability( self, - vault_name: "models.VaultCheckNameAvailabilityParameters", + vault_name: "_models.VaultCheckNameAvailabilityParameters", **kwargs - ) -> "models.CheckNameAvailabilityResult": + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -826,7 +832,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py index 1fbb79dc295f..a79b444664cc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py @@ -455,7 +455,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "A") self.name = kwargs['name'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py index b231c15bf5f9..2c117ce90fba 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py @@ -497,7 +497,7 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"], + family: Union[str, "SkuFamily"] = "A", name: Union[str, "SkuName"], **kwargs ): diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py index b087fb97fafd..8989c9aad003 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # 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 @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py index ea01754d4679..4426301d80b9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class VaultsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,10 +51,10 @@ def create_or_update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_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. @@ -68,7 +68,7 @@ def create_or_update( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -122,10 +122,10 @@ def update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultPatchParameters" + parameters, # type: "_models.VaultPatchParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # 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. @@ -139,7 +139,7 @@ def update( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -249,7 +249,7 @@ def get( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -261,7 +261,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -306,11 +306,11 @@ 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" + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + parameters, # type: "_models.VaultAccessPolicyParameters" **kwargs # type: Any ): - # type: (...) -> "models.VaultAccessPolicyParameters" + # 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. @@ -326,7 +326,7 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -383,7 +383,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -396,7 +396,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -459,7 +459,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -469,7 +469,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -530,7 +530,7 @@ def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeletedVaultListResult"] + # 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 @@ -538,7 +538,7 @@ def list_deleted( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -599,7 +599,7 @@ def get_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeletedVault" + # type: (...) -> "_models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -611,7 +611,7 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -710,8 +710,8 @@ def begin_purge_deleted( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -740,7 +740,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -759,7 +765,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -769,7 +775,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -830,10 +836,10 @@ def get_next(next_link=None): def check_name_availability( self, - vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" **kwargs # type: Any ): - # type: (...) -> "models.CheckNameAvailabilityResult" + # type: (...) -> "_models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -843,7 +849,7 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py index 5ec92f953da4..6a1c90c7b3bc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py @@ -59,6 +59,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json index 00161d1fdf3b..63f211c3e086 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json @@ -8,32 +8,35 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": false, + "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\"]}}}", + "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\"]}}}" }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id: 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 @@ -41,14 +44,58 @@ }, "constant": { }, - "call": "credential, subscription_id" + "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 + "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": { "vaults": "VaultsOperations", @@ -57,7 +104,9 @@ "operations": "Operations" }, "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "None", + "async_imports": "None", + "operations": { + } + } } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py index 53d3e8f627d3..ae9d6141210f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py @@ -56,6 +56,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py index 62e0af9fc08d..6fc5c295d786 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py index af40df162584..528271c3a68c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +34,7 @@ class PrivateEndpointConnectionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> "_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. @@ -63,7 +63,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -110,9 +110,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "models.PrivateEndpointConnection", + properties: "_models.PrivateEndpointConnection", **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> "_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. @@ -129,7 +129,7 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,8 +185,8 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> Optional["models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -241,7 +241,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: + ) -> 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. @@ -253,8 +253,8 @@ async def begin_delete( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -262,7 +262,7 @@ async def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -287,7 +287,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py index f3618351063c..0674b3a6eafa 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class PrivateLinkResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.PrivateLinkResourceListResult": + ) -> "_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. @@ -57,7 +57,7 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py index caf32c967e86..4c0bbc3df7c0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class VaultsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,10 +47,10 @@ async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> "models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + ) -> "_models.Vault": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -104,9 +104,9 @@ async def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.Vault"]: + ) -> 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. @@ -117,8 +117,8 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2018_02_14.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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -126,7 +126,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -151,7 +151,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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: @@ -169,9 +175,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultPatchParameters", + parameters: "_models.VaultPatchParameters", **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -185,7 +191,7 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -293,7 +299,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -305,7 +311,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -350,10 +356,10 @@ async def update_access_policy( self, resource_group_name: str, vault_name: str, - operation_kind: Union[str, "models.AccessPolicyUpdateKind"], - parameters: "models.VaultAccessPolicyParameters", + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", **kwargs - ) -> "models.VaultAccessPolicyParameters": + ) -> "_models.VaultAccessPolicyParameters": """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -369,7 +375,7 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -425,7 +431,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -438,7 +444,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -500,7 +506,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -510,7 +516,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -570,7 +576,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs - ) -> AsyncIterable["models.DeletedVaultListResult"]: + ) -> AsyncIterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -578,7 +584,7 @@ def list_deleted( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -638,7 +644,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs - ) -> "models.DeletedVault": + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -650,7 +656,7 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -747,8 +753,8 @@ async def begin_purge_deleted( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -777,7 +783,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -795,7 +807,7 @@ def list( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -805,7 +817,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -866,9 +878,9 @@ async def get_next(next_link=None): async def check_name_availability( self, - vault_name: "models.VaultCheckNameAvailabilityParameters", + vault_name: "_models.VaultCheckNameAvailabilityParameters", **kwargs - ) -> "models.CheckNameAvailabilityResult": + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -878,7 +890,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py index cbd89c41565d..1b2e27f0780f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py @@ -759,7 +759,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "A") self.name = kwargs['name'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py index 5031dac2eee9..d1cc5f8261ba 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py @@ -822,7 +822,7 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"], + family: Union[str, "SkuFamily"] = "A", name: Union[str, "SkuName"], **kwargs ): diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py index 8aa8659f2726..3a1d9d80ba63 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # 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 @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py index 071b41a122b6..c6c14be270d4 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -38,7 +38,7 @@ class PrivateEndpointConnectionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def get( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # type: (...) -> "_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. @@ -68,7 +68,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -115,10 +115,10 @@ def put( resource_group_name, # type: str vault_name, # type: str private_endpoint_connection_name, # type: str - properties, # type: "models.PrivateEndpointConnection" + properties, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # 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. @@ -135,7 +135,7 @@ def put( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,8 +192,8 @@ def _delete_initial( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PrivateEndpointConnection"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -249,7 +249,7 @@ def begin_delete( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.PrivateEndpointConnection"] + # 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. @@ -261,8 +261,8 @@ def begin_delete( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -270,7 +270,7 @@ def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -295,7 +295,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py index f73134a89fd7..ef08089bc1a9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class PrivateLinkResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_by_vault( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateLinkResourceListResult" + # 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. @@ -62,7 +62,7 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py index 2aa1aee90fba..a0065188489a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class VaultsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,11 +51,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + # type: (...) -> "_models.Vault" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -109,10 +109,10 @@ def begin_create_or_update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.Vault"] + # 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. @@ -123,8 +123,8 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2018_02_14.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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -132,7 +132,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -157,7 +157,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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: @@ -175,10 +181,10 @@ def update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultPatchParameters" + parameters, # type: "_models.VaultPatchParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # 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. @@ -192,7 +198,7 @@ def update( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -302,7 +308,7 @@ def get( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -314,7 +320,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -359,11 +365,11 @@ 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" + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + parameters, # type: "_models.VaultAccessPolicyParameters" **kwargs # type: Any ): - # type: (...) -> "models.VaultAccessPolicyParameters" + # 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. @@ -379,7 +385,7 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -436,7 +442,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -449,7 +455,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -512,7 +518,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -522,7 +528,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -583,7 +589,7 @@ def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeletedVaultListResult"] + # 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 @@ -591,7 +597,7 @@ def list_deleted( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -652,7 +658,7 @@ def get_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeletedVault" + # type: (...) -> "_models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -664,7 +670,7 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -763,8 +769,8 @@ def begin_purge_deleted( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -793,7 +799,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -812,7 +824,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -822,7 +834,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -883,10 +895,10 @@ def get_next(next_link=None): def check_name_availability( self, - vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" **kwargs # type: Any ): - # type: (...) -> "models.CheckNameAvailabilityResult" + # type: (...) -> "_models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -896,7 +908,7 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py index 002dd4926bf8..732d8583f12b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py @@ -22,6 +22,7 @@ from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations from .operations import Operations +from .operations import KeysOperations from . import models @@ -36,6 +37,8 @@ class KeyVaultManagementClient(object): :vartype private_link_resources: azure.mgmt.keyvault.v2019_09_01.operations.PrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2019_09_01.operations.Operations + :ivar keys: KeysOperations operations + :vartype keys: azure.mgmt.keyvault.v2019_09_01.operations.KeysOperations :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. @@ -59,6 +62,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( @@ -69,6 +73,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize) def close(self): # type: () -> None diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json index b52026f36224..48f94e1ed509 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json @@ -8,32 +8,35 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": false, + "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\"]}}}", + "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\"]}}}" }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id: 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 @@ -41,23 +44,70 @@ }, "constant": { }, - "call": "credential, subscription_id" + "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 + "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": { "vaults": "VaultsOperations", "private_endpoint_connections": "PrivateEndpointConnectionsOperations", "private_link_resources": "PrivateLinkResourcesOperations", - "operations": "Operations" + "operations": "Operations", + "keys": "KeysOperations" }, "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "None", + "async_imports": "None", + "operations": { + } + } } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py index 0f6a9e5ab2dd..3b1d68768292 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py @@ -20,6 +20,7 @@ from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations from .operations import Operations +from .operations import KeysOperations from .. import models @@ -34,6 +35,8 @@ class KeyVaultManagementClient(object): :vartype private_link_resources: azure.mgmt.keyvault.v2019_09_01.aio.operations.PrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2019_09_01.aio.operations.Operations + :ivar keys: KeysOperations operations + :vartype keys: azure.mgmt.keyvault.v2019_09_01.aio.operations.KeysOperations :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. @@ -56,6 +59,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( @@ -66,6 +70,8 @@ def __init__( self._client, self._config, self._serialize, self._deserialize) self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize) async def close(self) -> None: await self._client.close() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py index ad4413dd4cae..7b62b7166158 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py @@ -10,10 +10,12 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._operations import Operations +from ._keys_operations import KeysOperations __all__ = [ 'VaultsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', 'Operations', + 'KeysOperations', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py new file mode 100644 index 000000000000..9e8312e5083d --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/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.v2019_09_01.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 + ) -> "_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.v2019_09_01.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.v2019_09_01.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 = "2019-09-01" + 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 + ) -> "_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.v2019_09_01.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 = "2019-09-01" + 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 + ) -> 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.v2019_09_01.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 = "2019-09-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'), + '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 + ) -> "_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.v2019_09_01.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 = "2019-09-01" + 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 + ) -> 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.v2019_09_01.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 = "2019-09-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_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/v2019_09_01/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py index 63deb155db10..e811c9913ea3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py index 75e4e4933218..814ea710d74e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +34,7 @@ class PrivateEndpointConnectionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> 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. @@ -60,10 +60,10 @@ async def get( :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.v2019_09_01.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -93,11 +93,13 @@ async def get( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -110,9 +112,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "models.PrivateEndpointConnection", + properties: "_models.PrivateEndpointConnection", **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> "_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. @@ -129,7 +131,7 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,8 +187,8 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> Optional["models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -241,7 +243,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: + ) -> 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. @@ -253,8 +255,8 @@ async def begin_delete( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -262,7 +264,7 @@ async def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -287,7 +289,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py index 79df6ecfec61..9d320374df2d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class PrivateLinkResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.PrivateLinkResourceListResult": + ) -> "_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. @@ -57,7 +57,7 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py index b68fb2b7e84b..56263f5acf32 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class VaultsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,10 +47,10 @@ async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> "models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + ) -> "_models.Vault": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -104,9 +104,9 @@ async def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.Vault"]: + ) -> 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. @@ -117,8 +117,8 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2019_09_01.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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -126,7 +126,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -151,7 +151,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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: @@ -169,9 +175,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultPatchParameters", + parameters: "_models.VaultPatchParameters", **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -185,7 +191,7 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,6 +264,7 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -274,6 +281,7 @@ async def delete( # 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) @@ -293,7 +301,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -305,7 +313,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -350,10 +358,10 @@ async def update_access_policy( self, resource_group_name: str, vault_name: str, - operation_kind: Union[str, "models.AccessPolicyUpdateKind"], - parameters: "models.VaultAccessPolicyParameters", + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", **kwargs - ) -> "models.VaultAccessPolicyParameters": + ) -> "_models.VaultAccessPolicyParameters": """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -369,7 +377,7 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -425,7 +433,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -438,7 +446,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -500,7 +508,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -510,7 +518,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -570,7 +578,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs - ) -> AsyncIterable["models.DeletedVaultListResult"]: + ) -> AsyncIterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -578,7 +586,7 @@ def list_deleted( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -638,7 +646,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs - ) -> "models.DeletedVault": + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -650,7 +658,7 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -703,6 +711,7 @@ async def _purge_deleted_initial( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self._purge_deleted_initial.metadata['url'] # type: ignore @@ -719,6 +728,7 @@ async def _purge_deleted_initial( # 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) @@ -747,8 +757,8 @@ async def begin_purge_deleted( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -777,7 +787,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -795,7 +811,7 @@ def list( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -805,7 +821,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -866,9 +882,9 @@ async def get_next(next_link=None): async def check_name_availability( self, - vault_name: "models.VaultCheckNameAvailabilityParameters", + vault_name: "_models.VaultCheckNameAvailabilityParameters", **kwargs - ) -> "models.CheckNameAvailabilityResult": + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -878,7 +894,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py index 118b959ac33a..bb20570b32f7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py @@ -8,13 +8,21 @@ try: from ._models_py3 import AccessPolicyEntry + from ._models_py3 import Attributes from ._models_py3 import CheckNameAvailabilityResult from ._models_py3 import CloudErrorBody from ._models_py3 import DeletedVault from ._models_py3 import DeletedVaultListResult from ._models_py3 import DeletedVaultProperties + from ._models_py3 import DimensionProperties 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 LogSpecification + from ._models_py3 import MetricSpecification from ._models_py3 import NetworkRuleSet from ._models_py3 import Operation from ._models_py3 import OperationDisplay @@ -42,13 +50,21 @@ from ._models_py3 import VirtualNetworkRule except (SyntaxError, ImportError): from ._models import AccessPolicyEntry # type: ignore + from ._models import Attributes # type: ignore from ._models import CheckNameAvailabilityResult # type: ignore from ._models import CloudErrorBody # 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 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 LogSpecification # 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 @@ -79,6 +95,10 @@ AccessPolicyUpdateKind, CertificatePermissions, CreateMode, + DeletionRecoveryLevel, + JsonWebKeyCurveName, + JsonWebKeyOperation, + JsonWebKeyType, KeyPermissions, NetworkRuleAction, NetworkRuleBypassOptions, @@ -89,17 +109,26 @@ SkuFamily, SkuName, StoragePermissions, + VaultProvisioningState, ) __all__ = [ 'AccessPolicyEntry', + 'Attributes', 'CheckNameAvailabilityResult', 'CloudErrorBody', 'DeletedVault', 'DeletedVaultListResult', 'DeletedVaultProperties', + 'DimensionProperties', 'IPRule', + 'Key', + 'KeyAttributes', + 'KeyCreateParameters', + 'KeyListResult', + 'KeyProperties', 'LogSpecification', + 'MetricSpecification', 'NetworkRuleSet', 'Operation', 'OperationDisplay', @@ -128,6 +157,10 @@ 'AccessPolicyUpdateKind', 'CertificatePermissions', 'CreateMode', + 'DeletionRecoveryLevel', + 'JsonWebKeyCurveName', + 'JsonWebKeyOperation', + 'JsonWebKeyType', 'KeyPermissions', 'NetworkRuleAction', 'NetworkRuleBypassOptions', @@ -138,4 +171,5 @@ 'SkuFamily', 'SkuName', 'StoragePermissions', + 'VaultProvisioningState', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py index a56975b172c7..921758eff66a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py @@ -34,6 +34,7 @@ class AccessPolicyUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" DELETE = "delete" @@ -58,8 +59,51 @@ class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): 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 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" @@ -123,6 +167,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" SET = "set" @@ -147,6 +192,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" DELETE = "delete" @@ -161,3 +207,10 @@ class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): 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/v2019_09_01/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py index e051addc79e8..89a8a10f22bd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py @@ -51,6 +51,57 @@ def __init__( self.permissions = kwargs['permissions'] +class Attributes(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.v2019_09_01.models.DeletionRecoveryLevel + """ + + _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'}, + } + + 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 + self.recovery_level = None + + class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. @@ -191,6 +242,8 @@ class DeletedVaultProperties(msrest.serialization.Model): :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 = { @@ -199,6 +252,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'readonly': True}, 'scheduled_purge_date': {'readonly': True}, 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, } _attribute_map = { @@ -207,6 +261,7 @@ class DeletedVaultProperties(msrest.serialization.Model): '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__( @@ -219,6 +274,35 @@ def __init__( 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 IPRule(msrest.serialization.Model): @@ -247,6 +331,272 @@ def __init__( 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.v2019_09_01.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.v2019_09_01.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.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.v2019_09_01.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 + """ + + _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'}, + } + + 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 + + +class KeyAttributes(Attributes): + """The attributes of the key. + + 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.v2019_09_01.models.DeletionRecoveryLevel + """ + + _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'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyAttributes, self).__init__(**kwargs) + + +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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.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.v2019_09_01.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 + """ + + _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'}, + } + + 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 + + class LogSpecification(msrest.serialization.Model): """Log specification of operation. @@ -274,6 +624,66 @@ def __init__( self.blob_duration = kwargs.get('blob_duration', None) +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.v2019_09_01.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 NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. @@ -318,6 +728,8 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.keyvault.v2019_09_01.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.v2019_09_01.models.ServiceSpecification """ @@ -326,6 +738,7 @@ class Operation(msrest.serialization.Model): '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'}, } @@ -337,6 +750,7 @@ def __init__( 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) @@ -450,51 +864,6 @@ def __init__( self.id = None -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 PrivateEndpointConnection(Resource): """Private endpoint connection resource. @@ -510,6 +879,8 @@ class PrivateEndpointConnection(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.v2019_09_01.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -536,6 +907,7 @@ class PrivateEndpointConnection(Resource): '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'}, @@ -546,6 +918,7 @@ def __init__( **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 = None @@ -556,6 +929,10 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + :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.v2019_09_01.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -572,6 +949,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): } _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'}, @@ -582,6 +961,8 @@ def __init__( **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 = None @@ -669,15 +1050,15 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. :type description: str - :param action_required: A message indicating if changes on the service provider require any + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -687,7 +1068,7 @@ def __init__( super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.description = kwargs.get('description', None) - self.action_required = kwargs.get('action_required', None) + self.actions_required = kwargs.get('actions_required', None) class ResourceListResult(msrest.serialization.Model): @@ -718,10 +1099,13 @@ class ServiceSpecification(msrest.serialization.Model): :param log_specifications: Log specifications of operation. :type log_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.LogSpecification] + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.MetricSpecification] """ _attribute_map = { 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } def __init__( @@ -730,6 +1114,7 @@ def __init__( ): 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): @@ -759,7 +1144,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "A") self.name = kwargs['name'] @@ -1097,8 +1482,11 @@ class VaultProperties(msrest.serialization.Model): ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. + :param vault_uri: The URI of the vault for performing operations on keys and secrets. This + property is readonly. :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 @@ -1134,6 +1522,9 @@ class VaultProperties(msrest.serialization.Model): :param network_acls: Rules governing the accessibility of the key vault from specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet + :param provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :type provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1143,6 +1534,7 @@ class VaultProperties(msrest.serialization.Model): _validation = { 'tenant_id': {'required': True}, 'sku': {'required': True}, + 'hsm_pool_resource_id': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, } @@ -1151,6 +1543,7 @@ class VaultProperties(msrest.serialization.Model): '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'}, @@ -1160,6 +1553,7 @@ class VaultProperties(msrest.serialization.Model): '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]'}, } @@ -1172,6 +1566,7 @@ def __init__( 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) @@ -1181,6 +1576,7 @@ def __init__( 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 @@ -1193,6 +1589,9 @@ class VirtualNetworkRule(msrest.serialization.Model): '/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 = { @@ -1201,6 +1600,7 @@ class VirtualNetworkRule(msrest.serialization.Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, } def __init__( @@ -1209,3 +1609,4 @@ def __init__( ): 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/v2019_09_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py index b369d2e9008b..68ac222b0b9f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py @@ -60,6 +60,61 @@ def __init__( self.permissions = permissions +class Attributes(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.v2019_09_01.models.DeletionRecoveryLevel + """ + + _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'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[int] = None, + expires: Optional[int] = None, + **kwargs + ): + super(Attributes, self).__init__(**kwargs) + self.enabled = enabled + self.not_before = not_before + self.expires = expires + self.created = None + self.updated = None + self.recovery_level = None + + class CheckNameAvailabilityResult(msrest.serialization.Model): """The CheckNameAvailability operation response. @@ -208,6 +263,8 @@ class DeletedVaultProperties(msrest.serialization.Model): :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 = { @@ -216,6 +273,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'readonly': True}, 'scheduled_purge_date': {'readonly': True}, 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, } _attribute_map = { @@ -224,6 +282,7 @@ class DeletedVaultProperties(msrest.serialization.Model): '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__( @@ -236,6 +295,39 @@ def __init__( 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 IPRule(msrest.serialization.Model): @@ -266,6 +358,294 @@ def __init__( 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.v2019_09_01.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.v2019_09_01.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.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.v2019_09_01.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 + """ + + _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'}, + } + + 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, + **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 + + +class KeyAttributes(Attributes): + """The attributes of the key. + + 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.v2019_09_01.models.DeletionRecoveryLevel + """ + + _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'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[int] = None, + expires: Optional[int] = None, + **kwargs + ): + super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + + +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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.models.JsonWebKeyType + :param key_ops: + :type key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.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.v2019_09_01.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 + """ + + _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'}, + } + + 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, + **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 + + class LogSpecification(msrest.serialization.Model): """Log specification of operation. @@ -297,6 +677,78 @@ def __init__( self.blob_duration = blob_duration +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.v2019_09_01.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 NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. @@ -346,6 +798,8 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.keyvault.v2019_09_01.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.v2019_09_01.models.ServiceSpecification """ @@ -354,6 +808,7 @@ class Operation(msrest.serialization.Model): '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'}, } @@ -363,6 +818,7 @@ def __init__( name: Optional[str] = None, display: Optional["OperationDisplay"] = None, origin: Optional[str] = None, + is_data_action: Optional[bool] = None, service_specification: Optional["ServiceSpecification"] = None, **kwargs ): @@ -370,6 +826,7 @@ def __init__( self.name = name self.display = display self.origin = origin + self.is_data_action = is_data_action self.service_specification = service_specification @@ -496,51 +953,6 @@ def __init__( self.id = None -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 PrivateEndpointConnection(Resource): """Private endpoint connection resource. @@ -556,6 +968,8 @@ class PrivateEndpointConnection(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.v2019_09_01.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -582,6 +996,7 @@ class PrivateEndpointConnection(Resource): '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'}, @@ -590,11 +1005,13 @@ class PrivateEndpointConnection(Resource): def __init__( self, *, + etag: Optional[str] = None, private_endpoint: Optional["PrivateEndpoint"] = None, private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = 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 = None @@ -605,6 +1022,10 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + :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.v2019_09_01.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -621,6 +1042,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): } _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'}, @@ -629,11 +1052,15 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): def __init__( self, *, + id: Optional[str] = None, + etag: Optional[str] = None, private_endpoint: Optional["PrivateEndpoint"] = None, private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = 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 = None @@ -725,15 +1152,15 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. :type description: str - :param action_required: A message indicating if changes on the service provider require any + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -741,13 +1168,13 @@ def __init__( *, status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - action_required: Optional[str] = None, + actions_required: Optional[str] = None, **kwargs ): super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description - self.action_required = action_required + self.actions_required = actions_required class ResourceListResult(msrest.serialization.Model): @@ -781,20 +1208,25 @@ class ServiceSpecification(msrest.serialization.Model): :param log_specifications: Log specifications of operation. :type log_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.LogSpecification] + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: list[~azure.mgmt.keyvault.v2019_09_01.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): @@ -822,7 +1254,7 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"], + family: Union[str, "SkuFamily"] = "A", name: Union[str, "SkuName"], **kwargs ): @@ -1198,8 +1630,11 @@ class VaultProperties(msrest.serialization.Model): ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. + :param vault_uri: The URI of the vault for performing operations on keys and secrets. This + property is readonly. :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 @@ -1235,6 +1670,9 @@ class VaultProperties(msrest.serialization.Model): :param network_acls: Rules governing the accessibility of the key vault from specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet + :param provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :type provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1244,6 +1682,7 @@ class VaultProperties(msrest.serialization.Model): _validation = { 'tenant_id': {'required': True}, 'sku': {'required': True}, + 'hsm_pool_resource_id': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, } @@ -1252,6 +1691,7 @@ class VaultProperties(msrest.serialization.Model): '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'}, @@ -1261,6 +1701,7 @@ class VaultProperties(msrest.serialization.Model): '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]'}, } @@ -1280,6 +1721,7 @@ def __init__( 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, **kwargs ): super(VaultProperties, self).__init__(**kwargs) @@ -1287,6 +1729,7 @@ def __init__( 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 @@ -1296,6 +1739,7 @@ def __init__( 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 @@ -1308,6 +1752,9 @@ class VirtualNetworkRule(msrest.serialization.Model): '/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 = { @@ -1316,13 +1763,16 @@ class VirtualNetworkRule(msrest.serialization.Model): _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/v2019_09_01/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py index ad4413dd4cae..7b62b7166158 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py @@ -10,10 +10,12 @@ from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._operations import Operations +from ._keys_operations import KeysOperations __all__ = [ 'VaultsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', 'Operations', + 'KeysOperations', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py new file mode 100644 index 000000000000..61c2db2715f0 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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 = "2019-09-01" + 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.v2019_09_01.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 = "2019-09-01" + 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.v2019_09_01.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 = "2019-09-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'), + '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.v2019_09_01.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 = "2019-09-01" + 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.v2019_09_01.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 = "2019-09-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_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/v2019_09_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py index a7393136ec23..13cf909f52bd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # 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 @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py index 6634d6a13037..41f0934c87c6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -38,7 +38,7 @@ class PrivateEndpointConnectionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def get( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # 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. @@ -65,10 +65,10 @@ def get( :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.v2019_09_01.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -98,11 +98,13 @@ def get( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -115,10 +117,10 @@ def put( resource_group_name, # type: str vault_name, # type: str private_endpoint_connection_name, # type: str - properties, # type: "models.PrivateEndpointConnection" + properties, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # 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. @@ -135,7 +137,7 @@ def put( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,8 +194,8 @@ def _delete_initial( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PrivateEndpointConnection"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -249,7 +251,7 @@ def begin_delete( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.PrivateEndpointConnection"] + # 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. @@ -261,8 +263,8 @@ def begin_delete( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -270,7 +272,7 @@ def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -295,7 +297,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py index f28d08707d8c..c0630a4d1a68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class PrivateLinkResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_by_vault( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateLinkResourceListResult" + # 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. @@ -62,7 +62,7 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py index 75eecc42fc3d..34514dc10612 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class VaultsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,11 +51,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + # type: (...) -> "_models.Vault" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -109,10 +109,10 @@ def begin_create_or_update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.Vault"] + # 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. @@ -123,8 +123,8 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2019_09_01.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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -132,7 +132,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -157,7 +157,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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: @@ -175,10 +181,10 @@ def update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultPatchParameters" + parameters, # type: "_models.VaultPatchParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # 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. @@ -192,7 +198,7 @@ def update( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -266,6 +272,7 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -282,6 +289,7 @@ def delete( # 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) @@ -302,7 +310,7 @@ def get( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -314,7 +322,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -359,11 +367,11 @@ 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" + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + parameters, # type: "_models.VaultAccessPolicyParameters" **kwargs # type: Any ): - # type: (...) -> "models.VaultAccessPolicyParameters" + # 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. @@ -379,7 +387,7 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -436,7 +444,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -449,7 +457,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -512,7 +520,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -522,7 +530,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -583,7 +591,7 @@ def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeletedVaultListResult"] + # 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 @@ -591,7 +599,7 @@ def list_deleted( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -652,7 +660,7 @@ def get_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeletedVault" + # type: (...) -> "_models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -664,7 +672,7 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -718,6 +726,7 @@ def _purge_deleted_initial( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self._purge_deleted_initial.metadata['url'] # type: ignore @@ -734,6 +743,7 @@ def _purge_deleted_initial( # 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) @@ -763,8 +773,8 @@ def begin_purge_deleted( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -793,7 +803,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -812,7 +828,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -822,7 +838,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -883,10 +899,10 @@ def get_next(next_link=None): def check_name_availability( self, - vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" **kwargs # type: Any ): - # type: (...) -> "models.CheckNameAvailabilityResult" + # type: (...) -> "_models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -896,7 +912,7 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py index bd919b7d3ca8..d3a6247e4892 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py @@ -62,6 +62,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json index 2fd2010f7828..4a5b4ca67989 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json @@ -8,32 +8,35 @@ "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, - "has_lro_operations": true + "has_lro_operations": true, + "client_side_validation": false, + "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\"]}}}", + "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\"]}}}" }, "global_parameters": { - "sync_method": { + "sync": { "credential": { - "method_signature": "credential, # type: \"TokenCredential\"", + "signature": "credential, # type: \"TokenCredential\"", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials.TokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id, # type: str", "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", "docstring_type": "str", "required": true } }, - "async_method": { + "async": { "credential": { - "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "method_signature": "subscription_id, # type: str", + "signature": "subscription_id: 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 @@ -41,14 +44,58 @@ }, "constant": { }, - "call": "credential, subscription_id" + "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 + "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": { "vaults": "VaultsOperations", @@ -58,7 +105,9 @@ "managed_hsms": "ManagedHsmsOperations" }, "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + "sync_imports": "None", + "async_imports": "None", + "operations": { + } + } } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py index ce6a770f721c..54af762c448c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py @@ -59,6 +59,7 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.vaults = VaultsOperations( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py index 1a392de5cdd1..2596b185b1e8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class ManagedHsmsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,10 +47,10 @@ async def _create_or_update_initial( self, resource_group_name: str, name: str, - parameters: "models.ManagedHsm", + parameters: "_models.ManagedHsm", **kwargs - ) -> "models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + ) -> "_models.ManagedHsm": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -86,7 +86,7 @@ async def _create_or_update_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -105,9 +105,9 @@ async def begin_create_or_update( self, resource_group_name: str, name: str, - parameters: "models.ManagedHsm", + parameters: "_models.ManagedHsm", **kwargs - ) -> AsyncLROPoller["models.ManagedHsm"]: + ) -> 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. @@ -118,8 +118,8 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -127,7 +127,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -152,7 +152,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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: @@ -170,10 +176,10 @@ async def _update_initial( self, resource_group_name: str, name: str, - parameters: "models.ManagedHsm", + parameters: "_models.ManagedHsm", **kwargs - ) -> "models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + ) -> "_models.ManagedHsm": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -209,7 +215,7 @@ async def _update_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -228,9 +234,9 @@ async def begin_update( self, resource_group_name: str, name: str, - parameters: "models.ManagedHsm", + parameters: "_models.ManagedHsm", **kwargs - ) -> AsyncLROPoller["models.ManagedHsm"]: + ) -> 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. @@ -241,8 +247,8 @@ async def begin_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -250,7 +256,7 @@ async def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -275,7 +281,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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: @@ -326,7 +338,7 @@ async def _delete_initial( 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(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -348,8 +360,8 @@ async def begin_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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -378,7 +390,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + '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: @@ -397,7 +415,7 @@ async def get( resource_group_name: str, name: str, **kwargs - ) -> "models.ManagedHsm": + ) -> Optional["_models.ManagedHsm"]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -406,10 +424,10 @@ async def get( :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.v2020_04_01_preview.models.ManagedHsm + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -438,12 +456,14 @@ async def get( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedHsm', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -456,7 +476,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ManagedHsmListResult"]: + ) -> AsyncIterable["_models.ManagedHsmListResult"]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -469,7 +489,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsmListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -517,7 +537,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ManagedHsmError, response) + 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) @@ -532,7 +552,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ManagedHsmListResult"]: + ) -> AsyncIterable["_models.ManagedHsmListResult"]: """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -543,7 +563,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsmListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -590,7 +610,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ManagedHsmError, response) + 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) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py index b7fd0a186d42..5447f3c801ac 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -33,7 +33,7 @@ class Operations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -44,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, **kwargs - ) -> AsyncIterable["models.OperationListResult"]: + ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -52,7 +52,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py index 8cfd0cd24389..add077c37bb5 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -34,7 +34,7 @@ class PrivateEndpointConnectionsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -48,7 +48,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> 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. @@ -60,10 +60,10 @@ async def get( :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.v2020_04_01_preview.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -93,11 +93,13 @@ async def get( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -110,9 +112,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "models.PrivateEndpointConnection", + properties: "_models.PrivateEndpointConnection", **kwargs - ) -> "models.PrivateEndpointConnection": + ) -> "_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. @@ -129,7 +131,7 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -185,8 +187,8 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> Optional["models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + ) -> Optional["_models.PrivateEndpointConnection"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -241,7 +243,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs - ) -> AsyncLROPoller["models.PrivateEndpointConnection"]: + ) -> 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. @@ -253,8 +255,8 @@ async def begin_delete( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -262,7 +264,7 @@ async def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -287,7 +289,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py index a1fca642a74f..f79276b397ac 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core.exceptions import ARMErrorFormat -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -32,7 +32,7 @@ class PrivateLinkResourcesOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -45,7 +45,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.PrivateLinkResourceListResult": + ) -> "_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. @@ -57,7 +57,7 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py index 54fb6c383db7..ecaefdf0c8ac 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models +from ... import models as _models T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -35,7 +35,7 @@ class VaultsOperations: :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer) -> None: self._client = client @@ -47,10 +47,10 @@ async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> "models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + ) -> "_models.Vault": + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -104,9 +104,9 @@ async def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultCreateOrUpdateParameters", + parameters: "_models.VaultCreateOrUpdateParameters", **kwargs - ) -> AsyncLROPoller["models.Vault"]: + ) -> 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. @@ -117,8 +117,8 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -126,7 +126,7 @@ async def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -151,7 +151,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + 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: @@ -169,9 +175,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "models.VaultPatchParameters", + parameters: "_models.VaultPatchParameters", **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -185,7 +191,7 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -258,6 +264,7 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -274,6 +281,7 @@ async def delete( # 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) @@ -293,7 +301,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs - ) -> "models.Vault": + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -305,7 +313,7 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -350,10 +358,10 @@ async def update_access_policy( self, resource_group_name: str, vault_name: str, - operation_kind: Union[str, "models.AccessPolicyUpdateKind"], - parameters: "models.VaultAccessPolicyParameters", + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", **kwargs - ) -> "models.VaultAccessPolicyParameters": + ) -> "_models.VaultAccessPolicyParameters": """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -369,7 +377,7 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -425,7 +433,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -438,7 +446,7 @@ def list_by_resource_group( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -500,7 +508,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.VaultListResult"]: + ) -> AsyncIterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -510,7 +518,7 @@ def list_by_subscription( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -570,7 +578,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs - ) -> AsyncIterable["models.DeletedVaultListResult"]: + ) -> AsyncIterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -578,7 +586,7 @@ def list_deleted( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -638,7 +646,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs - ) -> "models.DeletedVault": + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -650,7 +658,7 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -703,6 +711,7 @@ async def _purge_deleted_initial( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self._purge_deleted_initial.metadata['url'] # type: ignore @@ -719,6 +728,7 @@ async def _purge_deleted_initial( # 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) @@ -747,8 +757,8 @@ async def begin_purge_deleted( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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) @@ -777,7 +787,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -795,7 +811,7 @@ def list( self, top: Optional[int] = None, **kwargs - ) -> AsyncIterable["models.ResourceListResult"]: + ) -> AsyncIterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -805,7 +821,7 @@ def list( :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -866,9 +882,9 @@ async def get_next(next_link=None): async def check_name_availability( self, - vault_name: "models.VaultCheckNameAvailabilityParameters", + vault_name: "_models.VaultCheckNameAvailabilityParameters", **kwargs - ) -> "models.CheckNameAvailabilityResult": + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -878,7 +894,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py index bf8ab6a200c3..167c19127358 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py @@ -13,6 +13,7 @@ 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 LogSpecification @@ -22,6 +23,7 @@ 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 @@ -54,6 +56,7 @@ 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 LogSpecification # type: ignore @@ -63,6 +66,7 @@ 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 @@ -106,6 +110,7 @@ SkuFamily, SkuName, StoragePermissions, + VaultProvisioningState, ) __all__ = [ @@ -115,6 +120,7 @@ 'DeletedVault', 'DeletedVaultListResult', 'DeletedVaultProperties', + 'DimensionProperties', 'Error', 'IPRule', 'LogSpecification', @@ -124,6 +130,7 @@ 'ManagedHsmProperties', 'ManagedHsmResource', 'ManagedHsmSku', + 'MetricSpecification', 'NetworkRuleSet', 'Operation', 'OperationDisplay', @@ -165,4 +172,5 @@ 'SkuFamily', 'SkuName', 'StoragePermissions', + 'VaultProvisioningState', ] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py index 89443ea901e9..8efdec8db877 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py @@ -34,6 +34,7 @@ class AccessPolicyUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" DELETE = "delete" @@ -60,6 +61,7 @@ class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" ENCRYPT = "encrypt" DECRYPT = "decrypt" WRAP_KEY = "wrapKey" @@ -130,14 +132,22 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state. """ - SUCCEEDED = "Succeeded" #: The managed HSM Pool has been full provisioned. - PROVISIONING = "Provisioning" #: The managed HSM Pool is currently being provisioned. - FAILED = "Failed" #: Provisioning of the managed HSM Pool has failed. - UPDATING = "Updating" #: The managed HSM Pool is currently being updated. - DELETING = "Deleting" #: The managed HSM Pool is currently being deleted. - ACTIVATED = "Activated" #: The managed HSM pool is ready for normal use. - SECURITY_DOMAIN_RESTORE = "SecurityDomainRestore" #: The managed HSM pool is waiting for a security domain restore action. - RESTORING = "Restoring" #: The managed HSM pool is being restored from full HSM backup. + #: 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 Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """The reason that a vault name could not be used. The Reason element is only returned if @@ -149,6 +159,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" SET = "set" @@ -173,6 +184,7 @@ class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + ALL = "all" GET = "get" LIST = "list" DELETE = "delete" @@ -187,3 +199,10 @@ class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): 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/v2020_04_01_preview/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py index 948fc2a0038a..ecfdb9b7f4d9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py @@ -192,6 +192,8 @@ class DeletedVaultProperties(msrest.serialization.Model): :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 = { @@ -200,6 +202,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'readonly': True}, 'scheduled_purge_date': {'readonly': True}, 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, } _attribute_map = { @@ -208,6 +211,7 @@ class DeletedVaultProperties(msrest.serialization.Model): '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__( @@ -220,6 +224,35 @@ def __init__( 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): @@ -461,8 +494,8 @@ class ManagedHsmProperties(msrest.serialization.Model): :param initial_admin_object_ids: Array of initial administrators object ids for this managed hsm pool. :type initial_admin_object_ids: list[str] - :param hsm_uri: The URI of the managed hsm pool for performing operations on keys. - :type hsm_uri: 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 @@ -489,6 +522,7 @@ class ManagedHsmProperties(msrest.serialization.Model): """ _validation = { + 'hsm_uri': {'readonly': True}, 'status_message': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -512,10 +546,10 @@ def __init__( 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 = kwargs.get('hsm_uri', 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', None) + 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 @@ -548,10 +582,70 @@ def __init__( **kwargs ): super(ManagedHsmSku, self).__init__(**kwargs) - self.family = kwargs['family'] + 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.v2020_04_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 NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. @@ -597,6 +691,8 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.keyvault.v2020_04_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.v2020_04_01_preview.models.ServiceSpecification @@ -606,6 +702,7 @@ class Operation(msrest.serialization.Model): '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'}, } @@ -617,6 +714,7 @@ def __init__( 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) @@ -791,6 +889,8 @@ class PrivateEndpointConnection(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.v2020_04_01_preview.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -817,6 +917,7 @@ class PrivateEndpointConnection(Resource): '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'}, @@ -827,6 +928,7 @@ def __init__( **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 = None @@ -837,6 +939,10 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + :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.v2020_04_01_preview.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -853,6 +959,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): } _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'}, @@ -863,6 +971,8 @@ def __init__( **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 = None @@ -950,15 +1060,15 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. :type description: str - :param action_required: A message indicating if changes on the service provider require any + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -968,7 +1078,7 @@ def __init__( super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = kwargs.get('status', None) self.description = kwargs.get('description', None) - self.action_required = kwargs.get('action_required', None) + self.actions_required = kwargs.get('actions_required', None) class ResourceListResult(msrest.serialization.Model): @@ -1000,10 +1110,14 @@ class ServiceSpecification(msrest.serialization.Model): :param log_specifications: Log specifications of operation. :type log_specifications: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.LogSpecification] + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.MetricSpecification] """ _attribute_map = { 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, } def __init__( @@ -1012,6 +1126,7 @@ def __init__( ): 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): @@ -1041,7 +1156,7 @@ def __init__( **kwargs ): super(Sku, self).__init__(**kwargs) - self.family = kwargs['family'] + self.family = kwargs.get('family', "A") self.name = kwargs['name'] @@ -1379,8 +1494,11 @@ class VaultProperties(msrest.serialization.Model): ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. :type access_policies: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. + :param vault_uri: The URI of the vault for performing operations on keys and secrets. This + property is readonly. :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 @@ -1416,6 +1534,10 @@ class VaultProperties(msrest.serialization.Model): :param network_acls: Rules governing the accessibility of the key vault from specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2020_04_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.v2020_04_01_preview.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1425,6 +1547,7 @@ class VaultProperties(msrest.serialization.Model): _validation = { 'tenant_id': {'required': True}, 'sku': {'required': True}, + 'hsm_pool_resource_id': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, } @@ -1433,6 +1556,7 @@ class VaultProperties(msrest.serialization.Model): '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'}, @@ -1442,6 +1566,7 @@ class VaultProperties(msrest.serialization.Model): '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]'}, } @@ -1454,6 +1579,7 @@ def __init__( 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) @@ -1463,6 +1589,7 @@ def __init__( 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 @@ -1475,6 +1602,9 @@ class VirtualNetworkRule(msrest.serialization.Model): '/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 = { @@ -1483,6 +1613,7 @@ class VirtualNetworkRule(msrest.serialization.Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, } def __init__( @@ -1491,3 +1622,4 @@ def __init__( ): 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/v2020_04_01_preview/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py index 4b587f953ad7..cbec9e28ec46 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py @@ -209,6 +209,8 @@ class DeletedVaultProperties(msrest.serialization.Model): :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 = { @@ -217,6 +219,7 @@ class DeletedVaultProperties(msrest.serialization.Model): 'deletion_date': {'readonly': True}, 'scheduled_purge_date': {'readonly': True}, 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, } _attribute_map = { @@ -225,6 +228,7 @@ class DeletedVaultProperties(msrest.serialization.Model): '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__( @@ -237,6 +241,39 @@ def __init__( 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): @@ -496,8 +533,8 @@ class ManagedHsmProperties(msrest.serialization.Model): :param initial_admin_object_ids: Array of initial administrators object ids for this managed hsm pool. :type initial_admin_object_ids: list[str] - :param hsm_uri: The URI of the managed hsm pool for performing operations on keys. - :type hsm_uri: 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 @@ -524,6 +561,7 @@ class ManagedHsmProperties(msrest.serialization.Model): """ _validation = { + 'hsm_uri': {'readonly': True}, 'status_message': {'readonly': True}, 'provisioning_state': {'readonly': True}, } @@ -545,17 +583,16 @@ def __init__( *, tenant_id: Optional[str] = None, initial_admin_object_ids: Optional[List[str]] = None, - hsm_uri: Optional[str] = None, enable_soft_delete: Optional[bool] = True, soft_delete_retention_in_days: Optional[int] = 90, - enable_purge_protection: Optional[bool] = None, + enable_purge_protection: Optional[bool] = True, create_mode: Optional[Union[str, "CreateMode"]] = None, **kwargs ): super(ManagedHsmProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.initial_admin_object_ids = initial_admin_object_ids - self.hsm_uri = hsm_uri + 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 @@ -589,7 +626,7 @@ class ManagedHsmSku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "ManagedHsmSkuFamily"], + family: Union[str, "ManagedHsmSkuFamily"] = "B", name: Union[str, "ManagedHsmSkuName"], **kwargs ): @@ -598,6 +635,78 @@ def __init__( 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.v2020_04_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 NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. @@ -648,6 +757,8 @@ class Operation(msrest.serialization.Model): :type display: ~azure.mgmt.keyvault.v2020_04_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.v2020_04_01_preview.models.ServiceSpecification @@ -657,6 +768,7 @@ class Operation(msrest.serialization.Model): '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'}, } @@ -666,6 +778,7 @@ def __init__( name: Optional[str] = None, display: Optional["OperationDisplay"] = None, origin: Optional[str] = None, + is_data_action: Optional[bool] = None, service_specification: Optional["ServiceSpecification"] = None, **kwargs ): @@ -673,6 +786,7 @@ def __init__( self.name = name self.display = display self.origin = origin + self.is_data_action = is_data_action self.service_specification = service_specification @@ -860,6 +974,8 @@ class PrivateEndpointConnection(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.v2020_04_01_preview.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -886,6 +1002,7 @@ class PrivateEndpointConnection(Resource): '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'}, @@ -894,11 +1011,13 @@ class PrivateEndpointConnection(Resource): def __init__( self, *, + etag: Optional[str] = None, private_endpoint: Optional["PrivateEndpoint"] = None, private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = 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 = None @@ -909,6 +1028,10 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. + :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.v2020_04_01_preview.models.PrivateEndpoint :param private_link_service_connection_state: Approval state of the private link connection. @@ -925,6 +1048,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): } _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'}, @@ -933,11 +1058,15 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): def __init__( self, *, + id: Optional[str] = None, + etag: Optional[str] = None, private_endpoint: Optional["PrivateEndpoint"] = None, private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = 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 = None @@ -1029,15 +1158,15 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointServiceConnectionStatus :param description: The reason for approval or rejection. :type description: str - :param action_required: A message indicating if changes on the service provider require any + :param actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :type actions_required: str """ _attribute_map = { 'status': {'key': 'status', 'type': 'str'}, 'description': {'key': 'description', 'type': 'str'}, - 'action_required': {'key': 'actionRequired', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, } def __init__( @@ -1045,13 +1174,13 @@ def __init__( *, status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - action_required: Optional[str] = None, + actions_required: Optional[str] = None, **kwargs ): super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description - self.action_required = action_required + self.actions_required = actions_required class ResourceListResult(msrest.serialization.Model): @@ -1086,20 +1215,26 @@ class ServiceSpecification(msrest.serialization.Model): :param log_specifications: Log specifications of operation. :type log_specifications: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.LogSpecification] + :param metric_specifications: Metric specifications of operation. + :type metric_specifications: + list[~azure.mgmt.keyvault.v2020_04_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): @@ -1127,7 +1262,7 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"], + family: Union[str, "SkuFamily"] = "A", name: Union[str, "SkuName"], **kwargs ): @@ -1503,8 +1638,11 @@ class VaultProperties(msrest.serialization.Model): ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. :type access_policies: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. + :param vault_uri: The URI of the vault for performing operations on keys and secrets. This + property is readonly. :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 @@ -1540,6 +1678,10 @@ class VaultProperties(msrest.serialization.Model): :param network_acls: Rules governing the accessibility of the key vault from specific network locations. :type network_acls: ~azure.mgmt.keyvault.v2020_04_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.v2020_04_01_preview.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1549,6 +1691,7 @@ class VaultProperties(msrest.serialization.Model): _validation = { 'tenant_id': {'required': True}, 'sku': {'required': True}, + 'hsm_pool_resource_id': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, } @@ -1557,6 +1700,7 @@ class VaultProperties(msrest.serialization.Model): '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'}, @@ -1566,6 +1710,7 @@ class VaultProperties(msrest.serialization.Model): '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]'}, } @@ -1585,6 +1730,7 @@ def __init__( 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, **kwargs ): super(VaultProperties, self).__init__(**kwargs) @@ -1592,6 +1738,7 @@ def __init__( 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 @@ -1601,6 +1748,7 @@ def __init__( 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 @@ -1613,6 +1761,9 @@ class VirtualNetworkRule(msrest.serialization.Model): '/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 = { @@ -1621,13 +1772,16 @@ class VirtualNetworkRule(msrest.serialization.Model): _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/v2020_04_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py index f4470695b919..062af974b272 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class ManagedHsmsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,11 +51,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str name, # type: str - parameters, # type: "models.ManagedHsm" + parameters, # type: "_models.ManagedHsm" **kwargs # type: Any ): - # type: (...) -> "models.ManagedHsm" - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + # type: (...) -> "_models.ManagedHsm" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -91,7 +91,7 @@ def _create_or_update_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -110,10 +110,10 @@ def begin_create_or_update( self, resource_group_name, # type: str name, # type: str - parameters, # type: "models.ManagedHsm" + parameters, # type: "_models.ManagedHsm" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ManagedHsm"] + # 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. @@ -124,8 +124,8 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -133,7 +133,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -158,7 +158,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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: @@ -176,11 +182,11 @@ def _update_initial( self, resource_group_name, # type: str name, # type: str - parameters, # type: "models.ManagedHsm" + parameters, # type: "_models.ManagedHsm" **kwargs # type: Any ): - # type: (...) -> "models.ManagedHsm" - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + # type: (...) -> "_models.ManagedHsm" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -216,7 +222,7 @@ def _update_initial( if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -235,10 +241,10 @@ def begin_update( self, resource_group_name, # type: str name, # type: str - parameters, # type: "models.ManagedHsm" + parameters, # type: "_models.ManagedHsm" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.ManagedHsm"] + # 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. @@ -249,8 +255,8 @@ def begin_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -258,7 +264,7 @@ def begin_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -283,7 +289,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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: @@ -335,7 +347,7 @@ def _delete_initial( 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(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -358,8 +370,8 @@ def begin_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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -388,7 +400,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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: @@ -408,7 +426,7 @@ def get( name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.ManagedHsm" + # 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. @@ -417,10 +435,10 @@ def get( :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.v2020_04_01_preview.models.ManagedHsm + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsm"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -449,12 +467,14 @@ def get( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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(models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize('ManagedHsm', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -468,7 +488,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagedHsmListResult"] + # type: (...) -> Iterable["_models.ManagedHsmListResult"] """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -481,7 +501,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsmListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -529,7 +549,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ManagedHsmError, response) + 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) @@ -545,7 +565,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ManagedHsmListResult"] + # type: (...) -> Iterable["_models.ManagedHsmListResult"] """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -556,7 +576,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ManagedHsmListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -603,7 +623,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(models.ManagedHsmError, response) + 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) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py index d5352d2ccd47..41b8ad4cbfdc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py @@ -14,7 +14,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -37,7 +37,7 @@ class Operations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -49,7 +49,7 @@ def list( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.OperationListResult"] + # 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 @@ -57,7 +57,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py index 613b6990116e..69f772bcda2c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py @@ -15,7 +15,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -38,7 +38,7 @@ class PrivateEndpointConnectionsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -53,7 +53,7 @@ def get( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # 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. @@ -65,10 +65,10 @@ def get( :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.v2020_04_01_preview.models.PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -98,11 +98,13 @@ def get( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = self._deserialize('PrivateEndpointConnection', pipeline_response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -115,10 +117,10 @@ def put( resource_group_name, # type: str vault_name, # type: str private_endpoint_connection_name, # type: str - properties, # type: "models.PrivateEndpointConnection" + properties, # type: "_models.PrivateEndpointConnection" **kwargs # type: Any ): - # type: (...) -> "models.PrivateEndpointConnection" + # 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. @@ -135,7 +137,7 @@ def put( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -192,8 +194,8 @@ def _delete_initial( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> Optional["models.PrivateEndpointConnection"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.PrivateEndpointConnection"]] + # type: (...) -> Optional["_models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -249,7 +251,7 @@ def begin_delete( private_endpoint_connection_name, # type: str **kwargs # type: Any ): - # type: (...) -> LROPoller["models.PrivateEndpointConnection"] + # 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. @@ -261,8 +263,8 @@ def begin_delete( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -270,7 +272,7 @@ def begin_delete( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -295,7 +297,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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: diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py index dc2dd1396d84..b8745ac3ead7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py @@ -13,7 +13,7 @@ from azure.core.pipeline.transport import HttpRequest, HttpResponse from azure.mgmt.core.exceptions import ARMErrorFormat -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -36,7 +36,7 @@ class PrivateLinkResourcesOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -50,7 +50,7 @@ def list_by_vault( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.PrivateLinkResourceListResult" + # 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. @@ -62,7 +62,7 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py index 8a47698f6909..b294cbe1ac93 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py @@ -16,7 +16,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models +from .. import models as _models if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -39,7 +39,7 @@ class VaultsOperations(object): :param deserializer: An object model deserializer. """ - models = models + models = _models def __init__(self, client, config, serializer, deserializer): self._client = client @@ -51,11 +51,11 @@ def _create_or_update_initial( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + # type: (...) -> "_models.Vault" + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -109,10 +109,10 @@ def begin_create_or_update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultCreateOrUpdateParameters" + parameters, # type: "_models.VaultCreateOrUpdateParameters" **kwargs # type: Any ): - # type: (...) -> LROPoller["models.Vault"] + # 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. @@ -123,8 +123,8 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -132,7 +132,7 @@ def begin_create_or_update( :raises ~azure.core.exceptions.HttpResponseError: """ polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval @@ -157,7 +157,13 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + 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: @@ -175,10 +181,10 @@ def update( self, resource_group_name, # type: str vault_name, # type: str - parameters, # type: "models.VaultPatchParameters" + parameters, # type: "_models.VaultPatchParameters" **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # 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. @@ -192,7 +198,7 @@ def update( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -266,6 +272,7 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -282,6 +289,7 @@ def delete( # 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) @@ -302,7 +310,7 @@ def get( vault_name, # type: str **kwargs # type: Any ): - # type: (...) -> "models.Vault" + # type: (...) -> "_models.Vault" """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -314,7 +322,7 @@ def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -359,11 +367,11 @@ 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" + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + parameters, # type: "_models.VaultAccessPolicyParameters" **kwargs # type: Any ): - # type: (...) -> "models.VaultAccessPolicyParameters" + # 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. @@ -379,7 +387,7 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -436,7 +444,7 @@ def list_by_resource_group( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -449,7 +457,7 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -512,7 +520,7 @@ def list_by_subscription( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.VaultListResult"] + # type: (...) -> Iterable["_models.VaultListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -522,7 +530,7 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.VaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -583,7 +591,7 @@ def list_deleted( self, **kwargs # type: Any ): - # type: (...) -> Iterable["models.DeletedVaultListResult"] + # 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 @@ -591,7 +599,7 @@ def list_deleted( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -652,7 +660,7 @@ def get_deleted( location, # type: str **kwargs # type: Any ): - # type: (...) -> "models.DeletedVault" + # type: (...) -> "_models.DeletedVault" """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -664,7 +672,7 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -718,6 +726,7 @@ def _purge_deleted_initial( } error_map.update(kwargs.pop('error_map', {})) api_version = "2019-09-01" + accept = "application/json" # Construct URL url = self._purge_deleted_initial.metadata['url'] # type: ignore @@ -734,6 +743,7 @@ def _purge_deleted_initial( # 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) @@ -763,8 +773,8 @@ def begin_purge_deleted( :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: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy + :keyword polling: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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) @@ -793,7 +803,13 @@ def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + path_format_arguments = { + 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), + 'location': self._serialize.url("location", location, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -812,7 +828,7 @@ def list( top=None, # type: Optional[int] **kwargs # type: Any ): - # type: (...) -> Iterable["models.ResourceListResult"] + # type: (...) -> Iterable["_models.ResourceListResult"] """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -822,7 +838,7 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceListResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } @@ -883,10 +899,10 @@ def get_next(next_link=None): def check_name_availability( self, - vault_name, # type: "models.VaultCheckNameAvailabilityParameters" + vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" **kwargs # type: Any ): - # type: (...) -> "models.CheckNameAvailabilityResult" + # type: (...) -> "_models.CheckNameAvailabilityResult" """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -896,7 +912,7 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/__init__.py new file mode 100644 index 000000000000..e03c4a3b857a --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/__init__.py @@ -0,0 +1,16 @@ +# 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'] + +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_04_01_preview/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_configuration.py new file mode 100644 index 000000000000..aaf44887a796 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_configuration.py @@ -0,0 +1,70 @@ +# 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + +VERSION = "unknown" + +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-04-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_04_01_preview/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_key_vault_management_client.py new file mode 100644 index 000000000000..dc33d4f92288 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_key_vault_management_client.py @@ -0,0 +1,105 @@ +# 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 ._configuration import KeyVaultManagementClientConfiguration +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 vaults: VaultsOperations operations + :vartype vaults: azure.mgmt.keyvault.v2021_04_01_preview.operations.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.keyvault.v2021_04_01_preview.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.keyvault.v2021_04_01_preview.operations.PrivateLinkResourcesOperations + :ivar managed_hsms: ManagedHsmsOperations operations + :vartype managed_hsms: azure.mgmt.keyvault.v2021_04_01_preview.operations.ManagedHsmsOperations + :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations + :vartype mhsm_private_endpoint_connections: azure.mgmt.keyvault.v2021_04_01_preview.operations.MHSMPrivateEndpointConnectionsOperations + :ivar mhsm_private_link_resources: MHSMPrivateLinkResourcesOperations operations + :vartype mhsm_private_link_resources: azure.mgmt.keyvault.v2021_04_01_preview.operations.MHSMPrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2021_04_01_preview.operations.Operations + :ivar secrets: SecretsOperations operations + :vartype secrets: azure.mgmt.keyvault.v2021_04_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.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 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_04_01_preview/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_metadata.json new file mode 100644 index 000000000000..04e6e36792fc --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_metadata.json @@ -0,0 +1,116 @@ +{ + "chosen_version": "2021-04-01-preview", + "total_api_version_list": ["2021-04-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\"]}}}", + "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\"]}}}" + }, + "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": { + "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" + }, + "operation_mixins": { + "sync_imports": "None", + "async_imports": "None", + "operations": { + } + } +} \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/__init__.py new file mode 100644 index 000000000000..f54ed88d6ad2 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_01_preview/aio/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_configuration.py new file mode 100644 index 000000000000..15d450b6d502 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_configuration.py @@ -0,0 +1,66 @@ +# 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +VERSION = "unknown" + +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-04-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_04_01_preview/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_key_vault_management_client.py new file mode 100644 index 000000000000..ff91501b5677 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_key_vault_management_client.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, Optional, TYPE_CHECKING + +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 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 vaults: VaultsOperations operations + :vartype vaults: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.PrivateLinkResourcesOperations + :ivar managed_hsms: ManagedHsmsOperations operations + :vartype managed_hsms: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.ManagedHsmsOperations + :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations + :vartype mhsm_private_endpoint_connections: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.MHSMPrivateEndpointConnectionsOperations + :ivar mhsm_private_link_resources: MHSMPrivateLinkResourcesOperations operations + :vartype mhsm_private_link_resources: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.MHSMPrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.Operations + :ivar secrets: SecretsOperations operations + :vartype secrets: azure.mgmt.keyvault.v2021_04_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.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 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_04_01_preview/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/__init__.py new file mode 100644 index 000000000000..405215be5f3a --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/__init__.py @@ -0,0 +1,27 @@ +# 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 ._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__ = [ + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ManagedHsmsOperations', + 'MHSMPrivateEndpointConnectionsOperations', + 'MHSMPrivateLinkResourcesOperations', + 'Operations', + 'SecretsOperations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py new file mode 100644 index 000000000000..331a5c253681 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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 + ) -> "_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-04-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 + ) -> 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_04_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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_04_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 + ) -> "_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-04-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 + ) -> 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_04_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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_04_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 + ) -> 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-04-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 + ) -> 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 + ) -> 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_04_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-04-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 + ) -> 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_04_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-04-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 + ) -> 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_04_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-04-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 + ) -> 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_04_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-04-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 + ) -> "_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_04_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-04-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 + ) -> 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-04-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 + ) -> 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..a303e5879ac5 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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 + ) -> 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_04_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-04-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 + ) -> "_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_04_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-04-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 + ) -> "_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_04_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_04_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-04-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 + ) -> 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-04-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 + ) -> 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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_04_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_04_01_preview/aio/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_link_resources_operations.py new file mode 100644 index 000000000000..09382c7e6df8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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 + ) -> "_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_04_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-04-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_04_01_preview/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_operations.py new file mode 100644 index 000000000000..0f8150c26439 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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 + ) -> 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_04_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-04-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_04_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..601a4ed10a74 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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 + ) -> 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_04_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-04-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 + ) -> "_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_04_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_04_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-04-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 + ) -> 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-04-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 + ) -> 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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_04_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 + ) -> 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_04_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-04-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_04_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..6dd88a01b436 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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 + ) -> "_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_04_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-04-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_04_01_preview/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_secrets_operations.py new file mode 100644 index 000000000000..720a3001a206 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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 + ) -> "_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_04_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_04_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-04-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 + ) -> "_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_04_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_04_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-04-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 + ) -> "_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_04_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-04-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 + ) -> 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_04_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-04-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_04_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py new file mode 100644 index 000000000000..5ed5ac0a90b5 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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 + ) -> "_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-04-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 + ) -> 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_04_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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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_04_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 + ) -> "_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_04_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_04_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-04-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 + ) -> 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-04-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 + ) -> "_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_04_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-04-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 + ) -> "_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_04_01_preview.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. + :type parameters: ~azure.mgmt.keyvault.v2021_04_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_04_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-04-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 + ) -> 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_04_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-04-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 + ) -> 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_04_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-04-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 + ) -> 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_04_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-04-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 + ) -> "_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_04_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-04-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 + ) -> 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-04-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 + ) -> 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: Pass in True if you'd like the AsyncARMPolling polling method, + False for no polling, or 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 + ) -> 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_04_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 = "2021-04-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'), + } + 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 + ) -> "_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_04_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_04_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-04-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_04_01_preview/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/__init__.py new file mode 100644 index 000000000000..1dd5be1732bf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/__init__.py @@ -0,0 +1,245 @@ +# 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 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 Error + from ._models_py3 import IPRule + 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 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 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 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 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 Error # type: ignore + from ._models import IPRule # 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 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 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 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, + IdentityType, + KeyPermissions, + ManagedHsmSkuFamily, + ManagedHsmSkuName, + NetworkRuleAction, + NetworkRuleBypassOptions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicNetworkAccess, + Reason, + SecretPermissions, + SkuFamily, + SkuName, + StoragePermissions, + VaultProvisioningState, +) + +__all__ = [ + 'AccessPolicyEntry', + 'Attributes', + 'CheckNameAvailabilityResult', + 'CloudErrorBody', + 'DeletedManagedHsm', + 'DeletedManagedHsmListResult', + 'DeletedManagedHsmProperties', + 'DeletedVault', + 'DeletedVaultListResult', + 'DeletedVaultProperties', + 'Error', + 'IPRule', + 'LogSpecification', + 'MHSMIPRule', + 'MHSMNetworkRuleSet', + 'MHSMPrivateEndpoint', + 'MHSMPrivateEndpointConnection', + 'MHSMPrivateEndpointConnectionItem', + 'MHSMPrivateEndpointConnectionsListResult', + 'MHSMPrivateLinkResource', + 'MHSMPrivateLinkResourceListResult', + 'MHSMPrivateLinkServiceConnectionState', + 'MHSMVirtualNetworkRule', + 'ManagedHsm', + 'ManagedHsmError', + 'ManagedHsmListResult', + 'ManagedHsmProperties', + 'ManagedHsmResource', + 'ManagedHsmSku', + 'NetworkRuleSet', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'Permissions', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionItem', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'Resource', + 'ResourceListResult', + 'Secret', + 'SecretAttributes', + 'SecretCreateOrUpdateParameters', + 'SecretListResult', + 'SecretPatchParameters', + 'SecretPatchProperties', + 'SecretProperties', + 'ServiceSpecification', + 'Sku', + 'SystemData', + 'Vault', + 'VaultAccessPolicyParameters', + 'VaultAccessPolicyProperties', + 'VaultCheckNameAvailabilityParameters', + 'VaultCreateOrUpdateParameters', + 'VaultListResult', + 'VaultPatchParameters', + 'VaultPatchProperties', + 'VaultProperties', + 'VirtualNetworkRule', + 'AccessPolicyUpdateKind', + 'ActionsRequired', + 'CertificatePermissions', + 'CreateMode', + 'IdentityType', + 'KeyPermissions', + '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_04_01_preview/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_key_vault_management_client_enums.py new file mode 100644 index 000000000000..94718f1009c0 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_key_vault_management_client_enums.py @@ -0,0 +1,227 @@ +# 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)): + + 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 IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + 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" + +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)): + + 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)): + + 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_04_01_preview/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models.py new file mode 100644 index 000000000000..30fe169da585 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models.py @@ -0,0 +1,2336 @@ +# 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_04_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 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: 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 + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'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'}, + } + + 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_04_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_04_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_04_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_04_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_04_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 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_04_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 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_04_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_04_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_04_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_04_01_preview.models.SystemData + :param properties: Properties of the managed HSM. + :type properties: ~azure.mgmt.keyvault.v2021_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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 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_04_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_04_01_preview.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMIPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.keyvault.v2021_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_01_preview.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.IPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.keyvault.v2021_04_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_04_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_04_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_04_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_04_01_preview.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2021_04_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 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 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_04_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_04_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_04_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 private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2021_04_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_04_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_04_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _attribute_map = { + '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.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_04_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_04_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_04_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_04_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_04_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 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_04_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: 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 + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'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'}, + } + + 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_04_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_04_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_04_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_04_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_04_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_04_01_preview.models.LogSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = kwargs.get('log_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_04_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_04_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_04_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_04_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 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_04_01_preview.models.SystemData + :param properties: Required. Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2021_04_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_04_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_04_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: Required. The type of resource, Microsoft.KeyVault/vaults. Default 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_04_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_04_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_04_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_04_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_04_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_04_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_04_01_preview.models.NetworkRuleSet + """ + + _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'}, + } + + 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) + + +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_04_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_04_01_preview.models.AccessPolicyEntry] + :param vault_uri: The URI of the vault for performing operations on keys and secrets. + :type vault_uri: 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_04_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_04_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_04_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_04_01_preview.models.PrivateEndpointConnectionItem] + """ + + _validation = { + 'tenant_id': {'required': True}, + 'sku': {'required': 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'}, + '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]'}, + } + + 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.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 + + +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 + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = kwargs['id'] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models_py3.py new file mode 100644 index 000000000000..e66f8231e3ec --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models_py3.py @@ -0,0 +1,2560 @@ +# 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_04_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 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: 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 + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'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'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[int] = None, + expires: Optional[int] = 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_04_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_04_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_04_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_04_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_04_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 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_04_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 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_04_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_04_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_04_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_04_01_preview.models.SystemData + :param properties: Properties of the managed HSM. + :type properties: ~azure.mgmt.keyvault.v2021_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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 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_04_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_04_01_preview.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMIPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.keyvault.v2021_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_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_04_01_preview.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.IPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: + list[~azure.mgmt.keyvault.v2021_04_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_04_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_04_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_04_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_04_01_preview.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2021_04_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 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 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_04_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_04_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_04_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 private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2021_04_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_04_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_04_01_preview.models.PrivateEndpointConnectionProvisioningState + """ + + _attribute_map = { + '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, + *, + 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.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_04_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_04_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_04_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_04_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_04_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 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_04_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: 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 + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'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'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[int] = None, + expires: Optional[int] = 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_04_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_04_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_04_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_04_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_04_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_04_01_preview.models.LogSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_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_04_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_04_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_04_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_04_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 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_04_01_preview.models.SystemData + :param properties: Required. Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2021_04_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_04_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_04_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: Required. The type of resource, Microsoft.KeyVault/vaults. Default 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_04_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_04_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_04_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_04_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_04_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_04_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_04_01_preview.models.NetworkRuleSet + """ + + _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'}, + } + + 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, + **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 + + +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_04_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_04_01_preview.models.AccessPolicyEntry] + :param vault_uri: The URI of the vault for performing operations on keys and secrets. + :type vault_uri: 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_04_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_04_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_04_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_04_01_preview.models.PrivateEndpointConnectionItem] + """ + + _validation = { + 'tenant_id': {'required': True}, + 'sku': {'required': 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'}, + '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]'}, + } + + 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, + **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.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 + + +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 + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = id diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/__init__.py new file mode 100644 index 000000000000..405215be5f3a --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/__init__.py @@ -0,0 +1,27 @@ +# 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 ._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__ = [ + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ManagedHsmsOperations', + 'MHSMPrivateEndpointConnectionsOperations', + 'MHSMPrivateLinkResourcesOperations', + 'Operations', + 'SecretsOperations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py new file mode 100644 index 000000000000..d3f2959ca17e --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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-04-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_04_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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_04_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-04-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_04_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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_04_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-04-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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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_04_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-04-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_04_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-04-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_04_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-04-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_04_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-04-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_04_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-04-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-04-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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..f9fda8e6cdf5 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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_04_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-04-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_04_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-04-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_04_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_04_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-04-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-04-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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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_04_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_04_01_preview/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_link_resources_operations.py new file mode 100644 index 000000000000..3acb6ee63674 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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_04_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-04-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_04_01_preview/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_operations.py new file mode 100644 index 000000000000..e51dd9b0e856 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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_04_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-04-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_04_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..fab3f627d9f0 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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_04_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-04-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_04_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_04_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-04-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-04-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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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_04_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_04_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-04-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_04_01_preview/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..8b7ef86be01c --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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_04_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-04-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_04_01_preview/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_secrets_operations.py new file mode 100644 index 000000000000..5e581d0b48a1 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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_04_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_04_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-04-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_04_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_04_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-04-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_04_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-04-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_04_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-04-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_04_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py new file mode 100644 index 000000000000..c39a06c285f7 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_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_04_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-04-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_04_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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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_04_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_04_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_04_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-04-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-04-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_04_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-04-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_04_01_preview.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. + :type parameters: ~azure.mgmt.keyvault.v2021_04_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_04_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-04-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_04_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-04-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_04_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-04-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_04_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-04-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_04_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-04-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-04-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: Pass in True if you'd like the ARMPolling polling method, + False for no polling, or 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_04_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 = "2021-04-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'), + } + 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_04_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_04_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-04-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_04_01_preview/py.typed b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file