diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/CHANGELOG.md new file mode 100644 index 000000000000..3b7bf1cb42fe --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/CHANGELOG.md @@ -0,0 +1,152 @@ +# Release History + +## 2.2.0 (2020-03-20) + +**Features** + + - Model VaultProperties has a new parameter enable_rbac_authorization + - Model VaultProperties has a new parameter soft_delete_retention_in_days + - Model VaultPatchProperties has a new parameter enable_rbac_authorization + - Model VaultPatchProperties has a new parameter soft_delete_retention_in_days + +## 2.1.1 (2020-02-07) + +**Bugfixes** + + - Fixed multi-API client issues + +## 2.1.0 (2020-01-30) + +**Features** + + - Model VaultProperties has a new parameter private_endpoint_connections + - Added operation group PrivateEndpointConnectionsOperations + - Added operation group PrivateLinkResourcesOperations + +## 2.0.0 (2019-06-18) + +**General Breaking changes** + +This version uses a next-generation code generator that *might* +introduce breaking changes if you were importing from the v20xx_yy_zz +API folders. In summary, some modules were incorrectly +visible/importable and have been renamed. This fixed several issues +caused by usage of classes that were not supposed to be used in the +first place. + + - KeyVaultManagementClient cannot be imported from + `azure.mgmt.key_vault.v20xx_yy_zz.key_vault_management_client` + anymore (import from `azure.mgmt.key_vault.v20xx_yy_zz` works + like before) + - KeyVaultManagementClientConfiguration import has been moved from + `azure.mgmt.key_vault.v20xx_yy_zz.key_vault_management_client` + to `azure.mgmt.key_vault.v20xx_yy_zz` + - A model `MyClass` from a "models" sub-module cannot be imported + anymore using + `azure.mgmt.key_vault.v20xx_yy_zz.models.my_class` (import + from `azure.mgmt.key_vault.v20xx_yy_zz.models` works like + before) + - An operation class `MyClassOperations` from an `operations` + sub-module cannot be imported anymore using + `azure.mgmt.key_vault.v20xx_yy_zz.operations.my_class_operations` + (import from `azure.mgmt.key_vault.v20xx_yy_zz.operations` + works like before) + +Last but not least, HTTP connection pooling is now enabled by default. +You should always use a client as a context manager, or call close(), or +use no more than one client per process. + +## 1.1.0 (2018-08-07) + + - Adding support for multi-api and API profiles + +## 1.0.0 (2018-06-27) + + - Moving azure-mgmt-keyvault to stable API version 2018-02-14 + +## 1.0.0b1 (2018-04-10) + + - Upgraded to autorest 3.0 generated code + +**General Breaking changes** + +This version uses a next-generation code generator that *might* +introduce breaking changes. + + - Model signatures now use only keyword-argument syntax. All + positional arguments must be re-written as keyword-arguments. To + keep auto-completion in most cases, models are now generated for + Python 2 and Python 3. Python 3 uses the "*" syntax for + keyword-only arguments. + - Enum types now use the "str" mixin (class AzureEnum(str, Enum)) to + improve the behavior when unrecognized enum values are encountered. + While this is not a breaking change, the distinctions are important, + and are documented here: + At a glance: + - "is" should not be used at all. + - "format" will return the string value, where "%s" string + formatting will return `NameOfEnum.stringvalue`. Format syntax + should be prefered. + - New Long Running Operation: + - Return type changes from + `msrestazure.azure_operation.AzureOperationPoller` to + `msrest.polling.LROPoller`. External API is the same. + - Return type is now **always** a `msrest.polling.LROPoller`, + regardless of the optional parameters used. + - The behavior has changed when using `raw=True`. Instead of + returning the initial call result as `ClientRawResponse`, + without polling, now this returns an LROPoller. After polling, + the final resource will be returned as a `ClientRawResponse`. + - New `polling` parameter. The default behavior is + `Polling=True` which will poll using ARM algorithm. When + `Polling=False`, the response of the initial call will be + returned without polling. + - `polling` parameter accepts instances of subclasses of + `msrest.polling.PollingMethod`. + - `add_done_callback` will no longer raise if called after + polling is finished, but will instead execute the callback right + away. + +## 1.0.0a2 (2018-03-28) + + - Upgrading to API version 2018-02-14-preview + - Breaking change in vault create_or_update now returns a + 'LROPoller' objects rather than the Vault, to allow callers to + determine when the vault is ready to accept traffic. Callers should + use the result() method to block until the vault is accessible. + - Adding network_acls vault property for limiting network access to a + vault + - Adding managed storage account key backup, restore and soft delete + support + - Adding vault property enable_purge_protection for enhance + protection against vault deletion + +## 0.40.0 (2017-06-06) + + - upgrading to API version 2016-10-01 + - adding keyvault management plane updates to enable the soft delete + feature for a new or existing keyvault + +**Notes** + + - this contains a backwards breaking change removing the All value + from KeyPermissions, SecretPermissions and CertificatePermissions + +## 0.31.0 (2017-04-19) + +**Bugfixes** + + - Fix possible deserialization error, but updating from + list to list when applicable + +**Notes** + + - This wheel package is now built with the azure wheel extension + +## 0.30.1 (2016-12-15) + + - Fix list Vault by subscription method return type + +## 0.30.0 (2016-10-04) + + - Initial preview release (API Version 2016-10-02) diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/MANIFEST.in b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/MANIFEST.in new file mode 100644 index 000000000000..a3cb07df8765 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/MANIFEST.in @@ -0,0 +1,5 @@ +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/README.md b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/README.md new file mode 100644 index 000000000000..8a65fe7aee2e --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/README.md @@ -0,0 +1,21 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Key Vault Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [Github repo](https://github.com/Azure/azure-sdk-for-python/) + + +# Usage + +For code examples, see [Key Vault Management](https://docs.microsoft.com/python/api/overview/azure/key-vault) +on docs.microsoft.com. + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-keyvault%2FREADME.png) diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/__init__.py new file mode 100644 index 000000000000..1f618cc50426 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/__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 + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/_configuration.py new file mode 100644 index 000000000000..029be0272867 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/_configuration.py @@ -0,0 +1,64 @@ +# 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 + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from ._version import VERSION + + +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.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'azure-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.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-autorestv5/azure/mgmt/keyvault/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/_key_vault_management_client.py new file mode 100644 index 000000000000..4bee764af805 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/_key_vault_management_client.py @@ -0,0 +1,177 @@ +# 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.mgmt.core import ARMPipelineClient +from msrest import Serializer, Deserializer + +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin +from ._configuration import KeyVaultManagementClientConfiguration + +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass + +class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): + """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + + This ready contains multiple API versions, to help you deal with all of the Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. + + :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 api_version: API version to use if no profile is provided, or if + missing in profile. + :param str base_url: Service URL + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + DEFAULT_API_VERSION = '2019-09-01' + _PROFILE_TAG = "azure.mgmt.keyvault.KeyVaultManagementClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + }}, + _PROFILE_TAG + " latest" + ) + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + api_version=None, + base_url=None, + profile=KnownProfiles.default, + **kwargs # type: Any + ): + 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) + super(KeyVaultManagementClient, self).__init__( + credential, + self._config, + api_version=api_version, + profile=profile + ) + + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2016-10-01: :mod:`v2016_10_01.models` + * 2018-02-14: :mod:`v2018_02_14.models` + * 2019-09-01: :mod:`v2019_09_01.models` + """ + if api_version == '2016-10-01': + from .v2016_10_01 import models + return models + elif api_version == '2018-02-14': + from .v2018_02_14 import models + return models + elif api_version == '2019-09-01': + from .v2019_09_01 import models + return models + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + + @property + def operations(self): + """Instance depends on the API version: + + * 2016-10-01: :class:`Operations` + * 2018-02-14: :class:`Operations` + * 2019-09-01: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2016-10-01': + from .v2016_10_01.operations import Operations as OperationClass + elif api_version == '2018-02-14': + from .v2018_02_14.operations import Operations as OperationClass + elif api_version == '2019-09-01': + from .v2019_09_01.operations import Operations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_endpoint_connections(self): + """Instance depends on the API version: + + * 2018-02-14: :class:`PrivateEndpointConnectionsOperations` + * 2019-09-01: :class:`PrivateEndpointConnectionsOperations` + """ + api_version = self._get_api_version('private_endpoint_connections') + if api_version == '2018-02-14': + from .v2018_02_14.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2019-09-01': + from .v2019_09_01.operations import PrivateEndpointConnectionsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_link_resources(self): + """Instance depends on the API version: + + * 2018-02-14: :class:`PrivateLinkResourcesOperations` + * 2019-09-01: :class:`PrivateLinkResourcesOperations` + """ + api_version = self._get_api_version('private_link_resources') + if api_version == '2018-02-14': + from .v2018_02_14.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2019-09-01': + from .v2019_09_01.operations import PrivateLinkResourcesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def vaults(self): + """Instance depends on the API version: + + * 2016-10-01: :class:`VaultsOperations` + * 2018-02-14: :class:`VaultsOperations` + * 2019-09-01: :class:`VaultsOperations` + """ + api_version = self._get_api_version('vaults') + if api_version == '2016-10-01': + from .v2016_10_01.operations import VaultsOperations as OperationClass + elif api_version == '2018-02-14': + from .v2018_02_14.operations import VaultsOperations as OperationClass + elif api_version == '2019-09-01': + from .v2019_09_01.operations import VaultsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + def close(self): + self._client.close() + def __enter__(self): + self._client.__enter__() + return self + def __exit__(self, *exc_details): + self._client.__exit__(*exc_details) diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/_version.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/_version.py new file mode 100644 index 000000000000..bb9696095add --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/_version.py @@ -0,0 +1,8 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "3.0.0b1" \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/aio/__init__.py new file mode 100644 index 000000000000..018d48d4060b --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/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_async import KeyVaultManagementClient +__all__ = ['KeyVaultManagementClient'] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/aio/_configuration_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/aio/_configuration_async.py new file mode 100644 index 000000000000..11e4fbaa251b --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/aio/_configuration_async.py @@ -0,0 +1,63 @@ +# 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 + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from .._version import VERSION + + +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, # type: "AsyncTokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ) -> None: + # 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.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'azure-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.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-autorestv5/azure/mgmt/keyvault/aio/_key_vault_management_client_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/aio/_key_vault_management_client_async.py new file mode 100644 index 000000000000..f8518d26e458 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/aio/_key_vault_management_client_async.py @@ -0,0 +1,177 @@ +# 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.mgmt.core import AsyncARMPipelineClient +from msrest import Serializer, Deserializer + +from azure.profiles import KnownProfiles, ProfileDefinition +from azure.profiles.multiapiclient import MultiApiClientMixin +from ._configuration_async import KeyVaultManagementClientConfiguration + +class _SDKClient(object): + def __init__(self, *args, **kwargs): + """This is a fake class to support current implemetation of MultiApiClientMixin." + Will be removed in final version of multiapi azure-core based client + """ + pass + +class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): + """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. + + This ready contains multiple API versions, to help you deal with all of the Azure clouds + (Azure Stack, Azure Government, Azure China, etc.). + By default, it uses the latest API version available on public Azure. + For production, you should stick to a particular api-version and/or profile. + The profile sets a mapping between an operation group and its API version. + The api-version parameter sets the default API version if the operation + group is not described in the profile. + + :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 api_version: API version to use if no profile is provided, or if + missing in profile. + :param str base_url: Service URL + :param profile: A profile definition, from KnownProfiles to dict. + :type profile: azure.profiles.KnownProfiles + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + DEFAULT_API_VERSION = '2019-09-01' + _PROFILE_TAG = "azure.mgmt.keyvault.KeyVaultManagementClient" + LATEST_PROFILE = ProfileDefinition({ + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + }}, + _PROFILE_TAG + " latest" + ) + + def __init__( + self, + credential, # type: "AsyncTokenCredential" + subscription_id, # type: str + api_version=None, + base_url=None, + profile=KnownProfiles.default, + **kwargs # type: 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) + super(KeyVaultManagementClient, self).__init__( + credential, + self._config, + api_version=api_version, + profile=profile + ) + + @classmethod + def _models_dict(cls, api_version): + return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} + + @classmethod + def models(cls, api_version=DEFAULT_API_VERSION): + """Module depends on the API version: + + * 2016-10-01: :mod:`v2016_10_01.models` + * 2018-02-14: :mod:`v2018_02_14.models` + * 2019-09-01: :mod:`v2019_09_01.models` + """ + if api_version == '2016-10-01': + from ..v2016_10_01 import models + return models + elif api_version == '2018-02-14': + from ..v2018_02_14 import models + return models + elif api_version == '2019-09-01': + from ..v2019_09_01 import models + return models + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + + @property + def operations(self): + """Instance depends on the API version: + + * 2016-10-01: :class:`Operations` + * 2018-02-14: :class:`Operations` + * 2019-09-01: :class:`Operations` + """ + api_version = self._get_api_version('operations') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import Operations as OperationClass + elif api_version == '2018-02-14': + from ..v2018_02_14.aio.operations_async import Operations as OperationClass + elif api_version == '2019-09-01': + from ..v2019_09_01.aio.operations_async import Operations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_endpoint_connections(self): + """Instance depends on the API version: + + * 2018-02-14: :class:`PrivateEndpointConnectionsOperations` + * 2019-09-01: :class:`PrivateEndpointConnectionsOperations` + """ + api_version = self._get_api_version('private_endpoint_connections') + if api_version == '2018-02-14': + from ..v2018_02_14.aio.operations_async import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2019-09-01': + from ..v2019_09_01.aio.operations_async import PrivateEndpointConnectionsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def private_link_resources(self): + """Instance depends on the API version: + + * 2018-02-14: :class:`PrivateLinkResourcesOperations` + * 2019-09-01: :class:`PrivateLinkResourcesOperations` + """ + api_version = self._get_api_version('private_link_resources') + if api_version == '2018-02-14': + from ..v2018_02_14.aio.operations_async import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2019-09-01': + from ..v2019_09_01.aio.operations_async import PrivateLinkResourcesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + @property + def vaults(self): + """Instance depends on the API version: + + * 2016-10-01: :class:`VaultsOperations` + * 2018-02-14: :class:`VaultsOperations` + * 2019-09-01: :class:`VaultsOperations` + """ + api_version = self._get_api_version('vaults') + if api_version == '2016-10-01': + from ..v2016_10_01.aio.operations_async import VaultsOperations as OperationClass + elif api_version == '2018-02-14': + from ..v2018_02_14.aio.operations_async import VaultsOperations as OperationClass + elif api_version == '2019-09-01': + from ..v2019_09_01.aio.operations_async import VaultsOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + + async def close(self): + await self._client.close() + async def __aenter__(self): + await self._client.__aenter__() + return self + async def __aexit__(self, *exc_details): + await self._client.__aexit__(*exc_details) diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/models.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/models.py new file mode 100644 index 000000000000..1d5d79558e5e --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/models.py @@ -0,0 +1,7 @@ +# 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. +# -------------------------------------------------------------------------- +from .v2019_09_01.models import * diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/py.typed b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/__init__.py new file mode 100644 index 000000000000..1f618cc50426 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/__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 + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/_configuration.py new file mode 100644 index 000000000000..d53243c9cafe --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/_configuration.py @@ -0,0 +1,68 @@ +# 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 + +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 = "2016-10-01" + self.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.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-autorestv5/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py new file mode 100644 index 000000000000..4d1b8e66a46e --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py @@ -0,0 +1,72 @@ +# 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 ._configuration import KeyVaultManagementClientConfiguration +from .operations import VaultsOperations +from .operations import Operations +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.v2016_10_01.operations.VaultsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2016_10_01.operations.Operations + :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._deserialize = Deserializer(client_models) + + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + 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-autorestv5/azure/mgmt/keyvault/v2016_10_01/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/_metadata.json new file mode 100644 index 000000000000..d6a7fb59484f --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/_metadata.json @@ -0,0 +1,54 @@ +{ + "chosen_version": "2016-10-01", + "total_api_version_list": ["2016-10-01"], + "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." + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_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", + "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": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "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" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"] + }, + "operation_groups": { + "vaults": "VaultsOperations", + "operations": "Operations" + }, + "operation_mixins": { + }, + "sync_imports": "from typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Dict, Optional, Union", + "async_imports": "from typing import Dict, Optional, TYPE_CHECKING, Union" +} \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py new file mode 100644 index 000000000000..018d48d4060b --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/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_async import KeyVaultManagementClient +__all__ = ['KeyVaultManagementClient'] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/_configuration_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/_configuration_async.py new file mode 100644 index 000000000000..4e406ba5f1a0 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/_configuration_async.py @@ -0,0 +1,64 @@ +# 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + 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_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 = "2016-10-01" + self.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.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-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client_async.py new file mode 100644 index 000000000000..8180c5ecd488 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client_async.py @@ -0,0 +1,64 @@ +# 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 + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import KeyVaultManagementClientConfiguration +from .operations_async import VaultsOperations +from .operations_async import Operations +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.v2016_10_01.aio.operations_async.VaultsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2016_10_01.aio.operations_async.Operations + :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._deserialize = Deserializer(client_models) + + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + + 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-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..790d8c973d8f --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/__init__.py @@ -0,0 +1,15 @@ +# 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_async import VaultsOperations +from ._operations_async import Operations + +__all__ = [ + 'VaultsOperations', + 'Operations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_operations_async.py new file mode 100644 index 000000000000..a0f04d8b7d74 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_operations_async.py @@ -0,0 +1,100 @@ +# 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 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 + +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.v2016_10_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 + + 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 OperationListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py new file mode 100644 index 000000000000..9422a284f78c --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py @@ -0,0 +1,834 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import 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.v2016_10_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_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: "models.VaultCreateOrUpdateParameters", + **kwargs + ) -> "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.v2016_10_01.models.VaultCreateOrUpdateParameters + :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.v2016_10_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "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}$'), + '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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + vault_name: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["models.VaultPatchProperties"] = None, + **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 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.v2016_10_01.models.VaultPatchProperties + :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.v2016_10_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.VaultPatchParameters(tags=tags, properties=properties) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + # 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] + + # Construct and send request + 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.v2016_10_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + # 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'] = 'application/json' + + # Construct and send request + 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"], + properties: "models.VaultAccessPolicyProperties", + **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.v2016_10_01.models.AccessPolicyUpdateKind + :param properties: Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyProperties + :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.v2016_10_01.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.VaultAccessPolicyParameters(properties=properties) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 VaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 VaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 DeletedVaultListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVaultListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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.v2016_10_01.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + # 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'] = 'application/json' + + # Construct and send request + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + # 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] + + # Construct and send request + 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 purge_deleted( + self, + vault_name: str, + location: str, + **kwargs + ) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for 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: None + :rtype: 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 + ) + raw_result = await self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + 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 ResourceListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2016-10-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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, + name: str, + **kwargs + ) -> "models.CheckNameAvailabilityResult": + """Checks that the vault name is valid and is not already in use. + + :param name: The vault name. + :type name: str + :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.v2016_10_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _vault_name = models.VaultCheckNameAvailabilityParameters(name=name) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2016_10_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/models/__init__.py new file mode 100644 index 000000000000..ddd632123fcd --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/models/__init__.py @@ -0,0 +1,101 @@ +# 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 CheckNameAvailabilityResult + from ._models_py3 import DeletedVault + from ._models_py3 import DeletedVaultListResult + from ._models_py3 import DeletedVaultProperties + from ._models_py3 import LogSpecification + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import Permissions + from ._models_py3 import Resource + from ._models_py3 import ResourceListResult + from ._models_py3 import ServiceSpecification + from ._models_py3 import Sku + 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 +except (SyntaxError, ImportError): + from ._models import AccessPolicyEntry # type: ignore + from ._models import CheckNameAvailabilityResult # type: ignore + from ._models import DeletedVault # type: ignore + from ._models import DeletedVaultListResult # type: ignore + from ._models import DeletedVaultProperties # type: ignore + from ._models import LogSpecification # 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 Resource # type: ignore + from ._models import ResourceListResult # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import Sku # 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 ._key_vault_management_client_enums import ( + AccessPolicyUpdateKind, + CertificatePermissions, + CreateMode, + KeyPermissions, + Reason, + SecretPermissions, + SkuName, + StoragePermissions, +) + +__all__ = [ + 'AccessPolicyEntry', + 'CheckNameAvailabilityResult', + 'DeletedVault', + 'DeletedVaultListResult', + 'DeletedVaultProperties', + 'LogSpecification', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'Permissions', + 'Resource', + 'ResourceListResult', + 'ServiceSpecification', + 'Sku', + 'Vault', + 'VaultAccessPolicyParameters', + 'VaultAccessPolicyProperties', + 'VaultCheckNameAvailabilityParameters', + 'VaultCreateOrUpdateParameters', + 'VaultListResult', + 'VaultPatchParameters', + 'VaultPatchProperties', + 'VaultProperties', + 'AccessPolicyUpdateKind', + 'CertificatePermissions', + 'CreateMode', + 'KeyPermissions', + 'Reason', + 'SecretPermissions', + 'SkuName', + 'StoragePermissions', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py new file mode 100644 index 000000000000..4fc1675be016 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py @@ -0,0 +1,101 @@ +# 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 + +class AccessPolicyUpdateKind(str, Enum): + + add = "add" + replace = "replace" + remove = "remove" + +class CertificatePermissions(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" + +class CreateMode(str, Enum): + """The vault's create mode to indicate whether the vault need to be recovered or not. + """ + + recover = "recover" + default = "default" + +class KeyPermissions(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 Reason(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(str, Enum): + + get = "get" + list = "list" + set = "set" + delete = "delete" + backup = "backup" + restore = "restore" + recover = "recover" + purge = "purge" + +class SkuName(str, Enum): + """SKU name to specify whether the key vault is a standard vault or a premium vault. + """ + + standard = "standard" + premium = "premium" + +class StoragePermissions(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" diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/models/_models.py new file mode 100644 index 000000000000..f26c983f206c --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/models/_models.py @@ -0,0 +1,832 @@ +# 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 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.v2016_10_01.models.Permissions + """ + + _validation = { + 'tenant_id': {'required': True}, + 'object_id': {'required': True}, + 'permissions': {'required': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'application_id': {'key': 'applicationId', 'type': 'str'}, + 'permissions': {'key': 'permissions', 'type': 'Permissions'}, + } + + def __init__( + self, + **kwargs + ): + super(AccessPolicyEntry, self).__init__(**kwargs) + self.tenant_id = kwargs['tenant_id'] + self.object_id = kwargs['object_id'] + self.application_id = kwargs.get('application_id', None) + self.permissions = kwargs['permissions'] + + +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.v2016_10_01.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 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.v2016_10_01.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.v2016_10_01.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] + """ + + _validation = { + 'vault_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'tags': {'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}'}, + } + + 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 + + +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 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.v2016_10_01.models.OperationDisplay + :param origin: The origin of operations. + :type origin: str + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~azure.mgmt.keyvault.v2016_10_01.models.ServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + '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.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.v2016_10_01.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.v2016_10_01.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2016_10_01.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 Resource(msrest.serialization.Model): + """Key Vault resource. + + 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 Azure Resource Manager resource ID for the 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 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] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'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}'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs['location'] + self.tags = kwargs.get('tags', None) + + +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2016_10_01.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 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.v2016_10_01.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. + + 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 family: Required. SKU family name. Default value: "A". + :vartype family: str + :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.v2016_10_01.models.SkuName + """ + + _validation = { + 'family': {'required': True, 'constant': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + family = "A" + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs['name'] + + +class Vault(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: The Azure Resource Manager resource ID for the 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 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.v2016_10_01.models.VaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': 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': 'VaultProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(Vault, self).__init__(**kwargs) + 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.v2016_10_01.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.v2016_10_01.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.v2016_10_01.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.v2016_10_01.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.v2016_10_01.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.v2016_10_01.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.v2016_10_01.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 specifying whether recoverable deletion ('soft' delete) is + enabled for this key vault. The property may not be set to false. + :type enable_soft_delete: 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.v2016_10_01.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault; it is only effective if soft delete is also enabled. Once activated, the + property may no longer be reset to false. + :type enable_purge_protection: bool + """ + + _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'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + } + + 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.create_mode = kwargs.get('create_mode', None) + self.enable_purge_protection = kwargs.get('enable_purge_protection', None) + + +class VaultProperties(msrest.serialization.Model): + """Properties of the vault. + + 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.v2016_10_01.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. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :type access_policies: list[~azure.mgmt.keyvault.v2016_10_01.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 specifying whether recoverable deletion is enabled for this + key vault. Setting this property to true activates the soft delete feature, whereby vaults or + vault entities can be recovered after deletion. Enabling this functionality is irreversible - + that is, the property does not accept false as its value. + :type enable_soft_delete: 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.v2016_10_01.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 + """ + + _validation = { + 'tenant_id': {'required': True}, + 'sku': {'required': 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'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + } + + 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', None) + self.create_mode = kwargs.get('create_mode', None) + self.enable_purge_protection = kwargs.get('enable_purge_protection', None) diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py new file mode 100644 index 000000000000..3259e4b659a7 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py @@ -0,0 +1,919 @@ +# 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 Dict, List, Optional, Union + +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.v2016_10_01.models.Permissions + """ + + _validation = { + 'tenant_id': {'required': True}, + 'object_id': {'required': True}, + 'permissions': {'required': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'application_id': {'key': 'applicationId', 'type': 'str'}, + 'permissions': {'key': 'permissions', 'type': 'Permissions'}, + } + + def __init__( + self, + *, + tenant_id: str, + object_id: str, + permissions: "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 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.v2016_10_01.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 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.v2016_10_01.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.v2016_10_01.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] + """ + + _validation = { + 'vault_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'tags': {'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}'}, + } + + 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 + + +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 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.v2016_10_01.models.OperationDisplay + :param origin: The origin of operations. + :type origin: str + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~azure.mgmt.keyvault.v2016_10_01.models.ServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + 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.v2016_10_01.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.v2016_10_01.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2016_10_01.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 Resource(msrest.serialization.Model): + """Key Vault resource. + + 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 Azure Resource Manager resource ID for the 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 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] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'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}'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + + +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2016_10_01.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 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.v2016_10_01.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. + + 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 family: Required. SKU family name. Default value: "A". + :vartype family: str + :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.v2016_10_01.models.SkuName + """ + + _validation = { + 'family': {'required': True, 'constant': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + family = "A" + + def __init__( + self, + *, + name: Union[str, "SkuName"], + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + + +class Vault(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: The Azure Resource Manager resource ID for the 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 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.v2016_10_01.models.VaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': 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': 'VaultProperties'}, + } + + def __init__( + self, + *, + location: str, + properties: "VaultProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Vault, self).__init__(location=location, tags=tags, **kwargs) + 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.v2016_10_01.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.v2016_10_01.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.v2016_10_01.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.v2016_10_01.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.v2016_10_01.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.v2016_10_01.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.v2016_10_01.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 specifying whether recoverable deletion ('soft' delete) is + enabled for this key vault. The property may not be set to false. + :type enable_soft_delete: 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.v2016_10_01.models.CreateMode + :param enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault; it is only effective if soft delete is also enabled. Once activated, the + property may no longer be reset to false. + :type enable_purge_protection: bool + """ + + _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'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + } + + 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, + create_mode: Optional[Union[str, "CreateMode"]] = None, + enable_purge_protection: Optional[bool] = 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.create_mode = create_mode + self.enable_purge_protection = enable_purge_protection + + +class VaultProperties(msrest.serialization.Model): + """Properties of the vault. + + 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.v2016_10_01.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. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :type access_policies: list[~azure.mgmt.keyvault.v2016_10_01.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 specifying whether recoverable deletion is enabled for this + key vault. Setting this property to true activates the soft delete feature, whereby vaults or + vault entities can be recovered after deletion. Enabling this functionality is irreversible - + that is, the property does not accept false as its value. + :type enable_soft_delete: 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.v2016_10_01.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 + """ + + _validation = { + 'tenant_id': {'required': True}, + 'sku': {'required': 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'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + } + + 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] = None, + create_mode: Optional[Union[str, "CreateMode"]] = None, + enable_purge_protection: Optional[bool] = 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.create_mode = create_mode + self.enable_purge_protection = enable_purge_protection diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/operations/__init__.py new file mode 100644 index 000000000000..3d2bb8ce16b1 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/operations/__init__.py @@ -0,0 +1,15 @@ +# 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 ._operations import Operations + +__all__ = [ + 'VaultsOperations', + 'Operations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py new file mode 100644 index 000000000000..80bf66ea18a4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/operations/_operations.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 +import warnings + +from azure.core.exceptions import 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 + +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.v2016_10_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 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 OperationListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py new file mode 100644 index 000000000000..4c97a27958e0 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py @@ -0,0 +1,851 @@ +# 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 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 + +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.v2016_10_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_or_update( + self, + resource_group_name, # type: str + vault_name, # type: str + parameters, # type: "models.VaultCreateOrUpdateParameters" + **kwargs # type: Any + ): + # 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. + :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.v2016_10_01.models.VaultCreateOrUpdateParameters + :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.v2016_10_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "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}$'), + '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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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.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 + tags=None, # type: Optional[Dict[str, str]] + properties=None, # type: Optional["models.VaultPatchProperties"] + **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 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.v2016_10_01.models.VaultPatchProperties + :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.v2016_10_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.VaultPatchParameters(tags=tags, properties=properties) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + # 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] + + # Construct and send request + 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.v2016_10_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + # 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'] = 'application/json' + + # Construct and send request + 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"] + properties, # type: "models.VaultAccessPolicyProperties" + **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.v2016_10_01.models.AccessPolicyUpdateKind + :param properties: Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyProperties + :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.v2016_10_01.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.VaultAccessPolicyParameters(properties=properties) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 VaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 VaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 DeletedVaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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.v2016_10_01.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + # 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'] = 'application/json' + + # Construct and send request + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2016-10-01" + + # 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] + + # Construct and send request + 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 + """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 polling: True for ARMPolling, False for no polling, or a + polling object for 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 None + :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 + ) + raw_result = self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 ResourceListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2016-10-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CheckNameAvailabilityResult" + """Checks that the vault name is valid and is not already in use. + + :param name: The vault name. + :type name: str + :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.v2016_10_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _vault_name = models.VaultCheckNameAvailabilityParameters(name=name) + api_version = "2016-10-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2016_10_01/py.typed b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2016_10_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/__init__.py new file mode 100644 index 000000000000..1f618cc50426 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/__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 + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/_configuration.py new file mode 100644 index 000000000000..2dd56c60d091 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/_configuration.py @@ -0,0 +1,68 @@ +# 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 + +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 = "2018-02-14" + self.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.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-autorestv5/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py new file mode 100644 index 000000000000..7975a653f732 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py @@ -0,0 +1,82 @@ +# 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 ._configuration import KeyVaultManagementClientConfiguration +from .operations import VaultsOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import Operations +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.v2018_02_14.operations.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.keyvault.v2018_02_14.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.keyvault.v2018_02_14.operations.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2018_02_14.operations.Operations + :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._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.operations = Operations( + 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-autorestv5/azure/mgmt/keyvault/v2018_02_14/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/_metadata.json new file mode 100644 index 000000000000..32a322c425bb --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/_metadata.json @@ -0,0 +1,56 @@ +{ + "chosen_version": "2018-02-14", + "total_api_version_list": ["2018-02-14"], + "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." + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_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", + "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": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "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" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"] + }, + "operation_groups": { + "vaults": "VaultsOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "operations": "Operations" + }, + "operation_mixins": { + }, + "sync_imports": "from typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Dict, Optional, Union", + "async_imports": "from typing import Dict, Optional, TYPE_CHECKING, Union" +} \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py new file mode 100644 index 000000000000..018d48d4060b --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/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_async import KeyVaultManagementClient +__all__ = ['KeyVaultManagementClient'] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/_configuration_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/_configuration_async.py new file mode 100644 index 000000000000..3ceb7038c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/_configuration_async.py @@ -0,0 +1,64 @@ +# 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + 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_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 = "2018-02-14" + self.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.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-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client_async.py new file mode 100644 index 000000000000..c3f76c04546b --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client_async.py @@ -0,0 +1,74 @@ +# 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 + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import KeyVaultManagementClientConfiguration +from .operations_async import VaultsOperations +from .operations_async import PrivateEndpointConnectionsOperations +from .operations_async import PrivateLinkResourcesOperations +from .operations_async import Operations +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.v2018_02_14.aio.operations_async.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.keyvault.v2018_02_14.aio.operations_async.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.keyvault.v2018_02_14.aio.operations_async.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2018_02_14.aio.operations_async.Operations + :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._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.operations = Operations( + 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-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/__init__.py new file mode 100644 index 000000000000..4b4b20e273c3 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._vaults_operations_async import VaultsOperations +from ._private_endpoint_connections_operations_async import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations_async import PrivateLinkResourcesOperations +from ._operations_async import Operations + +__all__ = [ + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_operations_async.py new file mode 100644 index 000000000000..dfff0358cf53 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_operations_async.py @@ -0,0 +1,100 @@ +# 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 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 + +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.v2018_02_14.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 OperationListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..744d06394abc --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py @@ -0,0 +1,285 @@ +# 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, Union +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import 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.v2018_02_14.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 + ) -> "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.v2018_02_14.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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'] = 'application/json' + + # Construct and send request + 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('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, + private_endpoint: Optional["models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["models.PrivateLinkServiceConnectionState"] = None, + **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 private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState + :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.v2018_02_14.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _properties = models.PrivateEndpointConnection(private_endpoint=private_endpoint, private_link_service_connection_state=private_link_service_connection_state) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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 + ) -> "models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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'] = 'application/json' + + # Construct and send request + 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 delete( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "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 polling: True for ARMPolling, False for no polling, or a + polling object for 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: PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2018_02_14.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 + ) + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_link_resources_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_link_resources_operations_async.py new file mode 100644 index 000000000000..b3e577784fcb --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_link_resources_operations_async.py @@ -0,0 +1,96 @@ +# 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 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 + +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.v2018_02_14.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.v2018_02_14.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py new file mode 100644 index 000000000000..d20661da5201 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py @@ -0,0 +1,872 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import 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.v2018_02_14.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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: "models.VaultCreateOrUpdateParameters", + **kwargs + ) -> "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.v2018_02_14.models.VaultCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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: Vault + :rtype: ~azure.mgmt.keyvault.v2018_02_14.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 + ) + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + 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, + tags: Optional[Dict[str, str]] = None, + properties: Optional["models.VaultPatchProperties"] = None, + **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 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.v2018_02_14.models.VaultPatchProperties + :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.v2018_02_14.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.VaultPatchParameters(tags=tags, properties=properties) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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] + + # Construct and send request + 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.v2018_02_14.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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'] = 'application/json' + + # Construct and send request + 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"], + properties: "models.VaultAccessPolicyProperties", + **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.v2018_02_14.models.AccessPolicyUpdateKind + :param properties: Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyProperties + :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.v2018_02_14.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.VaultAccessPolicyParameters(properties=properties) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 VaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 VaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 DeletedVaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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.v2018_02_14.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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'] = 'application/json' + + # Construct and send request + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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] + + # Construct and send request + 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 purge_deleted( + self, + vault_name: str, + location: str, + **kwargs + ) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for 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: None + :rtype: 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 + ) + raw_result = await self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + 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 ResourceListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2018-02-14" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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, + name: str, + **kwargs + ) -> "models.CheckNameAvailabilityResult": + """Checks that the vault name is valid and is not already in use. + + :param name: The vault name. + :type name: str + :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.v2018_02_14.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _vault_name = models.VaultCheckNameAvailabilityParameters(name=name) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2018_02_14/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/models/__init__.py new file mode 100644 index 000000000000..236e5a302a3d --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/models/__init__.py @@ -0,0 +1,139 @@ +# 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 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 IPRule + from ._models_py3 import LogSpecification + 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 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 ServiceSpecification + from ._models_py3 import Sku + 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 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 IPRule # type: ignore + from ._models import LogSpecification # 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 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 ServiceSpecification # type: ignore + from ._models import Sku # 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, + CertificatePermissions, + CreateMode, + KeyPermissions, + NetworkRuleAction, + NetworkRuleBypassOptions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + Reason, + SecretPermissions, + SkuName, + StoragePermissions, +) + +__all__ = [ + 'AccessPolicyEntry', + 'CheckNameAvailabilityResult', + 'CloudErrorBody', + 'DeletedVault', + 'DeletedVaultListResult', + 'DeletedVaultProperties', + 'IPRule', + 'LogSpecification', + 'NetworkRuleSet', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'Permissions', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionItem', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'Resource', + 'ResourceListResult', + 'ServiceSpecification', + 'Sku', + 'Vault', + 'VaultAccessPolicyParameters', + 'VaultAccessPolicyProperties', + 'VaultCheckNameAvailabilityParameters', + 'VaultCreateOrUpdateParameters', + 'VaultListResult', + 'VaultPatchParameters', + 'VaultPatchProperties', + 'VaultProperties', + 'VirtualNetworkRule', + 'AccessPolicyUpdateKind', + 'CertificatePermissions', + 'CreateMode', + 'KeyPermissions', + 'NetworkRuleAction', + 'NetworkRuleBypassOptions', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', + 'Reason', + 'SecretPermissions', + 'SkuName', + 'StoragePermissions', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py new file mode 100644 index 000000000000..296505d1a453 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py @@ -0,0 +1,139 @@ +# 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 + +class AccessPolicyUpdateKind(str, Enum): + + add = "add" + replace = "replace" + remove = "remove" + +class CertificatePermissions(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(str, Enum): + """The vault's create mode to indicate whether the vault need to be recovered or not. + """ + + recover = "recover" + default = "default" + +class KeyPermissions(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 NetworkRuleAction(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(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(str, Enum): + """The current provisioning state. + """ + + succeeded = "Succeeded" + creating = "Creating" + updating = "Updating" + deleting = "Deleting" + failed = "Failed" + disconnected = "Disconnected" + +class PrivateEndpointServiceConnectionStatus(str, Enum): + """The private endpoint connection status. + """ + + pending = "Pending" + approved = "Approved" + rejected = "Rejected" + disconnected = "Disconnected" + +class Reason(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(str, Enum): + + get = "get" + list = "list" + set = "set" + delete = "delete" + backup = "backup" + restore = "restore" + recover = "recover" + purge = "purge" + +class SkuName(str, Enum): + """SKU name to specify whether the key vault is a standard vault or a premium vault. + """ + + standard = "standard" + premium = "premium" + +class StoragePermissions(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" diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/models/_models.py new file mode 100644 index 000000000000..7ba9bbfd366c --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/models/_models.py @@ -0,0 +1,1186 @@ +# 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 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.v2018_02_14.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 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.v2018_02_14.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 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.v2018_02_14.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.v2018_02_14.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] + """ + + _validation = { + 'vault_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'tags': {'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}'}, + } + + 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 + + +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 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.v2018_02_14.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.v2018_02_14.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: list[~azure.mgmt.keyvault.v2018_02_14.models.IPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: list[~azure.mgmt.keyvault.v2018_02_14.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.v2018_02_14.models.OperationDisplay + :param origin: The origin of operations. + :type origin: str + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~azure.mgmt.keyvault.v2018_02_14.models.ServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + '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.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.v2018_02_14.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.v2018_02_14.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2018_02_14.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 private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'provisioning_state': {'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}'}, + '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.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 + + +class PrivateEndpointConnectionItem(msrest.serialization.Model): + """Private endpoint connection item. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _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 = 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.v2018_02_14.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.v2018_02_14.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 + updates on the consumer. + :type action_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'action_required': {'key': 'actionRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + 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) + + +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2018_02_14.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 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.v2018_02_14.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. + + 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 family: Required. SKU family name. Default value: "A". + :vartype family: str + :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.v2018_02_14.models.SkuName + """ + + _validation = { + 'family': {'required': True, 'constant': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + family = "A" + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs['name'] + + +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] + :param properties: Required. Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'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': '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.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.v2018_02_14.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.v2018_02_14.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.v2018_02_14.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.v2018_02_14.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.v2018_02_14.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.v2018_02_14.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.v2018_02_14.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. It does not accept false value. + :type enable_soft_delete: 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.v2018_02_14.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.v2018_02_14.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'}, + '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.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.v2018_02_14.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. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :type access_policies: list[~azure.mgmt.keyvault.v2018_02_14.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. It does not accept false value. + :type enable_soft_delete: 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.v2018_02_14.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.v2018_02_14.models.NetworkRuleSet + :ivar private_endpoint_connections: List of private endpoint connections associated with the + key vault. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.v2018_02_14.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'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + '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', None) + self.create_mode = kwargs.get('create_mode', None) + self.enable_purge_protection = kwargs.get('enable_purge_protection', None) + self.network_acls = kwargs.get('network_acls', None) + self.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-autorestv5/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py new file mode 100644 index 000000000000..0f6392d7354f --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py @@ -0,0 +1,1298 @@ +# 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 Dict, List, Optional, Union + +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.v2018_02_14.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 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.v2018_02_14.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 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.v2018_02_14.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.v2018_02_14.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] + """ + + _validation = { + 'vault_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'tags': {'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}'}, + } + + 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 + + +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 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.v2018_02_14.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.v2018_02_14.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: list[~azure.mgmt.keyvault.v2018_02_14.models.IPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: list[~azure.mgmt.keyvault.v2018_02_14.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.v2018_02_14.models.OperationDisplay + :param origin: The origin of operations. + :type origin: str + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~azure.mgmt.keyvault.v2018_02_14.models.ServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + 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.v2018_02_14.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.v2018_02_14.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2018_02_14.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 private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'provisioning_state': {'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}'}, + '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, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + +class PrivateEndpointConnectionItem(msrest.serialization.Model): + """Private endpoint connection item. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _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, + **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 = 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, + *, + 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.v2018_02_14.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.v2018_02_14.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 + updates on the consumer. + :type action_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'action_required': {'key': 'actionRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + action_required: Optional[str] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.action_required = action_required + + +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2018_02_14.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 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.v2018_02_14.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. + + 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 family: Required. SKU family name. Default value: "A". + :vartype family: str + :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.v2018_02_14.models.SkuName + """ + + _validation = { + 'family': {'required': True, 'constant': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + family = "A" + + def __init__( + self, + *, + name: Union[str, "SkuName"], + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + + +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] + :param properties: Required. Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'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': '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.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.v2018_02_14.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.v2018_02_14.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.v2018_02_14.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.v2018_02_14.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.v2018_02_14.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.v2018_02_14.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.v2018_02_14.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. It does not accept false value. + :type enable_soft_delete: 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.v2018_02_14.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.v2018_02_14.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'}, + '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, + 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.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.v2018_02_14.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. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :type access_policies: list[~azure.mgmt.keyvault.v2018_02_14.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. It does not accept false value. + :type enable_soft_delete: 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.v2018_02_14.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.v2018_02_14.models.NetworkRuleSet + :ivar private_endpoint_connections: List of private endpoint connections associated with the + key vault. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.v2018_02_14.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'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + '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] = None, + create_mode: Optional[Union[str, "CreateMode"]] = None, + enable_purge_protection: Optional[bool] = None, + network_acls: Optional["NetworkRuleSet"] = 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.create_mode = create_mode + self.enable_purge_protection = enable_purge_protection + self.network_acls = network_acls + 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-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/__init__.py new file mode 100644 index 000000000000..ad4413dd4cae --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._vaults_operations import VaultsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._operations import Operations + +__all__ = [ + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py new file mode 100644 index 000000000000..9d16ffe54c67 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/_operations.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 +import warnings + +from azure.core.exceptions import 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 + +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.v2018_02_14.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 OperationListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..547ba03d3bf5 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,293 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, 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.v2018_02_14.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: (...) -> "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.v2018_02_14.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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'] = 'application/json' + + # Construct and send request + 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('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 + private_endpoint=None, # type: Optional["models.PrivateEndpoint"] + private_link_service_connection_state=None, # type: Optional["models.PrivateLinkServiceConnectionState"] + **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 private_endpoint: Properties of the private endpoint object. + :type private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :param private_link_service_connection_state: Approval state of the private link connection. + :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState + :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.v2018_02_14.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _properties = models.PrivateEndpointConnection(private_endpoint=private_endpoint, private_link_service_connection_state=private_link_service_connection_state) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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: (...) -> "models.PrivateEndpointConnection" + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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'] = 'application/json' + + # Construct and send request + 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 + """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 polling: True for ARMPolling, False for no polling, or a + polling object for 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 PrivateEndpointConnection + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.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 + ) + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..569ccda728a5 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py @@ -0,0 +1,101 @@ +# 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 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 + +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.v2018_02_14.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.v2018_02_14.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py new file mode 100644 index 000000000000..7ed3506f3515 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py @@ -0,0 +1,890 @@ +# 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 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 + +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.v2018_02_14.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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 + """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.v2018_02_14.models.VaultCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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 Vault + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.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 + ) + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 + tags=None, # type: Optional[Dict[str, str]] + properties=None, # type: Optional["models.VaultPatchProperties"] + **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 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.v2018_02_14.models.VaultPatchProperties + :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.v2018_02_14.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.VaultPatchParameters(tags=tags, properties=properties) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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] + + # Construct and send request + 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.v2018_02_14.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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'] = 'application/json' + + # Construct and send request + 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"] + properties, # type: "models.VaultAccessPolicyProperties" + **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.v2018_02_14.models.AccessPolicyUpdateKind + :param properties: Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyProperties + :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.v2018_02_14.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.VaultAccessPolicyParameters(properties=properties) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 VaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 VaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 DeletedVaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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.v2018_02_14.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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'] = 'application/json' + + # Construct and send request + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2018-02-14" + + # 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] + + # Construct and send request + 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 + """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 polling: True for ARMPolling, False for no polling, or a + polling object for 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 None + :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 + ) + raw_result = self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 ResourceListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2018-02-14" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CheckNameAvailabilityResult" + """Checks that the vault name is valid and is not already in use. + + :param name: The vault name. + :type name: str + :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.v2018_02_14.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _vault_name = models.VaultCheckNameAvailabilityParameters(name=name) + api_version = "2018-02-14" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2018_02_14/py.typed b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2018_02_14/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/__init__.py new file mode 100644 index 000000000000..1f618cc50426 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/__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 + patch_sdk() +except ImportError: + pass diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/_configuration.py new file mode 100644 index 000000000000..d30f01f777b4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/_configuration.py @@ -0,0 +1,68 @@ +# 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 + +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 = "2019-09-01" + self.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.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-autorestv5/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py new file mode 100644 index 000000000000..feea3ce7056f --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py @@ -0,0 +1,82 @@ +# 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 ._configuration import KeyVaultManagementClientConfiguration +from .operations import VaultsOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .operations import Operations +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.v2019_09_01.operations.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.keyvault.v2019_09_01.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :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 + :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._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.operations = Operations( + 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-autorestv5/azure/mgmt/keyvault/v2019_09_01/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/_metadata.json new file mode 100644 index 000000000000..24ebe93dd9a1 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/_metadata.json @@ -0,0 +1,56 @@ +{ + "chosen_version": "2019-09-01", + "total_api_version_list": ["2019-09-01"], + "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." + }, + "global_parameters": { + "sync_method": { + "credential": { + "method_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", + "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": { + "credential": { + "method_signature": "credential, # type: \"AsyncTokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "method_signature": "subscription_id, # type: str", + "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" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"] + }, + "operation_groups": { + "vaults": "VaultsOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "operations": "Operations" + }, + "operation_mixins": { + }, + "sync_imports": "from typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Dict, Optional, Union", + "async_imports": "from typing import Dict, Optional, TYPE_CHECKING, Union" +} \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py new file mode 100644 index 000000000000..018d48d4060b --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/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_async import KeyVaultManagementClient +__all__ = ['KeyVaultManagementClient'] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/_configuration_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/_configuration_async.py new file mode 100644 index 000000000000..c4d706435819 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/_configuration_async.py @@ -0,0 +1,64 @@ +# 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + 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_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 = "2019-09-01" + self.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.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-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client_async.py new file mode 100644 index 000000000000..7443363589dc --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client_async.py @@ -0,0 +1,74 @@ +# 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 + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import KeyVaultManagementClientConfiguration +from .operations_async import VaultsOperations +from .operations_async import PrivateEndpointConnectionsOperations +from .operations_async import PrivateLinkResourcesOperations +from .operations_async import Operations +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.v2019_09_01.aio.operations_async.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: azure.mgmt.keyvault.v2019_09_01.aio.operations_async.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.keyvault.v2019_09_01.aio.operations_async.PrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2019_09_01.aio.operations_async.Operations + :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._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.operations = Operations( + 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-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/__init__.py new file mode 100644 index 000000000000..4b4b20e273c3 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._vaults_operations_async import VaultsOperations +from ._private_endpoint_connections_operations_async import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations_async import PrivateLinkResourcesOperations +from ._operations_async import Operations + +__all__ = [ + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_operations_async.py new file mode 100644 index 000000000000..e655967b4fc0 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_operations_async.py @@ -0,0 +1,100 @@ +# 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 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 + +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.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 + + 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 OperationListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py new file mode 100644 index 000000000000..28b6a4f8ed22 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_endpoint_connections_operations_async.py @@ -0,0 +1,285 @@ +# 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, Union +import warnings + +from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import 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.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 get( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "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.v2019_09_01.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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'] = 'application/json' + + # Construct and send request + 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('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, + private_endpoint: Optional["models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["models.PrivateLinkServiceConnectionState"] = None, + **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 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. + :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _properties = models.PrivateEndpointConnection(private_endpoint=private_endpoint, private_link_service_connection_state=private_link_service_connection_state) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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 + ) -> "models.PrivateEndpointConnection": + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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'] = 'application/json' + + # Construct and send request + 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 delete( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "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 polling: True for ARMPolling, False for no polling, or a + polling object for 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: PrivateEndpointConnection + :rtype: ~azure.mgmt.keyvault.v2019_09_01.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 + ) + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_link_resources_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_link_resources_operations_async.py new file mode 100644 index 000000000000..dadcabed4ba7 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_private_link_resources_operations_async.py @@ -0,0 +1,96 @@ +# 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 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 + +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.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 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.v2019_09_01.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py new file mode 100644 index 000000000000..c2bb91554efb --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/aio/operations_async/_vaults_operations_async.py @@ -0,0 +1,872 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import 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.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_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: "models.VaultCreateOrUpdateParameters", + **kwargs + ) -> "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.v2019_09_01.models.VaultCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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: Vault + :rtype: ~azure.mgmt.keyvault.v2019_09_01.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 + ) + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + 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, + tags: Optional[Dict[str, str]] = None, + properties: Optional["models.VaultPatchProperties"] = None, + **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 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.v2019_09_01.models.VaultPatchProperties + :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.v2019_09_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.VaultPatchParameters(tags=tags, properties=properties) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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] + + # Construct and send request + 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.v2019_09_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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'] = 'application/json' + + # Construct and send request + 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"], + properties: "models.VaultAccessPolicyProperties", + **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.v2019_09_01.models.AccessPolicyUpdateKind + :param properties: Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyProperties + :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.v2019_09_01.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.VaultAccessPolicyParameters(properties=properties) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 VaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 VaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 DeletedVaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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.v2019_09_01.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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'] = 'application/json' + + # Construct and send request + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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] + + # Construct and send request + 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 purge_deleted( + self, + vault_name: str, + location: str, + **kwargs + ) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for 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: None + :rtype: 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 + ) + raw_result = await self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + 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 ResourceListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2019-09-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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, + name: str, + **kwargs + ) -> "models.CheckNameAvailabilityResult": + """Checks that the vault name is valid and is not already in use. + + :param name: The vault name. + :type name: str + :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.v2019_09_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _vault_name = models.VaultCheckNameAvailabilityParameters(name=name) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2019_09_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/models/__init__.py new file mode 100644 index 000000000000..236e5a302a3d --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/models/__init__.py @@ -0,0 +1,139 @@ +# 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 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 IPRule + from ._models_py3 import LogSpecification + 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 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 ServiceSpecification + from ._models_py3 import Sku + 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 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 IPRule # type: ignore + from ._models import LogSpecification # 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 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 ServiceSpecification # type: ignore + from ._models import Sku # 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, + CertificatePermissions, + CreateMode, + KeyPermissions, + NetworkRuleAction, + NetworkRuleBypassOptions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + Reason, + SecretPermissions, + SkuName, + StoragePermissions, +) + +__all__ = [ + 'AccessPolicyEntry', + 'CheckNameAvailabilityResult', + 'CloudErrorBody', + 'DeletedVault', + 'DeletedVaultListResult', + 'DeletedVaultProperties', + 'IPRule', + 'LogSpecification', + 'NetworkRuleSet', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'Permissions', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionItem', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'Resource', + 'ResourceListResult', + 'ServiceSpecification', + 'Sku', + 'Vault', + 'VaultAccessPolicyParameters', + 'VaultAccessPolicyProperties', + 'VaultCheckNameAvailabilityParameters', + 'VaultCreateOrUpdateParameters', + 'VaultListResult', + 'VaultPatchParameters', + 'VaultPatchProperties', + 'VaultProperties', + 'VirtualNetworkRule', + 'AccessPolicyUpdateKind', + 'CertificatePermissions', + 'CreateMode', + 'KeyPermissions', + 'NetworkRuleAction', + 'NetworkRuleBypassOptions', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', + 'Reason', + 'SecretPermissions', + 'SkuName', + 'StoragePermissions', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py new file mode 100644 index 000000000000..296505d1a453 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py @@ -0,0 +1,139 @@ +# 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 + +class AccessPolicyUpdateKind(str, Enum): + + add = "add" + replace = "replace" + remove = "remove" + +class CertificatePermissions(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(str, Enum): + """The vault's create mode to indicate whether the vault need to be recovered or not. + """ + + recover = "recover" + default = "default" + +class KeyPermissions(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 NetworkRuleAction(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(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(str, Enum): + """The current provisioning state. + """ + + succeeded = "Succeeded" + creating = "Creating" + updating = "Updating" + deleting = "Deleting" + failed = "Failed" + disconnected = "Disconnected" + +class PrivateEndpointServiceConnectionStatus(str, Enum): + """The private endpoint connection status. + """ + + pending = "Pending" + approved = "Approved" + rejected = "Rejected" + disconnected = "Disconnected" + +class Reason(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(str, Enum): + + get = "get" + list = "list" + set = "set" + delete = "delete" + backup = "backup" + restore = "restore" + recover = "recover" + purge = "purge" + +class SkuName(str, Enum): + """SKU name to specify whether the key vault is a standard vault or a premium vault. + """ + + standard = "standard" + premium = "premium" + +class StoragePermissions(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" diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/models/_models.py new file mode 100644 index 000000000000..df1272c084c1 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/models/_models.py @@ -0,0 +1,1214 @@ +# 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 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.v2019_09_01.models.Permissions + """ + + _validation = { + 'tenant_id': {'required': True}, + 'object_id': {'required': True}, + 'permissions': {'required': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'application_id': {'key': 'applicationId', 'type': 'str'}, + 'permissions': {'key': 'permissions', 'type': 'Permissions'}, + } + + def __init__( + self, + **kwargs + ): + super(AccessPolicyEntry, self).__init__(**kwargs) + self.tenant_id = kwargs['tenant_id'] + self.object_id = kwargs['object_id'] + self.application_id = kwargs.get('application_id', None) + self.permissions = kwargs['permissions'] + + +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.v2019_09_01.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 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.v2019_09_01.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.v2019_09_01.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] + """ + + _validation = { + 'vault_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'tags': {'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}'}, + } + + 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 + + +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 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.v2019_09_01.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.v2019_09_01.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: list[~azure.mgmt.keyvault.v2019_09_01.models.IPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: list[~azure.mgmt.keyvault.v2019_09_01.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.v2019_09_01.models.OperationDisplay + :param origin: The origin of operations. + :type origin: str + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + '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.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.v2019_09_01.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.v2019_09_01.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2019_09_01.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 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. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'provisioning_state': {'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}'}, + '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.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 + + +class PrivateEndpointConnectionItem(msrest.serialization.Model): + """Private endpoint connection item. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _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 = 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.v2019_09_01.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.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 + updates on the consumer. + :type action_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'action_required': {'key': 'actionRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + 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) + + +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.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 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.v2019_09_01.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. + + 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 family: Required. SKU family name. Default value: "A". + :vartype family: str + :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.v2019_09_01.models.SkuName + """ + + _validation = { + 'family': {'required': True, 'constant': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + family = "A" + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs['name'] + + +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] + :param properties: Required. Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'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': '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.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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. When + ``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. + :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.v2019_09_01.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.v2019_09_01.models.NetworkRuleSet + :ivar private_endpoint_connections: List of private endpoint connections associated with the + key vault. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.v2019_09_01.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'}, + '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.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-autorestv5/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py new file mode 100644 index 000000000000..244049f87222 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py @@ -0,0 +1,1330 @@ +# 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 Dict, List, Optional, Union + +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.v2019_09_01.models.Permissions + """ + + _validation = { + 'tenant_id': {'required': True}, + 'object_id': {'required': True}, + 'permissions': {'required': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'application_id': {'key': 'applicationId', 'type': 'str'}, + 'permissions': {'key': 'permissions', 'type': 'Permissions'}, + } + + def __init__( + self, + *, + tenant_id: str, + object_id: str, + permissions: "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 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.v2019_09_01.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 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.v2019_09_01.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.v2019_09_01.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] + """ + + _validation = { + 'vault_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'tags': {'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}'}, + } + + 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 + + +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 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.v2019_09_01.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.v2019_09_01.models.NetworkRuleAction + :param ip_rules: The list of IP address rules. + :type ip_rules: list[~azure.mgmt.keyvault.v2019_09_01.models.IPRule] + :param virtual_network_rules: The list of virtual network rules. + :type virtual_network_rules: list[~azure.mgmt.keyvault.v2019_09_01.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.v2019_09_01.models.OperationDisplay + :param origin: The origin of operations. + :type origin: str + :param service_specification: One property of operation, include metric specifications. + :type service_specification: ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + 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.v2019_09_01.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.v2019_09_01.models.KeyPermissions] + :param secrets: Permissions to secrets. + :type secrets: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.SecretPermissions] + :param certificates: Permissions to certificates. + :type certificates: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.CertificatePermissions] + :param storage: Permissions to storage accounts. + :type storage: list[str or ~azure.mgmt.keyvault.v2019_09_01.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 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. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'provisioning_state': {'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}'}, + '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, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + +class PrivateEndpointConnectionItem(msrest.serialization.Model): + """Private endpoint connection item. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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. + :type private_link_service_connection_state: + ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _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, + **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 = 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, + *, + 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.v2019_09_01.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.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 + updates on the consumer. + :type action_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'action_required': {'key': 'actionRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + action_required: Optional[str] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.action_required = action_required + + +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :param value: The list of vault resources. + :type value: list[~azure.mgmt.keyvault.v2019_09_01.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 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.v2019_09_01.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. + + 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 family: Required. SKU family name. Default value: "A". + :vartype family: str + :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.v2019_09_01.models.SkuName + """ + + _validation = { + 'family': {'required': True, 'constant': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + family = "A" + + def __init__( + self, + *, + name: Union[str, "SkuName"], + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + + +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] + :param properties: Required. Properties of the vault. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'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': '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.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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.v2019_09_01.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. When + ``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. + :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.v2019_09_01.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.v2019_09_01.models.NetworkRuleSet + :ivar private_endpoint_connections: List of private endpoint connections associated with the + key vault. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.v2019_09_01.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'}, + '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, + **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.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-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py new file mode 100644 index 000000000000..ad4413dd4cae --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py @@ -0,0 +1,19 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._vaults_operations import VaultsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._operations import Operations + +__all__ = [ + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'Operations', +] diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py new file mode 100644 index 000000000000..354882b50eed --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/_operations.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 +import warnings + +from azure.core.exceptions import 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 + +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.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 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 OperationListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..79168b48cbca --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,293 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, 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.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 get( + self, + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # 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. + :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.v2019_09_01.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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'] = 'application/json' + + # Construct and send request + 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('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 + private_endpoint=None, # type: Optional["models.PrivateEndpoint"] + private_link_service_connection_state=None, # type: Optional["models.PrivateLinkServiceConnectionState"] + **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 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. + :type private_link_service_connection_state: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState + :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 + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _properties = models.PrivateEndpointConnection(private_endpoint=private_endpoint, private_link_service_connection_state=private_link_service_connection_state) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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: (...) -> "models.PrivateEndpointConnection" + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateEndpointConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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'] = 'application/json' + + # Construct and send request + 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 + """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 polling: True for ARMPolling, False for no polling, or a + polling object for 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 PrivateEndpointConnection + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.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 + ) + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..becfab64030c --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py @@ -0,0 +1,101 @@ +# 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 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 + +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.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 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.v2019_09_01.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.PrivateLinkResourceListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py new file mode 100644 index 000000000000..d921af57fc5f --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py @@ -0,0 +1,890 @@ +# 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 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 + +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.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_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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 + """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.v2019_09_01.models.VaultCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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 Vault + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.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 + ) + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 + tags=None, # type: Optional[Dict[str, str]] + properties=None, # type: Optional["models.VaultPatchProperties"] + **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 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.v2019_09_01.models.VaultPatchProperties + :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.v2019_09_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.VaultPatchParameters(tags=tags, properties=properties) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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] + + # Construct and send request + 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.v2019_09_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Vault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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'] = 'application/json' + + # Construct and send request + 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"] + properties, # type: "models.VaultAccessPolicyProperties" + **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.v2019_09_01.models.AccessPolicyUpdateKind + :param properties: Properties of the access policy. + :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyProperties + :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.v2019_09_01.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.VaultAccessPolicyParameters"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.VaultAccessPolicyParameters(properties=properties) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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 VaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 VaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 DeletedVaultListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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.v2019_09_01.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DeletedVault"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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'] = 'application/json' + + # Construct and send request + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-09-01" + + # 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] + + # Construct and send request + 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 + """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 polling: True for ARMPolling, False for no polling, or a + polling object for 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 None + :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 + ) + raw_result = self._purge_deleted_initial( + vault_name=vault_name, + location=location, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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 ResourceListResult or the result of cls(response) + :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"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2019-09-01" + + def prepare_request(next_link=None): + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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, + name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.CheckNameAvailabilityResult" + """Checks that the vault name is valid and is not already in use. + + :param name: The vault name. + :type name: str + :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.v2019_09_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameAvailabilityResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _vault_name = models.VaultCheckNameAvailabilityParameters(name=name) + api_version = "2019-09-01" + content_type = kwargs.pop("content_type", "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'] = 'application/json' + + # Construct and send request + 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-autorestv5/azure/mgmt/keyvault/v2019_09_01/py.typed b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/azure/mgmt/keyvault/v2019_09_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/dev_requirements.txt b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/dev_requirements.txt new file mode 100644 index 000000000000..f6457a93d5e8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/dev_requirements.txt @@ -0,0 +1 @@ +-e ../../../tools/azure-sdk-tools \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/sdk_packaging.toml b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/sdk_packaging.toml new file mode 100644 index 000000000000..0261a231ba90 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/sdk_packaging.toml @@ -0,0 +1,5 @@ +[packaging] +package_name = "azure-mgmt-keyvault" +package_pprint_name = "Key Vault Management" +package_doc_id = "key-vault-autorestv5" +is_stable = false diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/setup.cfg b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/setup.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/setup.py new file mode 100644 index 000000000000..ed7eead45390 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/setup.py @@ -0,0 +1,88 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-keyvault" +PACKAGE_PPRINT_NAME = "Key Vault Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.11', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.0.0b1,<2.0.0' + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/keyvault/azure-mgmt-keyvault-autorestv5/tests/test_vaults.py b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/tests/test_vaults.py new file mode 100644 index 000000000000..4f72639aa158 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault-autorestv5/tests/test_vaults.py @@ -0,0 +1,50 @@ +from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer +import azure.mgmt.keyvault.models + +class MgmtKeyVaultTest(AzureMgmtTestCase): + def setUp(self): + super(MgmtKeyVaultTest, self).setUp() + self.keyvault_client = self.create_mgmt_client( + azure.mgmt.keyvault.KeyVaultManagementClient + ) + + @ResourceGroupPreparer() + def test_vaults_operations(self, resource_group, **kwargs): + account_name = self.get_resource_name('pykv') + + vault = self.keyvault_client.vaults.begin_create_or_update( + resource_group.name, + account_name, + { + 'location': self.region, + 'properties': { + 'sku': { + 'name': 'standard' + }, + # Fake random GUID + 'tenant_id': '6819f86e-5d41-47b0-9297-334f33d7922d', + 'access_policies': [] + } + } + ).result() + self.assertEqual(vault.name, account_name) + + vault = self.keyvault_client.vaults.get( + resource_group.name, + account_name + ) + self.assertEqual(vault.name, account_name) + + vaults = list(self.keyvault_client.vaults.list_by_resource_group(resource_group.name)) + self.assertEqual(len(vaults), 1) + self.assertIsInstance(vaults[0], azure.mgmt.keyvault.models.Vault) + self.assertEqual(vaults[0].name, account_name) + + vaults = list(self.keyvault_client.vaults.list()) + self.assertGreater(len(vaults), 0) + self.assertTrue(all(isinstance(v, azure.mgmt.keyvault.models.Resource) for v in vaults)) + + self.keyvault_client.vaults.delete( + resource_group.name, + account_name + ) \ No newline at end of file