diff --git a/sdk/keyvault/azure-mgmt-keyvault/_meta.json b/sdk/keyvault/azure-mgmt-keyvault/_meta.json index 7d346d26cca5..61e855cb549b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/_meta.json +++ b/sdk/keyvault/azure-mgmt-keyvault/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "f2aaaa76e3853dbfbee6558a29cee9b7c66798dc", + "commit": "63a4b37b66740087b113e00c1b32b2b9c98fd9db", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/keyvault/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/keyvault/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/keyvault/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py index 5d1c3482be02..fc6aa7c043a1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -68,4 +68,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py index 2cca4d6ed3cb..f85bd1447b90 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py @@ -23,7 +23,6 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse class _SDKClient(object): def __init__(self, *args, **kwargs): @@ -70,12 +69,10 @@ def __init__( credential, # type: "TokenCredential" subscription_id, # type: str api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str profile=KnownProfiles.default, # type: KnownProfiles **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__( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py index 97c53efb3b95..91c050070043 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_configuration.py @@ -12,7 +12,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py index 0dc03b7341d6..519e258f9a1e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py @@ -11,7 +11,6 @@ from typing import Any, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -21,6 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential from azure.core.credentials_async import AsyncTokenCredential class _SDKClient(object): @@ -68,12 +68,10 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", profile: KnownProfiles = 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__( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py index 1283ff09177b..59fd240c9528 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['KeyVaultManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_configuration.py index 63678f7ee57a..b264d1c6ddd0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class KeyVaultManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -68,4 +65,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py index 86409494d224..bc13a01c2251 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py @@ -6,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import Operations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import KeyVaultManagementClientConfiguration -from .operations import VaultsOperations -from .operations import Operations -from . import models - -class KeyVaultManagementClient(object): +class KeyVaultManagementClient: """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. :ivar vaults: VaultsOperations operations @@ -33,52 +30,58 @@ class KeyVaultManagementClient(object): :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json index 212d6662b26b..c63d32f4da5c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_metadata.json @@ -5,13 +5,13 @@ "name": "KeyVaultManagementClient", "filename": "_key_vault_management_client", "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "vaults": "VaultsOperations", diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_vendor.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py index 726043aa858a..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.3.0" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py index f54ed88d6ad2..8cff887e652d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._key_vault_management_client import KeyVaultManagementClient __all__ = ['KeyVaultManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_configuration.py index 4d966b4470cb..c68b9d5022cd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py index 8d9ef317e4a4..fafa6c7929ff 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py @@ -6,23 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import Operations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import KeyVaultManagementClientConfiguration -from .operations import VaultsOperations -from .operations import Operations -from .. import models - - -class KeyVaultManagementClient(object): +class KeyVaultManagementClient: """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. :ivar vaults: VaultsOperations operations @@ -31,50 +30,58 @@ class KeyVaultManagementClient(object): :vartype operations: azure.mgmt.keyvault.v2016_10_01.aio.operations.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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py index 2500793129a7..bf57f1087ef8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult] + :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"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py index 2555da08ad64..216b16f663a6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._vaults_operations import build_check_name_availability_request, build_create_or_update_request, build_delete_request, build_get_deleted_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_deleted_request, build_list_request, build_purge_deleted_request_initial, build_update_access_policy_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -111,8 +107,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -138,32 +137,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -181,8 +170,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -205,25 +197,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - 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] + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -236,6 +220,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -258,27 +244,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -292,8 +268,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def update_access_policy( self, resource_group_name: str, @@ -322,33 +301,23 @@ async def update_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -366,8 +335,11 @@ async def update_access_policy( 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 + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -383,7 +355,8 @@ def list_by_resource_group( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] + :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"] @@ -391,37 +364,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -439,11 +408,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, top: Optional[int] = None, @@ -455,7 +426,8 @@ def list_by_subscription( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] + :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"] @@ -463,36 +435,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -510,11 +477,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + @distributed_trace def list_deleted( self, **kwargs: Any @@ -522,8 +491,10 @@ def list_deleted( """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult] + :return: An iterator like instance of either DeletedVaultListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] @@ -531,34 +502,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -576,11 +542,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + @distributed_trace_async async def get_deleted( self, vault_name: str, @@ -603,27 +571,17 @@ async def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -637,8 +595,10 @@ async def get_deleted( 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, @@ -650,25 +610,17 @@ async def _purge_deleted_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - 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] + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -681,6 +633,8 @@ async def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + @distributed_trace_async async def begin_purge_deleted( self, vault_name: str, @@ -695,15 +649,17 @@ async def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -717,21 +673,14 @@ async def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -743,8 +692,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + @distributed_trace def list( self, top: Optional[int] = None, @@ -756,7 +707,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult] + :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"] @@ -764,38 +716,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - api_version = "2015-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceListResult', pipeline_response) + deserialized = self._deserialize("ResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -813,11 +758,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + @distributed_trace_async async def check_name_availability( self, vault_name: "_models.VaultCheckNameAvailabilityParameters", @@ -837,30 +784,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -874,4 +811,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/__init__.py index 58fea2720308..98725b3d9d2e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/__init__.py @@ -6,54 +6,30 @@ # 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 ._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 + from ._key_vault_management_client_enums import ( AccessPolicyUpdateKind, diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py index 1d9e87b05441..da8191d9cf5b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessPolicyUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "get" LIST = "list" @@ -49,14 +34,14 @@ class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) RECOVER = "recover" PURGE = "purge" -class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -75,7 +60,7 @@ class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -83,7 +68,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "get" LIST = "list" @@ -94,20 +79,20 @@ class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU family name """ A = "A" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "get" LIST = "list" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py deleted file mode 100644 index cc5ba5da4cf9..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py +++ /dev/null @@ -1,829 +0,0 @@ -# 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. - - All required parameters must be populated in order to send to Azure. - - :param family: Required. SKU family name. Possible values include: "A". - :type family: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuFamily - :param name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". - :type name: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuName - """ - - _validation = { - 'family': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.family = kwargs.get('family', "A") - self.name = kwargs['name'] - - -class 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: The type of resource, Microsoft.KeyVault/vaults. Has constant value: - "Microsoft.KeyVault/vaults". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.KeyVault/vaults" - - def __init__( - self, - **kwargs - ): - super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class VaultCreateOrUpdateParameters(msrest.serialization.Model): - """Parameters for creating or updating a vault. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. The supported Azure location where the key vault should be created. - :type location: str - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.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/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py index 516ae955752e..33dd798afabc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py @@ -18,17 +18,17 @@ class AccessPolicyEntry(msrest.serialization.Model): 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 + :ivar 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 + :vartype tenant_id: str + :ivar 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 + :vartype object_id: str + :ivar application_id: Application ID of the client making request on behalf of a principal. + :vartype application_id: str + :ivar permissions: Required. Permissions the identity has for keys, secrets and certificates. + :vartype permissions: ~azure.mgmt.keyvault.v2016_10_01.models.Permissions """ _validation = { @@ -53,6 +53,20 @@ def __init__( application_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword 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. + :paramtype object_id: str + :keyword application_id: Application ID of the client making request on behalf of a principal. + :paramtype application_id: str + :keyword permissions: Required. Permissions the identity has for keys, secrets and + certificates. + :paramtype permissions: ~azure.mgmt.keyvault.v2016_10_01.models.Permissions + """ super(AccessPolicyEntry, self).__init__(**kwargs) self.tenant_id = tenant_id self.object_id = object_id @@ -93,6 +107,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -110,8 +126,8 @@ class DeletedVault(msrest.serialization.Model): :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 + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultProperties """ _validation = { @@ -133,6 +149,10 @@ def __init__( properties: Optional["DeletedVaultProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultProperties + """ super(DeletedVault, self).__init__(**kwargs) self.id = None self.name = None @@ -143,10 +163,10 @@ def __init__( 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 + :ivar value: The list of deleted vaults. + :vartype value: list[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault] + :ivar next_link: The URL to get the next set of deleted vaults. + :vartype next_link: str """ _attribute_map = { @@ -161,6 +181,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of deleted vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault] + :keyword next_link: The URL to get the next set of deleted vaults. + :paramtype next_link: str + """ super(DeletedVaultListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -203,6 +229,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -214,12 +242,12 @@ def __init__( 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 + :ivar name: Name of log specification. + :vartype name: str + :ivar display_name: Display name of log specification. + :vartype display_name: str + :ivar blob_duration: Blob duration of specification. + :vartype blob_duration: str """ _attribute_map = { @@ -236,6 +264,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of log specification. + :paramtype name: str + :keyword display_name: Display name of log specification. + :paramtype display_name: str + :keyword blob_duration: Blob duration of specification. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -245,14 +281,14 @@ def __init__( 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 + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.keyvault.v2016_10_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.keyvault.v2016_10_01.models.ServiceSpecification """ _attribute_map = { @@ -271,6 +307,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.keyvault.v2016_10_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.keyvault.v2016_10_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -281,14 +327,14 @@ def __init__( 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 + :ivar provider: Service provider: Microsoft Key Vault. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of operation. + :vartype description: str """ _attribute_map = { @@ -307,6 +353,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Key Vault. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -317,10 +373,10 @@ def __init__( 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 + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.keyvault.v2016_10_01.models.Operation] + :ivar next_link: The URL to get the next set of operations. + :vartype next_link: str """ _attribute_map = { @@ -335,6 +391,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.keyvault.v2016_10_01.models.Operation] + :keyword next_link: The URL to get the next set of operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -343,14 +405,15 @@ def __init__( 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] + :ivar keys: Permissions to keys. + :vartype keys: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.KeyPermissions] + :ivar secrets: Permissions to secrets. + :vartype secrets: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.SecretPermissions] + :ivar certificates: Permissions to certificates. + :vartype certificates: list[str or + ~azure.mgmt.keyvault.v2016_10_01.models.CertificatePermissions] + :ivar storage: Permissions to storage accounts. + :vartype storage: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.StoragePermissions] """ _attribute_map = { @@ -369,6 +432,17 @@ def __init__( storage: Optional[List[Union[str, "StoragePermissions"]]] = None, **kwargs ): + """ + :keyword keys: Permissions to keys. + :paramtype keys: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.KeyPermissions] + :keyword secrets: Permissions to secrets. + :paramtype secrets: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.SecretPermissions] + :keyword certificates: Permissions to certificates. + :paramtype certificates: list[str or + ~azure.mgmt.keyvault.v2016_10_01.models.CertificatePermissions] + :keyword storage: Permissions to storage accounts. + :paramtype storage: list[str or ~azure.mgmt.keyvault.v2016_10_01.models.StoragePermissions] + """ super(Permissions, self).__init__(**kwargs) self.keys = keys self.secrets = secrets @@ -389,10 +463,10 @@ class Resource(msrest.serialization.Model): :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] + :ivar location: Required. The supported Azure location where the key vault should be created. + :vartype location: str + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] """ _validation = { @@ -417,6 +491,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The supported Azure location where the key vault should be + created. + :paramtype location: str + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -428,10 +509,10 @@ def __init__( 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 + :ivar value: The list of vault resources. + :vartype value: list[~azure.mgmt.keyvault.v2016_10_01.models.Resource] + :ivar next_link: The URL to get the next set of vault resources. + :vartype next_link: str """ _attribute_map = { @@ -446,6 +527,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of vault resources. + :paramtype value: list[~azure.mgmt.keyvault.v2016_10_01.models.Resource] + :keyword next_link: The URL to get the next set of vault resources. + :paramtype next_link: str + """ super(ResourceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -454,8 +541,8 @@ def __init__( 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] + :ivar log_specifications: Log specifications of operation. + :vartype log_specifications: list[~azure.mgmt.keyvault.v2016_10_01.models.LogSpecification] """ _attribute_map = { @@ -468,6 +555,10 @@ def __init__( log_specifications: Optional[List["LogSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Log specifications of operation. + :paramtype log_specifications: list[~azure.mgmt.keyvault.v2016_10_01.models.LogSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications @@ -477,11 +568,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param family: Required. SKU family name. Possible values include: "A". - :type family: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuFamily - :param name: Required. SKU name to specify whether the key vault is a standard vault or a + :ivar family: Required. SKU family name. Possible values include: "A". + :vartype family: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuFamily + :ivar 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 + :vartype name: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuName """ _validation = { @@ -501,6 +592,13 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword family: Required. SKU family name. Possible values include: "A". + :paramtype family: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuFamily + :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: "standard", "premium". + :paramtype name: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.family = family self.name = name @@ -519,12 +617,12 @@ class Vault(Resource): :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 + :ivar location: Required. The supported Azure location where the key vault should be created. + :vartype location: str + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultProperties """ _validation = { @@ -552,6 +650,15 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The supported Azure location where the key vault should be + created. + :paramtype location: str + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultProperties + """ super(Vault, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties @@ -571,8 +678,8 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): :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 + :ivar properties: Required. Properties of the access policy. + :vartype properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyProperties """ _validation = { @@ -597,6 +704,10 @@ def __init__( properties: "VaultAccessPolicyProperties", **kwargs ): + """ + :keyword properties: Required. Properties of the access policy. + :paramtype properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyProperties + """ super(VaultAccessPolicyParameters, self).__init__(**kwargs) self.id = None self.name = None @@ -610,9 +721,9 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): 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 + :ivar 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] + :vartype access_policies: list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] """ _validation = { @@ -629,6 +740,11 @@ def __init__( access_policies: List["AccessPolicyEntry"], **kwargs ): + """ + :keyword 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. + :paramtype access_policies: list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] + """ super(VaultAccessPolicyProperties, self).__init__(**kwargs) self.access_policies = access_policies @@ -640,8 +756,8 @@ class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The vault name. - :type name: str + :ivar name: Required. The vault name. + :vartype name: str :ivar type: The type of resource, Microsoft.KeyVault/vaults. Has constant value: "Microsoft.KeyVault/vaults". :vartype type: str @@ -665,6 +781,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -674,12 +794,12 @@ class VaultCreateOrUpdateParameters(msrest.serialization.Model): 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 + :ivar location: Required. The supported Azure location where the key vault should be created. + :vartype location: str + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultProperties """ _validation = { @@ -701,6 +821,15 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The supported Azure location where the key vault should be + created. + :paramtype location: str + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultProperties + """ super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) self.location = location self.tags = tags @@ -710,10 +839,10 @@ def __init__( 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 + :ivar value: The list of vaults. + :vartype value: list[~azure.mgmt.keyvault.v2016_10_01.models.Vault] + :ivar next_link: The URL to get the next set of vaults. + :vartype next_link: str """ _attribute_map = { @@ -728,6 +857,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2016_10_01.models.Vault] + :keyword next_link: The URL to get the next set of vaults. + :paramtype next_link: str + """ super(VaultListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -736,10 +871,10 @@ def __init__( 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 + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultPatchProperties """ _attribute_map = { @@ -754,6 +889,12 @@ def __init__( properties: Optional["VaultPatchProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2016_10_01.models.VaultPatchProperties + """ super(VaultPatchParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -762,33 +903,33 @@ def __init__( class VaultPatchProperties(msrest.serialization.Model): """Properties of the vault. - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + :ivar 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 + :vartype tenant_id: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2016_10_01.models.Sku + :ivar 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 + :vartype access_policies: list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] + :ivar 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 + :vartype enabled_for_deployment: bool + :ivar 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 + :vartype enabled_for_disk_encryption: bool + :ivar 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 + :vartype enabled_for_template_deployment: bool + :ivar 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 + :vartype enable_soft_delete: bool + :ivar 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 + :vartype create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode + :ivar 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 + :vartype enable_purge_protection: bool """ _attribute_map = { @@ -817,6 +958,35 @@ def __init__( enable_purge_protection: Optional[bool] = None, **kwargs ): + """ + :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. + :paramtype tenant_id: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2016_10_01.models.Sku + :keyword 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. + :paramtype access_policies: list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword enable_soft_delete: Property specifying whether recoverable deletion ('soft' delete) + is enabled for this key vault. The property may not be set to false. + :paramtype enable_soft_delete: bool + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode + :keyword 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. + :paramtype enable_purge_protection: bool + """ super(VaultPatchProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -834,41 +1004,41 @@ class VaultProperties(msrest.serialization.Model): 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 + :ivar 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 + :vartype tenant_id: str + :ivar sku: Required. SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2016_10_01.models.Sku + :ivar 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 + :vartype access_policies: list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] + :ivar vault_uri: The URI of the vault for performing operations on keys and secrets. + :vartype vault_uri: str + :ivar 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 + :vartype enabled_for_deployment: bool + :ivar 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 + :vartype enabled_for_disk_encryption: bool + :ivar 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 + :vartype enabled_for_template_deployment: bool + :ivar 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 + :vartype enable_soft_delete: bool + :ivar 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 + :vartype create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode + :ivar 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 + :vartype enable_purge_protection: bool """ _validation = { @@ -904,6 +1074,43 @@ def __init__( enable_purge_protection: Optional[bool] = None, **kwargs ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword sku: Required. SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2016_10_01.models.Sku + :keyword 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. + :paramtype access_policies: list[~azure.mgmt.keyvault.v2016_10_01.models.AccessPolicyEntry] + :keyword vault_uri: The URI of the vault for performing operations on keys and secrets. + :paramtype vault_uri: str + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword 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. + :paramtype enable_soft_delete: bool + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode + :keyword 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. + :paramtype enable_purge_protection: bool + """ super(VaultProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py index 8989c9aad003..b095b84c219d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2016-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KeyVault/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult] + :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"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py index a5c82bb8fce2..0597cc482e35 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py @@ -5,25 +5,470 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_access_policy_request( + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "operationKind": _SERIALIZER.url("operation_kind", operation_kind, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_deleted_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_deleted_request( + vault_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}') + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_purge_deleted_request_initial( + vault_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2016-10-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge') + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2015-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2016-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VaultsOperations(object): """VaultsOperations operations. @@ -47,14 +492,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - vault_name, # type: str - parameters, # type: "_models.VaultCreateOrUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> "_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. @@ -73,32 +518,22 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -116,16 +551,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - vault_name, # type: str - parameters, # type: "_models.VaultPatchParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultPatchParameters", + **kwargs: Any + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -144,32 +581,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -187,15 +614,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> None: """Deletes the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -212,25 +641,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - 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] + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -243,13 +664,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -266,27 +688,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -300,17 +712,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def update_access_policy( self, - resource_group_name, # type: str - vault_name, # type: str - operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] - parameters, # type: "_models.VaultAccessPolicyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultAccessPolicyParameters" + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", + **kwargs: Any + ) -> "_models.VaultAccessPolicyParameters": """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -331,33 +745,23 @@ def update_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -375,15 +779,17 @@ def update_access_policy( 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 + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultListResult"] + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -401,37 +807,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -449,17 +851,18 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -474,36 +877,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -521,21 +919,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + @distributed_trace def list_deleted( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedVaultListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult] + :return: An iterator like instance of either 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"] @@ -543,34 +944,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -588,18 +984,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + @distributed_trace def get_deleted( self, - vault_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedVault" + vault_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -616,27 +1013,17 @@ def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -650,39 +1037,32 @@ def get_deleted( 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 + vault_name: str, + location: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "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] + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -695,13 +1075,14 @@ def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + @distributed_trace def begin_purge_deleted( self, - vault_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + vault_name: str, + location: str, + **kwargs: Any + ) -> LROPoller[None]: """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. :param vault_name: The name of the soft-deleted vault. @@ -710,15 +1091,17 @@ def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -732,21 +1115,14 @@ def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -758,21 +1134,23 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + @distributed_trace def list( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult] + :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"] @@ -780,38 +1158,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - api_version = "2015-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceListResult', pipeline_response) + deserialized = self._deserialize("ResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -829,17 +1200,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + @distributed_trace def check_name_availability( self, - vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + vault_name: "_models.VaultCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -854,30 +1226,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2016-10-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -891,4 +1253,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py index 1283ff09177b..59fd240c9528 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['KeyVaultManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_configuration.py index 34a178abf5d2..9bf5bc0d8deb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class KeyVaultManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -68,4 +65,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py index e506b0fd141f..c97b7e069e69 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py @@ -6,89 +6,90 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import KeyVaultManagementClientConfiguration -from .operations import VaultsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import Operations -from . import models - -class KeyVaultManagementClient(object): +class KeyVaultManagementClient: """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 + :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 + :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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) - 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 _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json index 68a92e0d0fd5..fba7752195af 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_metadata.json @@ -5,13 +5,13 @@ "name": "KeyVaultManagementClient", "filename": "_key_vault_management_client", "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "vaults": "VaultsOperations", diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_vendor.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py index 726043aa858a..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.3.0" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py index f54ed88d6ad2..8cff887e652d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py @@ -8,3 +8,8 @@ from ._key_vault_management_client import KeyVaultManagementClient __all__ = ['KeyVaultManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_configuration.py index 275a746f8a0d..a0d34b3e215b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py index 2e48391a7143..7227d8accb28 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py @@ -6,85 +6,90 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import KeyVaultManagementClientConfiguration -from .operations import VaultsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import Operations -from .. import models - - -class KeyVaultManagementClient(object): +class KeyVaultManagementClient: """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.VaultsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.keyvault.v2018_02_14.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.keyvault.v2018_02_14.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.keyvault.v2018_02_14.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.keyvault.v2018_02_14.aio.operations.PrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2018_02_14.aio.operations.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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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) - 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 _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py index bb98dcc0dc8a..c4bfdf593dbf 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult] + :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"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py index 0cdf509a71d0..71f5e08a7a15 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -68,28 +73,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,8 +98,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -134,33 +132,23 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -171,14 +159,17 @@ async def put( 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, @@ -191,28 +182,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -220,21 +201,25 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} 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 + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -253,15 +238,19 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -276,25 +265,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -306,4 +287,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py index 02c9cefb5eab..e93a6b5bfc50 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_list_by_vault_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_vault( self, resource_group_name: str, @@ -62,27 +67,17 @@ async def list_by_vault( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - - # Construct URL - url = self.list_by_vault.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_vault_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_vault.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -96,4 +91,6 @@ async def list_by_vault( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py index 80cb22e0e6fe..fda5476fba9e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._vaults_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request, build_get_deleted_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_deleted_request, build_list_request, build_purge_deleted_request_initial, build_update_access_policy_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2018_02_14.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,8 +164,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -196,32 +193,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,8 +226,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -263,25 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - 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] + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -294,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -316,27 +300,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -350,8 +324,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def update_access_policy( self, resource_group_name: str, @@ -380,33 +357,23 @@ async def update_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -424,8 +391,11 @@ async def update_access_policy( 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 + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -441,7 +411,8 @@ def list_by_resource_group( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] + :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"] @@ -449,37 +420,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -497,11 +464,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, top: Optional[int] = None, @@ -513,7 +482,8 @@ def list_by_subscription( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] + :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"] @@ -521,36 +491,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -568,11 +533,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + @distributed_trace def list_deleted( self, **kwargs: Any @@ -580,8 +547,10 @@ def list_deleted( """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultListResult] + :return: An iterator like instance of either 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"] @@ -589,34 +558,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -634,11 +598,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + @distributed_trace_async async def get_deleted( self, vault_name: str, @@ -661,27 +627,17 @@ async def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -695,8 +651,10 @@ async def get_deleted( 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, @@ -708,25 +666,17 @@ async def _purge_deleted_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - 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] + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -739,6 +689,8 @@ async def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + @distributed_trace_async async def begin_purge_deleted( self, vault_name: str, @@ -753,15 +705,17 @@ async def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -775,21 +729,14 @@ async def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -801,8 +748,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + @distributed_trace def list( self, top: Optional[int] = None, @@ -814,7 +763,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult] + :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"] @@ -822,38 +772,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - api_version = "2015-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceListResult', pipeline_response) + deserialized = self._deserialize("ResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -871,11 +814,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + @distributed_trace_async async def check_name_availability( self, vault_name: "_models.VaultCheckNameAvailabilityParameters", @@ -895,30 +840,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -932,4 +867,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/__init__.py index 118b959ac33a..aaeaaee4e5e8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/__init__.py @@ -6,74 +6,40 @@ # 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 ._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 + from ._key_vault_management_client_enums import ( AccessPolicyUpdateKind, diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py index a56975b172c7..0859f28f2360 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessPolicyUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "get" LIST = "list" @@ -51,14 +36,14 @@ class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) BACKUP = "backup" RESTORE = "restore" -class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -77,7 +62,7 @@ class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class NetworkRuleAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. """ @@ -85,7 +70,7 @@ class NetworkRuleAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" -class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. """ @@ -93,7 +78,7 @@ class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu AZURE_SERVICES = "AzureServices" NONE = "None" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -104,7 +89,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive FAILED = "Failed" DISCONNECTED = "Disconnected" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -113,7 +98,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -121,7 +106,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "get" LIST = "list" @@ -132,20 +117,20 @@ class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU family name """ A = "A" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "get" LIST = "list" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py deleted file mode 100644 index 2ee0b2c6683d..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py +++ /dev/null @@ -1,1182 +0,0 @@ -# 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. - - All required parameters must be populated in order to send to Azure. - - :param family: Required. SKU family name. Possible values include: "A". - :type family: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuFamily - :param name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". - :type name: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuName - """ - - _validation = { - 'family': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.family = kwargs.get('family', "A") - self.name = kwargs['name'] - - -class 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: The type of resource, Microsoft.KeyVault/vaults. Has constant value: - "Microsoft.KeyVault/vaults". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.KeyVault/vaults" - - def __init__( - self, - **kwargs - ): - super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class VaultCreateOrUpdateParameters(msrest.serialization.Model): - """Parameters for creating or updating a vault. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. The supported Azure location where the key vault should be created. - :type location: str - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.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 1024 identities that have access to the key vault. All - identities in the array must use the same tenant ID as the key vault's tenant ID. - :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 1024 identities that have access to the key vault. All - identities in the array must use the same tenant ID as the key vault's tenant ID. When - ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access - policies are required. - :type access_policies: list[~azure.mgmt.keyvault.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/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py index 45924f7b3114..0907e3610f53 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py @@ -18,17 +18,17 @@ class AccessPolicyEntry(msrest.serialization.Model): 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 + :ivar 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 + :vartype tenant_id: str + :ivar 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 + :vartype object_id: str + :ivar application_id: Application ID of the client making request on behalf of a principal. + :vartype application_id: str + :ivar permissions: Required. Permissions the identity has for keys, secrets and certificates. + :vartype permissions: ~azure.mgmt.keyvault.v2018_02_14.models.Permissions """ _validation = { @@ -53,6 +53,20 @@ def __init__( application_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword 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. + :paramtype object_id: str + :keyword application_id: Application ID of the client making request on behalf of a principal. + :paramtype application_id: str + :keyword permissions: Required. Permissions the identity has for keys, secrets and + certificates. + :paramtype permissions: ~azure.mgmt.keyvault.v2018_02_14.models.Permissions + """ super(AccessPolicyEntry, self).__init__(**kwargs) self.tenant_id = tenant_id self.object_id = object_id @@ -93,6 +107,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -102,11 +118,11 @@ def __init__( 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 + :ivar code: Error code. This is a mnemonic that can be consumed programmatically. + :vartype code: str + :ivar message: User friendly error message. The message is typically localized and may vary with service version. - :type message: str + :vartype message: str """ _attribute_map = { @@ -121,6 +137,13 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Error code. This is a mnemonic that can be consumed programmatically. + :paramtype code: str + :keyword message: User friendly error message. The message is typically localized and may vary + with service version. + :paramtype message: str + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -137,8 +160,8 @@ class DeletedVault(msrest.serialization.Model): :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 + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultProperties """ _validation = { @@ -160,6 +183,10 @@ def __init__( properties: Optional["DeletedVaultProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultProperties + """ super(DeletedVault, self).__init__(**kwargs) self.id = None self.name = None @@ -170,10 +197,10 @@ def __init__( 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 + :ivar value: The list of deleted vaults. + :vartype value: list[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault] + :ivar next_link: The URL to get the next set of deleted vaults. + :vartype next_link: str """ _attribute_map = { @@ -188,6 +215,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of deleted vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault] + :keyword next_link: The URL to get the next set of deleted vaults. + :paramtype next_link: str + """ super(DeletedVaultListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -230,6 +263,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -243,9 +278,9 @@ class IPRule(msrest.serialization.Model): 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 + :ivar 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 + :vartype value: str """ _validation = { @@ -262,6 +297,11 @@ def __init__( value: str, **kwargs ): + """ + :keyword 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). + :paramtype value: str + """ super(IPRule, self).__init__(**kwargs) self.value = value @@ -269,12 +309,12 @@ def __init__( 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 + :ivar name: Name of log specification. + :vartype name: str + :ivar display_name: Display name of log specification. + :vartype display_name: str + :ivar blob_duration: Blob duration of specification. + :vartype blob_duration: str """ _attribute_map = { @@ -291,6 +331,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of log specification. + :paramtype name: str + :keyword display_name: Display name of log specification. + :paramtype display_name: str + :keyword blob_duration: Blob duration of specification. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -300,18 +348,19 @@ def __init__( 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 + :ivar 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] + :vartype bypass: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleBypassOptions + :ivar 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". + :vartype default_action: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleAction + :ivar ip_rules: The list of IP address rules. + :vartype ip_rules: list[~azure.mgmt.keyvault.v2018_02_14.models.IPRule] + :ivar virtual_network_rules: The list of virtual network rules. + :vartype virtual_network_rules: + list[~azure.mgmt.keyvault.v2018_02_14.models.VirtualNetworkRule] """ _attribute_map = { @@ -330,6 +379,21 @@ def __init__( virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype bypass: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleBypassOptions + :keyword 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". + :paramtype default_action: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleAction + :keyword ip_rules: The list of IP address rules. + :paramtype ip_rules: list[~azure.mgmt.keyvault.v2018_02_14.models.IPRule] + :keyword virtual_network_rules: The list of virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.keyvault.v2018_02_14.models.VirtualNetworkRule] + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.default_action = default_action @@ -340,14 +404,14 @@ def __init__( 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 + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.keyvault.v2018_02_14.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.keyvault.v2018_02_14.models.ServiceSpecification """ _attribute_map = { @@ -366,6 +430,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.keyvault.v2018_02_14.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.keyvault.v2018_02_14.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -376,14 +450,14 @@ def __init__( 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 + :ivar provider: Service provider: Microsoft Key Vault. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of operation. + :vartype description: str """ _attribute_map = { @@ -402,6 +476,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Key Vault. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -412,10 +496,10 @@ def __init__( 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 + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.keyvault.v2018_02_14.models.Operation] + :ivar next_link: The URL to get the next set of operations. + :vartype next_link: str """ _attribute_map = { @@ -430,6 +514,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.keyvault.v2018_02_14.models.Operation] + :keyword next_link: The URL to get the next set of operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -438,14 +528,15 @@ def __init__( 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] + :ivar keys: Permissions to keys. + :vartype keys: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.KeyPermissions] + :ivar secrets: Permissions to secrets. + :vartype secrets: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.SecretPermissions] + :ivar certificates: Permissions to certificates. + :vartype certificates: list[str or + ~azure.mgmt.keyvault.v2018_02_14.models.CertificatePermissions] + :ivar storage: Permissions to storage accounts. + :vartype storage: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.StoragePermissions] """ _attribute_map = { @@ -464,6 +555,17 @@ def __init__( storage: Optional[List[Union[str, "StoragePermissions"]]] = None, **kwargs ): + """ + :keyword keys: Permissions to keys. + :paramtype keys: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.KeyPermissions] + :keyword secrets: Permissions to secrets. + :paramtype secrets: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.SecretPermissions] + :keyword certificates: Permissions to certificates. + :paramtype certificates: list[str or + ~azure.mgmt.keyvault.v2018_02_14.models.CertificatePermissions] + :keyword storage: Permissions to storage accounts. + :paramtype storage: list[str or ~azure.mgmt.keyvault.v2018_02_14.models.StoragePermissions] + """ super(Permissions, self).__init__(**kwargs) self.keys = keys self.secrets = secrets @@ -492,6 +594,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -533,6 +637,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -556,10 +662,10 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] - :param 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: + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype 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". @@ -594,6 +700,13 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -605,10 +718,10 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): 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: + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype 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". @@ -633,6 +746,13 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnectionItem, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -658,8 +778,8 @@ class PrivateLinkResource(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] + :ivar required_zone_names: Required DNS zone names of the the private link resource. + :vartype required_zone_names: list[str] """ _validation = { @@ -689,6 +809,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: Required DNS zone names of the the private link resource. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -698,8 +822,8 @@ def __init__( 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] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResource] """ _attribute_map = { @@ -712,6 +836,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -719,15 +847,15 @@ def __init__( 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 + :ivar 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 + :vartype 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 + :ivar description: The reason for approval or rejection. + :vartype description: str + :ivar action_required: A message indicating if changes on the service provider require any updates on the consumer. - :type action_required: str + :vartype action_required: str """ _attribute_map = { @@ -744,6 +872,17 @@ def __init__( action_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval or rejection. + :paramtype description: str + :keyword action_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype action_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -753,10 +892,10 @@ def __init__( 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 + :ivar value: The list of vault resources. + :vartype value: list[~azure.mgmt.keyvault.v2018_02_14.models.Resource] + :ivar next_link: The URL to get the next set of vault resources. + :vartype next_link: str """ _attribute_map = { @@ -771,6 +910,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of vault resources. + :paramtype value: list[~azure.mgmt.keyvault.v2018_02_14.models.Resource] + :keyword next_link: The URL to get the next set of vault resources. + :paramtype next_link: str + """ super(ResourceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -779,8 +924,8 @@ def __init__( 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] + :ivar log_specifications: Log specifications of operation. + :vartype log_specifications: list[~azure.mgmt.keyvault.v2018_02_14.models.LogSpecification] """ _attribute_map = { @@ -793,6 +938,10 @@ def __init__( log_specifications: Optional[List["LogSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Log specifications of operation. + :paramtype log_specifications: list[~azure.mgmt.keyvault.v2018_02_14.models.LogSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications @@ -802,11 +951,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param family: Required. SKU family name. Possible values include: "A". - :type family: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuFamily - :param name: Required. SKU name to specify whether the key vault is a standard vault or a + :ivar family: Required. SKU family name. Possible values include: "A". + :vartype family: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuFamily + :ivar 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 + :vartype name: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuName """ _validation = { @@ -826,6 +975,13 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword family: Required. SKU family name. Possible values include: "A". + :paramtype family: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuFamily + :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: "standard", "premium". + :paramtype name: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.family = family self.name = name @@ -844,12 +1000,12 @@ class Vault(msrest.serialization.Model): :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 + :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 properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultProperties """ _validation = { @@ -876,6 +1032,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Azure location of the key vault resource. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to the key vault resource. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultProperties + """ super(Vault, self).__init__(**kwargs) self.id = None self.name = None @@ -900,8 +1064,8 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): :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 + :ivar properties: Required. Properties of the access policy. + :vartype properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyProperties """ _validation = { @@ -926,6 +1090,10 @@ def __init__( properties: "VaultAccessPolicyProperties", **kwargs ): + """ + :keyword properties: Required. Properties of the access policy. + :paramtype properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyProperties + """ super(VaultAccessPolicyParameters, self).__init__(**kwargs) self.id = None self.name = None @@ -939,9 +1107,9 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): 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 + :ivar 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] + :vartype access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] """ _validation = { @@ -958,6 +1126,11 @@ def __init__( access_policies: List["AccessPolicyEntry"], **kwargs ): + """ + :keyword 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. + :paramtype access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] + """ super(VaultAccessPolicyProperties, self).__init__(**kwargs) self.access_policies = access_policies @@ -969,8 +1142,8 @@ class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The vault name. - :type name: str + :ivar name: Required. The vault name. + :vartype name: str :ivar type: The type of resource, Microsoft.KeyVault/vaults. Has constant value: "Microsoft.KeyVault/vaults". :vartype type: str @@ -994,6 +1167,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -1003,12 +1180,12 @@ class VaultCreateOrUpdateParameters(msrest.serialization.Model): 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 + :ivar location: Required. The supported Azure location where the key vault should be created. + :vartype location: str + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultProperties """ _validation = { @@ -1030,6 +1207,15 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The supported Azure location where the key vault should be + created. + :paramtype location: str + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultProperties + """ super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) self.location = location self.tags = tags @@ -1039,10 +1225,10 @@ def __init__( 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 + :ivar value: The list of vaults. + :vartype value: list[~azure.mgmt.keyvault.v2018_02_14.models.Vault] + :ivar next_link: The URL to get the next set of vaults. + :vartype next_link: str """ _attribute_map = { @@ -1057,6 +1243,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2018_02_14.models.Vault] + :keyword next_link: The URL to get the next set of vaults. + :paramtype next_link: str + """ super(VaultListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1065,10 +1257,10 @@ def __init__( 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 + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultPatchProperties """ _attribute_map = { @@ -1083,6 +1275,12 @@ def __init__( properties: Optional["VaultPatchProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2018_02_14.models.VaultPatchProperties + """ super(VaultPatchParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -1091,38 +1289,38 @@ def __init__( class VaultPatchProperties(msrest.serialization.Model): """Properties of the vault. - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + :ivar 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 1024 identities that have access to the key vault. All + :vartype tenant_id: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2018_02_14.models.Sku + :ivar access_policies: An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. - :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 + :vartype access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] + :ivar 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 + :vartype enabled_for_deployment: bool + :ivar 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 + :vartype enabled_for_disk_encryption: bool + :ivar 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 + :vartype enabled_for_template_deployment: bool + :ivar 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 + :vartype enable_soft_delete: bool + :ivar 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 + :vartype create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode + :ivar 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 + :vartype enable_purge_protection: bool + :ivar 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 + :vartype network_acls: ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleSet """ _attribute_map = { @@ -1153,6 +1351,40 @@ def __init__( network_acls: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. + :paramtype tenant_id: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2018_02_14.models.Sku + :keyword access_policies: An array of 0 to 1024 identities that have access to the key vault. + All identities in the array must use the same tenant ID as the key vault's tenant ID. + :paramtype access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. It does not accept false value. + :paramtype enable_soft_delete: bool + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode + :keyword 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. + :paramtype enable_purge_protection: bool + :keyword network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleSet + """ super(VaultPatchProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -1173,42 +1405,42 @@ class VaultProperties(msrest.serialization.Model): 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 + :ivar 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 1024 identities that have access to the key vault. All + :vartype tenant_id: str + :ivar sku: Required. SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2018_02_14.models.Sku + :ivar access_policies: An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. When ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. - :type access_policies: list[~azure.mgmt.keyvault.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 + :vartype access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] + :ivar vault_uri: The URI of the vault for performing operations on keys and secrets. + :vartype vault_uri: str + :ivar 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 + :vartype enabled_for_deployment: bool + :ivar 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 + :vartype enabled_for_disk_encryption: bool + :ivar 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 + :vartype enabled_for_template_deployment: bool + :ivar 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 + :vartype enable_soft_delete: bool + :ivar 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 + :vartype create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode + :ivar 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 + :vartype enable_purge_protection: bool + :ivar 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 + :vartype 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: @@ -1252,6 +1484,44 @@ def __init__( network_acls: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword sku: Required. SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2018_02_14.models.Sku + :keyword access_policies: An array of 0 to 1024 identities that have access to the key vault. + All identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :paramtype access_policies: list[~azure.mgmt.keyvault.v2018_02_14.models.AccessPolicyEntry] + :keyword vault_uri: The URI of the vault for performing operations on keys and secrets. + :paramtype vault_uri: str + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. It does not accept false value. + :paramtype enable_soft_delete: bool + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode + :keyword 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. + :paramtype enable_purge_protection: bool + :keyword network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleSet + """ super(VaultProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -1272,9 +1542,9 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. Full resource id of a vnet subnet, such as + :ivar 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 + :vartype id: str """ _validation = { @@ -1291,5 +1561,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :paramtype id: str + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.id = id diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py index 3a1d9d80ba63..378a596d5f7d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KeyVault/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult] + :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"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py index 7d44d6c3ffaf..51d5b3851bf9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py @@ -5,24 +5,147 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_put_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -46,14 +169,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_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. @@ -73,28 +196,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -108,17 +221,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -140,33 +255,23 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -177,49 +282,41 @@ def put( response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -227,29 +324,32 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} 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 + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -261,15 +361,19 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -284,25 +388,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -314,4 +410,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py index ef08089bc1a9..777ea1685110 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py @@ -5,22 +5,59 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_vault_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_vault( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -67,27 +104,17 @@ def list_by_vault( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - - # Construct URL - url = self.list_by_vault.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_vault_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_vault.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +128,6 @@ def list_by_vault( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py index 005683a27811..9cb5a7c2d0d3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py @@ -5,25 +5,470 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-14" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_access_policy_request( + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "operationKind": _SERIALIZER.url("operation_kind", operation_kind, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_deleted_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_deleted_request( + vault_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}') + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_purge_deleted_request_initial( + vault_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2018-02-14" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge') + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2015-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2018-02-14" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VaultsOperations(object): """VaultsOperations operations. @@ -49,43 +494,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.Vault": cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +537,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - vault_name, # type: str - parameters, # type: "_models.VaultCreateOrUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Vault"] + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Vault"]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -123,15 +559,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Vault or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +582,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,16 +608,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - vault_name, # type: str - parameters, # type: "_models.VaultPatchParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultPatchParameters", + **kwargs: Any + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -203,32 +637,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VaultPatchParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -246,15 +670,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> None: """Deletes the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -271,25 +697,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - 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] + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -302,13 +720,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -325,27 +744,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -359,17 +768,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def update_access_policy( self, - resource_group_name, # type: str - vault_name, # type: str - operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] - parameters, # type: "_models.VaultAccessPolicyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultAccessPolicyParameters" + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", + **kwargs: Any + ) -> "_models.VaultAccessPolicyParameters": """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -390,33 +801,23 @@ def update_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -434,15 +835,17 @@ def update_access_policy( 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 + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultListResult"] + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -460,37 +863,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -508,17 +907,18 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -533,36 +933,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -580,21 +975,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + @distributed_trace def list_deleted( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedVaultListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultListResult] + :return: An iterator like instance of either 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"] @@ -602,34 +1000,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -647,18 +1040,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + @distributed_trace def get_deleted( self, - vault_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedVault" + vault_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -675,27 +1069,17 @@ def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -709,39 +1093,32 @@ def get_deleted( 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 + vault_name: str, + location: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "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] + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -754,13 +1131,14 @@ def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + @distributed_trace def begin_purge_deleted( self, - vault_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + vault_name: str, + location: str, + **kwargs: Any + ) -> LROPoller[None]: """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. :param vault_name: The name of the soft-deleted vault. @@ -769,15 +1147,17 @@ def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -791,21 +1171,14 @@ def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -817,21 +1190,23 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + @distributed_trace def list( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult] + :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"] @@ -839,38 +1214,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - api_version = "2015-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceListResult', pipeline_response) + deserialized = self._deserialize("ResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -888,17 +1256,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + @distributed_trace def check_name_availability( self, - vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + vault_name: "_models.VaultCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -913,30 +1282,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-02-14" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -950,4 +1309,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py index 1283ff09177b..59fd240c9528 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['KeyVaultManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_configuration.py index 087231506a2b..a8f7343f864d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class KeyVaultManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -68,4 +65,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py index d36c34328fc1..01dffaf8a076 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py @@ -6,94 +6,93 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import KeysOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import KeyVaultManagementClientConfiguration -from .operations import VaultsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import Operations -from .operations import KeysOperations -from . import models - -class KeyVaultManagementClient(object): +class KeyVaultManagementClient: """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 + :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 + :vartype private_link_resources: + azure.mgmt.keyvault.v2019_09_01.operations.PrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2019_09_01.operations.Operations :ivar keys: KeysOperations operations :vartype keys: azure.mgmt.keyvault.v2019_09_01.operations.KeysOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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) + self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.keys = KeysOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json index a4f618e64f76..59f17277cc9d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_metadata.json @@ -5,13 +5,13 @@ "name": "KeyVaultManagementClient", "filename": "_key_vault_management_client", "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "vaults": "VaultsOperations", diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_vendor.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py index 726043aa858a..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.3.0" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py index f54ed88d6ad2..8cff887e652d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._key_vault_management_client import KeyVaultManagementClient __all__ = ['KeyVaultManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_configuration.py index 0130b144f988..fb0cfaa56df8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py index a8bba864b878..4e2a1c8ae612 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py @@ -6,90 +6,93 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import KeysOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import KeyVaultManagementClientConfiguration -from .operations import VaultsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import Operations -from .operations import KeysOperations -from .. import models - - -class KeyVaultManagementClient(object): +class KeyVaultManagementClient: """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.VaultsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.keyvault.v2019_09_01.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.keyvault.v2019_09_01.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.keyvault.v2019_09_01.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.keyvault.v2019_09_01.aio.operations.PrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2019_09_01.aio.operations.Operations :ivar keys: KeysOperations operations :vartype keys: azure.mgmt.keyvault.v2019_09_01.aio.operations.KeysOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + 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) + self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) + - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.keys = KeysOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py index 4300c91f2cc1..8a51868d5e93 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._keys_operations import build_create_if_not_exist_request, build_get_request, build_get_version_request, build_list_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_if_not_exist( self, resource_group_name: str, @@ -72,33 +78,23 @@ async def create_if_not_exist( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_if_not_exist.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'KeyCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_if_not_exist_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + content_type=content_type, + json=_json, + template_url=self.create_if_not_exist.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'KeyCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -112,8 +108,11 @@ async def create_if_not_exist( return cls(pipeline_response, deserialized, {}) return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -140,28 +139,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -192,7 +184,8 @@ def list( :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either KeyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] @@ -200,36 +193,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('KeyListResult', pipeline_response) + deserialized = self._deserialize("KeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -247,11 +237,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} # type: ignore + @distributed_trace_async async def get_version( self, resource_group_name: str, @@ -281,29 +273,19 @@ async def get_version( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.get_version.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'keyVersion': self._serialize.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_version_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + key_version=key_version, + template_url=self.get_version.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -317,8 +299,11 @@ async def get_version( return cls(pipeline_response, deserialized, {}) return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} # type: ignore + + @distributed_trace def list_versions( self, resource_group_name: str, @@ -337,7 +322,8 @@ def list_versions( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either KeyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] @@ -345,37 +331,35 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_versions.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('KeyListResult', pipeline_response) + deserialized = self._deserialize("KeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -393,6 +377,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py index d236a09d04b6..b24d456c073a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult] + :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"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py index fb38961dbcf2..da9ee73ee728 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -68,28 +73,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -136,33 +134,23 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -173,14 +161,17 @@ async def put( 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, @@ -193,28 +184,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -222,21 +203,25 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} 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 + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -255,15 +240,19 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,25 +267,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -308,4 +289,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py index fa0ee15146b9..71b6e38202ea 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_list_by_vault_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_vault( self, resource_group_name: str, @@ -62,27 +67,17 @@ async def list_by_vault( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.list_by_vault.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_vault_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_vault.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -96,4 +91,6 @@ async def list_by_vault( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py index da41e602d0a4..ef187e751757 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._vaults_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request, build_get_deleted_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_deleted_request, build_list_request, build_purge_deleted_request_initial, build_update_access_policy_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,18 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2019_09_01.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +138,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,8 +164,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -196,32 +193,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,8 +226,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -263,27 +253,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -296,6 +276,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -318,27 +300,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -352,8 +324,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def update_access_policy( self, resource_group_name: str, @@ -382,33 +357,23 @@ async def update_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -426,8 +391,11 @@ async def update_access_policy( 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 + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -443,7 +411,8 @@ def list_by_resource_group( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] + :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"] @@ -451,37 +420,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,11 +464,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, top: Optional[int] = None, @@ -515,7 +482,8 @@ def list_by_subscription( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] + :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"] @@ -523,36 +491,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -570,11 +533,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + @distributed_trace def list_deleted( self, **kwargs: Any @@ -582,8 +547,10 @@ def list_deleted( """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult] + :return: An iterator like instance of either 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"] @@ -591,34 +558,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -636,11 +598,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + @distributed_trace_async async def get_deleted( self, vault_name: str, @@ -663,27 +627,17 @@ async def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -697,8 +651,10 @@ async def get_deleted( 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, @@ -710,27 +666,17 @@ async def _purge_deleted_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self._purge_deleted_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -743,6 +689,8 @@ async def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + @distributed_trace_async async def begin_purge_deleted( self, vault_name: str, @@ -757,15 +705,17 @@ async def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -779,21 +729,14 @@ async def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -805,8 +748,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + @distributed_trace def list( self, top: Optional[int] = None, @@ -818,7 +763,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult] + :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"] @@ -826,38 +772,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - api_version = "2015-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceListResult', pipeline_response) + deserialized = self._deserialize("ResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -875,11 +814,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + @distributed_trace_async async def check_name_availability( self, vault_name: "_models.VaultCheckNameAvailabilityParameters", @@ -899,30 +840,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -936,4 +867,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py index bb20570b32f7..a06eaad61a37 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py @@ -6,90 +6,48 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessPolicyEntry - from ._models_py3 import Attributes - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudErrorBody - from ._models_py3 import DeletedVault - from ._models_py3 import DeletedVaultListResult - from ._models_py3 import DeletedVaultProperties - from ._models_py3 import DimensionProperties - from ._models_py3 import IPRule - from ._models_py3 import Key - from ._models_py3 import KeyAttributes - from ._models_py3 import KeyCreateParameters - from ._models_py3 import KeyListResult - from ._models_py3 import KeyProperties - from ._models_py3 import LogSpecification - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkRuleSet - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - 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 Attributes # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import DeletedVault # type: ignore - from ._models import DeletedVaultListResult # type: ignore - from ._models import DeletedVaultProperties # type: ignore - from ._models import DimensionProperties # type: ignore - from ._models import IPRule # type: ignore - from ._models import Key # type: ignore - from ._models import KeyAttributes # type: ignore - from ._models import KeyCreateParameters # type: ignore - from ._models import KeyListResult # type: ignore - from ._models import KeyProperties # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - 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 ._models_py3 import AccessPolicyEntry +from ._models_py3 import Attributes +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import DeletedVault +from ._models_py3 import DeletedVaultListResult +from ._models_py3 import DeletedVaultProperties +from ._models_py3 import DimensionProperties +from ._models_py3 import IPRule +from ._models_py3 import Key +from ._models_py3 import KeyAttributes +from ._models_py3 import KeyCreateParameters +from ._models_py3 import KeyListResult +from ._models_py3 import KeyProperties +from ._models_py3 import LogSpecification +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +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 + from ._key_vault_management_client_enums import ( AccessPolicyUpdateKind, diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py index 921758eff66a..b1639786c8e3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessPolicyUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALL = "all" GET = "get" @@ -52,14 +37,14 @@ class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) BACKUP = "backup" RESTORE = "restore" -class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval. @@ -70,7 +55,7 @@ class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) RECOVERABLE = "Recoverable" RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The elliptic curve name. For valid values, see JsonWebKeyCurveName. """ @@ -79,7 +64,7 @@ class JsonWebKeyCurveName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): P521 = "P-521" P256_K = "P-256K" -class JsonWebKeyOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The permitted JSON web key operations of the key. For more information, see JsonWebKeyOperation. """ @@ -92,7 +77,7 @@ class JsonWebKeyOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UNWRAP_KEY = "unwrapKey" IMPORT_ENUM = "import" -class JsonWebKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the key. For valid values, see JsonWebKeyType. """ @@ -101,7 +86,7 @@ class JsonWebKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RSA = "RSA" RSA_HSM = "RSA-HSM" -class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALL = "all" ENCRYPT = "encrypt" @@ -121,7 +106,7 @@ class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class NetworkRuleAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. """ @@ -129,7 +114,7 @@ class NetworkRuleAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" -class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. """ @@ -137,7 +122,7 @@ class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu AZURE_SERVICES = "AzureServices" NONE = "None" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -148,7 +133,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive FAILED = "Failed" DISCONNECTED = "Disconnected" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -157,7 +142,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -165,7 +150,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALL = "all" GET = "get" @@ -177,20 +162,20 @@ class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU family name """ A = "A" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALL = "all" GET = "get" @@ -208,7 +193,7 @@ class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GETSAS = "getsas" DELETESAS = "deletesas" -class VaultProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VaultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the vault. """ diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py deleted file mode 100644 index cd62451dea0a..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py +++ /dev/null @@ -1,1610 +0,0 @@ -# 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 Attributes(msrest.serialization.Model): - """The object attributes managed by the Azure Key Vault service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: Determines whether or not the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: long - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: long - :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. - :vartype created: long - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: long - :ivar recovery_level: The deletion recovery level currently in effect for the object. If it - contains 'Purgeable', then the object can be permanently deleted by a privileged user; - otherwise, only the system can purge the object at the end of the retention interval. Possible - values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", - "Recoverable+ProtectedSubscription". - :vartype recovery_level: str or ~azure.mgmt.keyvault.v2019_09_01.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'long'}, - 'expires': {'key': 'exp', 'type': 'long'}, - 'created': {'key': 'created', 'type': 'long'}, - 'updated': {'key': 'updated', 'type': 'long'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Attributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.not_before = kwargs.get('not_before', None) - self.expires = kwargs.get('expires', None) - self.created = None - self.updated = None - self.recovery_level = None - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - 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] - :ivar purge_protection_enabled: Purge protection status of the original vault. - :vartype purge_protection_enabled: bool - """ - - _validation = { - 'vault_id': {'readonly': True}, - 'location': {'readonly': True}, - 'deletion_date': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'tags': {'readonly': True}, - 'purge_protection_enabled': {'readonly': True}, - } - - _attribute_map = { - 'vault_id': {'key': 'vaultId', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedVaultProperties, self).__init__(**kwargs) - self.vault_id = None - self.location = None - self.deletion_date = None - self.scheduled_purge_date = None - self.tags = None - self.purge_protection_enabled = None - - -class DimensionProperties(msrest.serialization.Model): - """Type of operation: get, read, delete, etc. - - :param name: Name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported - for shoebox. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DimensionProperties, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class IPRule(msrest.serialization.Model): - """A rule governing the accessibility of a vault from a specific ip address or ip range. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple - IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). - :type value: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.value = kwargs['value'] - - -class Resource(msrest.serialization.Model): - """Key Vault resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None - - -class Key(Resource): - """The key resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :param attributes: The attributes of the key. - :type attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes - :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". - :type kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :type key_size: int - :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". - :type curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName - :ivar key_uri: The URI to retrieve the current version of the key. - :vartype key_uri: str - :ivar key_uri_with_version: The URI to retrieve the specific version of the key. - :vartype key_uri_with_version: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - 'key_uri': {'readonly': True}, - 'key_uri_with_version': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'attributes': {'key': 'properties.attributes', 'type': 'KeyAttributes'}, - 'kty': {'key': 'properties.kty', 'type': 'str'}, - 'key_ops': {'key': 'properties.keyOps', 'type': '[str]'}, - 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'curve_name': {'key': 'properties.curveName', 'type': 'str'}, - 'key_uri': {'key': 'properties.keyUri', 'type': 'str'}, - 'key_uri_with_version': {'key': 'properties.keyUriWithVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Key, self).__init__(**kwargs) - self.attributes = kwargs.get('attributes', None) - self.kty = kwargs.get('kty', None) - self.key_ops = kwargs.get('key_ops', None) - self.key_size = kwargs.get('key_size', None) - self.curve_name = kwargs.get('curve_name', None) - self.key_uri = None - self.key_uri_with_version = None - - -class KeyAttributes(Attributes): - """The attributes of the key. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: Determines whether or not the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: long - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: long - :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. - :vartype created: long - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: long - :ivar recovery_level: The deletion recovery level currently in effect for the object. If it - contains 'Purgeable', then the object can be permanently deleted by a privileged user; - otherwise, only the system can purge the object at the end of the retention interval. Possible - values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", - "Recoverable+ProtectedSubscription". - :vartype recovery_level: str or ~azure.mgmt.keyvault.v2019_09_01.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'long'}, - 'expires': {'key': 'exp', 'type': 'long'}, - 'created': {'key': 'created', 'type': 'long'}, - 'updated': {'key': 'updated', 'type': 'long'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyAttributes, self).__init__(**kwargs) - - -class KeyCreateParameters(msrest.serialization.Model): - """The parameters used to create a key. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. The tags that will be assigned to the key. - :type tags: dict[str, str] - :param properties: Required. The properties of the key to be created. - :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.KeyProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'KeyProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyCreateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.properties = kwargs['properties'] - - -class KeyListResult(msrest.serialization.Model): - """The page of keys. - - :param value: The key resources. - :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.Key] - :param next_link: The URL to get the next page of keys. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Key]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class KeyProperties(msrest.serialization.Model): - """The properties of the key. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param attributes: The attributes of the key. - :type attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes - :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". - :type kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :type key_size: int - :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". - :type curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName - :ivar key_uri: The URI to retrieve the current version of the key. - :vartype key_uri: str - :ivar key_uri_with_version: The URI to retrieve the specific version of the key. - :vartype key_uri_with_version: str - """ - - _validation = { - 'key_uri': {'readonly': True}, - 'key_uri_with_version': {'readonly': True}, - } - - _attribute_map = { - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'kty': {'key': 'kty', 'type': 'str'}, - 'key_ops': {'key': 'keyOps', 'type': '[str]'}, - 'key_size': {'key': 'keySize', 'type': 'int'}, - 'curve_name': {'key': 'curveName', 'type': 'str'}, - 'key_uri': {'key': 'keyUri', 'type': 'str'}, - 'key_uri_with_version': {'key': 'keyUriWithVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyProperties, self).__init__(**kwargs) - self.attributes = kwargs.get('attributes', None) - self.kty = kwargs.get('kty', None) - self.key_ops = kwargs.get('key_ops', None) - self.key_size = kwargs.get('key_size', None) - self.curve_name = kwargs.get('curve_name', None) - self.key_uri = None - self.key_uri_with_version = None - - -class LogSpecification(msrest.serialization.Model): - """Log specification of operation. - - :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 MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of Metric specification. - :type display_name: str - :param display_description: Display description of Metric specification. - :type display_description: str - :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. - :type unit: str - :param aggregation_type: The metric aggregation type. Possible values include: 'Average', - 'Count', 'Total'. - :type aggregation_type: str - :param supported_aggregation_types: The supported aggregation types for the metrics. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: The supported time grain types for the metrics. - :type supported_time_grain_types: list[str] - :param lock_aggregation_type: The metric lock aggregation type. - :type lock_aggregation_type: str - :param dimensions: The dimensions of metric. - :type dimensions: list[~azure.mgmt.keyvault.v2019_09_01.models.DimensionProperties] - :param fill_gap_with_zero: Property to specify whether to fill gap with zero. - :type fill_gap_with_zero: bool - :param internal_metric_name: The internal metric name. - :type internal_metric_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.lock_aggregation_type = kwargs.get('lock_aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.internal_metric_name = kwargs.get('internal_metric_name', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """A set of rules governing the network accessibility of a vault. - - :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 is_data_action: Property to specify whether the action is a data action. - :type is_data_action: bool - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Key Vault. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.keyvault.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 PrivateEndpointConnection(Resource): - """Private endpoint connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.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}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = 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 id: Id of private endpoint connection. - :type id: str - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :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 = { - 'id': {'key': 'id', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.etag = kwargs.get('etag', None) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = 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 actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class ResourceListResult(msrest.serialization.Model): - """List of vault resources. - - :param value: The list of vault resources. - :type value: list[~azure.mgmt.keyvault.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] - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.MetricSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """SKU details. - - All required parameters must be populated in order to send to Azure. - - :param family: Required. SKU family name. Possible values include: "A". - :type family: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuFamily - :param name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". - :type name: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuName - """ - - _validation = { - 'family': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.family = kwargs.get('family', "A") - self.name = kwargs['name'] - - -class 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: The type of resource, Microsoft.KeyVault/vaults. Has constant value: - "Microsoft.KeyVault/vaults". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.KeyVault/vaults" - - def __init__( - self, - **kwargs - ): - super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class VaultCreateOrUpdateParameters(msrest.serialization.Model): - """Parameters for creating or updating a vault. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. The supported Azure location where the key vault should be created. - :type location: str - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.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. 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 1024 identities that have access to the key vault. All - identities in the array must use the same tenant ID as the key vault's tenant ID. When - ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access - policies are required. - :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. This - property is readonly. - :type vault_uri: str - :ivar hsm_pool_resource_id: The resource id of HSM Pool. - :vartype hsm_pool_resource_id: str - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted - to retrieve certificates stored as secrets from the key vault. - :type enabled_for_deployment: bool - :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. 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 - :param provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". - :type provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.VaultProvisioningState - :ivar private_endpoint_connections: List of private endpoint connections associated with the - key vault. - :vartype private_endpoint_connections: - list[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionItem] - """ - - _validation = { - 'tenant_id': {'required': True}, - 'sku': {'required': True}, - 'hsm_pool_resource_id': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, - 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, - 'hsm_pool_resource_id': {'key': 'hsmPoolResourceId', 'type': 'str'}, - 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, - 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, - 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, - 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, - 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, - 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultProperties, self).__init__(**kwargs) - self.tenant_id = kwargs['tenant_id'] - self.sku = kwargs['sku'] - self.access_policies = kwargs.get('access_policies', None) - self.vault_uri = kwargs.get('vault_uri', None) - self.hsm_pool_resource_id = None - self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) - self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) - self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) - self.enable_soft_delete = kwargs.get('enable_soft_delete', True) - self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', 90) - self.enable_rbac_authorization = kwargs.get('enable_rbac_authorization', False) - self.create_mode = kwargs.get('create_mode', None) - self.enable_purge_protection = kwargs.get('enable_purge_protection', None) - self.network_acls = kwargs.get('network_acls', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.private_endpoint_connections = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """A rule governing the accessibility of a vault from a specific virtual network. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - :type id: str - :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the - check if parent subnet has serviceEndpoints configured. - :type ignore_missing_vnet_service_endpoint: bool - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.id = kwargs['id'] - self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py index c3618490ba6b..66457d2dd8f0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py @@ -18,17 +18,17 @@ class AccessPolicyEntry(msrest.serialization.Model): 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 + :ivar 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 + :vartype tenant_id: str + :ivar 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 + :vartype object_id: str + :ivar application_id: Application ID of the client making request on behalf of a principal. + :vartype application_id: str + :ivar permissions: Required. Permissions the identity has for keys, secrets and certificates. + :vartype permissions: ~azure.mgmt.keyvault.v2019_09_01.models.Permissions """ _validation = { @@ -53,6 +53,20 @@ def __init__( application_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword 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. + :paramtype object_id: str + :keyword application_id: Application ID of the client making request on behalf of a principal. + :paramtype application_id: str + :keyword permissions: Required. Permissions the identity has for keys, secrets and + certificates. + :paramtype permissions: ~azure.mgmt.keyvault.v2019_09_01.models.Permissions + """ super(AccessPolicyEntry, self).__init__(**kwargs) self.tenant_id = tenant_id self.object_id = object_id @@ -65,12 +79,12 @@ class Attributes(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: Determines whether or not the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: long - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: long + :ivar enabled: Determines whether or not the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :vartype not_before: long + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: long :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. :vartype created: long :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. @@ -106,6 +120,14 @@ def __init__( expires: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Determines whether or not the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :paramtype not_before: long + :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :paramtype expires: long + """ super(Attributes, self).__init__(**kwargs) self.enabled = enabled self.not_before = not_before @@ -148,6 +170,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -157,11 +181,11 @@ def __init__( 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 + :ivar code: Error code. This is a mnemonic that can be consumed programmatically. + :vartype code: str + :ivar message: User friendly error message. The message is typically localized and may vary with service version. - :type message: str + :vartype message: str """ _attribute_map = { @@ -176,6 +200,13 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Error code. This is a mnemonic that can be consumed programmatically. + :paramtype code: str + :keyword message: User friendly error message. The message is typically localized and may vary + with service version. + :paramtype message: str + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -192,8 +223,8 @@ class DeletedVault(msrest.serialization.Model): :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 + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultProperties """ _validation = { @@ -215,6 +246,10 @@ def __init__( properties: Optional["DeletedVaultProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultProperties + """ super(DeletedVault, self).__init__(**kwargs) self.id = None self.name = None @@ -225,10 +260,10 @@ def __init__( 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 + :ivar value: The list of deleted vaults. + :vartype value: list[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault] + :ivar next_link: The URL to get the next set of deleted vaults. + :vartype next_link: str """ _attribute_map = { @@ -243,6 +278,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of deleted vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault] + :keyword next_link: The URL to get the next set of deleted vaults. + :paramtype next_link: str + """ super(DeletedVaultListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -289,6 +330,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -301,13 +344,13 @@ def __init__( class DimensionProperties(msrest.serialization.Model): """Type of operation: get, read, delete, etc. - :param name: Name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported + :ivar name: Name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Property to specify whether the dimension should be exported for shoebox. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -324,6 +367,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Property to specify whether the dimension should be + exported for shoebox. + :paramtype to_be_exported_for_shoebox: bool + """ super(DimensionProperties, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -335,9 +387,9 @@ class IPRule(msrest.serialization.Model): 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 + :ivar 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 + :vartype value: str """ _validation = { @@ -354,6 +406,11 @@ def __init__( value: str, **kwargs ): + """ + :keyword 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). + :paramtype value: str + """ super(IPRule, self).__init__(**kwargs) self.value = value @@ -395,6 +452,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -418,18 +477,18 @@ class Key(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] - :param attributes: The attributes of the key. - :type attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes - :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + :ivar attributes: The attributes of the key. + :vartype attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM". - :type kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :type key_size: int - :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + :vartype kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType + :ivar key_ops: + :vartype key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :vartype key_size: int + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: "P-256", "P-384", "P-521", "P-256K". - :type curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName + :vartype curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str :ivar key_uri_with_version: The URI to retrieve the specific version of the key. @@ -471,6 +530,20 @@ def __init__( curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, **kwargs ): + """ + :keyword attributes: The attributes of the key. + :paramtype attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values + include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :paramtype kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType + :keyword key_ops: + :paramtype key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] + :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :paramtype key_size: int + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. + Possible values include: "P-256", "P-384", "P-521", "P-256K". + :paramtype curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName + """ super(Key, self).__init__(**kwargs) self.attributes = attributes self.kty = kty @@ -486,12 +559,12 @@ class KeyAttributes(Attributes): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: Determines whether or not the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: long - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: long + :ivar enabled: Determines whether or not the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :vartype not_before: long + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: long :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. :vartype created: long :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. @@ -527,6 +600,14 @@ def __init__( expires: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Determines whether or not the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :paramtype not_before: long + :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :paramtype expires: long + """ super(KeyAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) @@ -535,10 +616,10 @@ class KeyCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. The tags that will be assigned to the key. - :type tags: dict[str, str] - :param properties: Required. The properties of the key to be created. - :type properties: ~azure.mgmt.keyvault.v2019_09_01.models.KeyProperties + :ivar tags: A set of tags. The tags that will be assigned to the key. + :vartype tags: dict[str, str] + :ivar properties: Required. The properties of the key to be created. + :vartype properties: ~azure.mgmt.keyvault.v2019_09_01.models.KeyProperties """ _validation = { @@ -557,6 +638,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the key. + :paramtype tags: dict[str, str] + :keyword properties: Required. The properties of the key to be created. + :paramtype properties: ~azure.mgmt.keyvault.v2019_09_01.models.KeyProperties + """ super(KeyCreateParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -565,10 +652,10 @@ def __init__( class KeyListResult(msrest.serialization.Model): """The page of keys. - :param value: The key resources. - :type value: list[~azure.mgmt.keyvault.v2019_09_01.models.Key] - :param next_link: The URL to get the next page of keys. - :type next_link: str + :ivar value: The key resources. + :vartype value: list[~azure.mgmt.keyvault.v2019_09_01.models.Key] + :ivar next_link: The URL to get the next page of keys. + :vartype next_link: str """ _attribute_map = { @@ -583,6 +670,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The key resources. + :paramtype value: list[~azure.mgmt.keyvault.v2019_09_01.models.Key] + :keyword next_link: The URL to get the next page of keys. + :paramtype next_link: str + """ super(KeyListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -593,18 +686,18 @@ class KeyProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param attributes: The attributes of the key. - :type attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes - :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + :ivar attributes: The attributes of the key. + :vartype attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM". - :type kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :type key_size: int - :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + :vartype kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType + :ivar key_ops: + :vartype key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :vartype key_size: int + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: "P-256", "P-384", "P-521", "P-256K". - :type curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName + :vartype curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str :ivar key_uri_with_version: The URI to retrieve the specific version of the key. @@ -636,6 +729,20 @@ def __init__( curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, **kwargs ): + """ + :keyword attributes: The attributes of the key. + :paramtype attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values + include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :paramtype kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType + :keyword key_ops: + :paramtype key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] + :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :paramtype key_size: int + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. + Possible values include: "P-256", "P-384", "P-521", "P-256K". + :paramtype curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName + """ super(KeyProperties, self).__init__(**kwargs) self.attributes = attributes self.kty = kty @@ -649,12 +756,12 @@ def __init__( 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 + :ivar name: Name of log specification. + :vartype name: str + :ivar display_name: Display name of log specification. + :vartype display_name: str + :ivar blob_duration: Blob duration of specification. + :vartype blob_duration: str """ _attribute_map = { @@ -671,6 +778,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of log specification. + :paramtype name: str + :keyword display_name: Display name of log specification. + :paramtype display_name: str + :keyword blob_duration: Blob duration of specification. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -680,29 +795,29 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of Metric specification. - :type display_name: str - :param display_description: Display description of Metric specification. - :type display_description: str - :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. - :type unit: str - :param aggregation_type: The metric aggregation type. Possible values include: 'Average', + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of Metric specification. + :vartype display_name: str + :ivar display_description: Display description of Metric specification. + :vartype display_description: str + :ivar unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :vartype unit: str + :ivar aggregation_type: The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'. - :type aggregation_type: str - :param supported_aggregation_types: The supported aggregation types for the metrics. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: The supported time grain types for the metrics. - :type supported_time_grain_types: list[str] - :param lock_aggregation_type: The metric lock aggregation type. - :type lock_aggregation_type: str - :param dimensions: The dimensions of metric. - :type dimensions: list[~azure.mgmt.keyvault.v2019_09_01.models.DimensionProperties] - :param fill_gap_with_zero: Property to specify whether to fill gap with zero. - :type fill_gap_with_zero: bool - :param internal_metric_name: The internal metric name. - :type internal_metric_name: str + :vartype aggregation_type: str + :ivar supported_aggregation_types: The supported aggregation types for the metrics. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: The supported time grain types for the metrics. + :vartype supported_time_grain_types: list[str] + :ivar lock_aggregation_type: The metric lock aggregation type. + :vartype lock_aggregation_type: str + :ivar dimensions: The dimensions of metric. + :vartype dimensions: list[~azure.mgmt.keyvault.v2019_09_01.models.DimensionProperties] + :ivar fill_gap_with_zero: Property to specify whether to fill gap with zero. + :vartype fill_gap_with_zero: bool + :ivar internal_metric_name: The internal metric name. + :vartype internal_metric_name: str """ _attribute_map = { @@ -735,6 +850,31 @@ def __init__( internal_metric_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of Metric specification. + :paramtype display_name: str + :keyword display_description: Display description of Metric specification. + :paramtype display_description: str + :keyword unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :paramtype unit: str + :keyword aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: The supported aggregation types for the metrics. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: The supported time grain types for the metrics. + :paramtype supported_time_grain_types: list[str] + :keyword lock_aggregation_type: The metric lock aggregation type. + :paramtype lock_aggregation_type: str + :keyword dimensions: The dimensions of metric. + :paramtype dimensions: list[~azure.mgmt.keyvault.v2019_09_01.models.DimensionProperties] + :keyword fill_gap_with_zero: Property to specify whether to fill gap with zero. + :paramtype fill_gap_with_zero: bool + :keyword internal_metric_name: The internal metric name. + :paramtype internal_metric_name: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -752,18 +892,19 @@ def __init__( 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 + :ivar 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] + :vartype bypass: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleBypassOptions + :ivar 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". + :vartype default_action: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleAction + :ivar ip_rules: The list of IP address rules. + :vartype ip_rules: list[~azure.mgmt.keyvault.v2019_09_01.models.IPRule] + :ivar virtual_network_rules: The list of virtual network rules. + :vartype virtual_network_rules: + list[~azure.mgmt.keyvault.v2019_09_01.models.VirtualNetworkRule] """ _attribute_map = { @@ -782,6 +923,21 @@ def __init__( virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype bypass: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleBypassOptions + :keyword 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". + :paramtype default_action: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleAction + :keyword ip_rules: The list of IP address rules. + :paramtype ip_rules: list[~azure.mgmt.keyvault.v2019_09_01.models.IPRule] + :keyword virtual_network_rules: The list of virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.keyvault.v2019_09_01.models.VirtualNetworkRule] + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.default_action = default_action @@ -792,16 +948,16 @@ def __init__( 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 is_data_action: Property to specify whether the action is a data action. - :type is_data_action: bool - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.keyvault.v2019_09_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar is_data_action: Property to specify whether the action is a data action. + :vartype is_data_action: bool + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification """ _attribute_map = { @@ -822,6 +978,18 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.keyvault.v2019_09_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword is_data_action: Property to specify whether the action is a data action. + :paramtype is_data_action: bool + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.keyvault.v2019_09_01.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -833,14 +1001,14 @@ def __init__( 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 + :ivar provider: Service provider: Microsoft Key Vault. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of operation. + :vartype description: str """ _attribute_map = { @@ -859,6 +1027,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Key Vault. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -869,10 +1047,10 @@ def __init__( 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 + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.keyvault.v2019_09_01.models.Operation] + :ivar next_link: The URL to get the next set of operations. + :vartype next_link: str """ _attribute_map = { @@ -887,6 +1065,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.keyvault.v2019_09_01.models.Operation] + :keyword next_link: The URL to get the next set of operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -895,14 +1079,15 @@ def __init__( 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] + :ivar keys: Permissions to keys. + :vartype keys: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.KeyPermissions] + :ivar secrets: Permissions to secrets. + :vartype secrets: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.SecretPermissions] + :ivar certificates: Permissions to certificates. + :vartype certificates: list[str or + ~azure.mgmt.keyvault.v2019_09_01.models.CertificatePermissions] + :ivar storage: Permissions to storage accounts. + :vartype storage: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.StoragePermissions] """ _attribute_map = { @@ -921,6 +1106,17 @@ def __init__( storage: Optional[List[Union[str, "StoragePermissions"]]] = None, **kwargs ): + """ + :keyword keys: Permissions to keys. + :paramtype keys: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.KeyPermissions] + :keyword secrets: Permissions to secrets. + :paramtype secrets: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.SecretPermissions] + :keyword certificates: Permissions to certificates. + :paramtype certificates: list[str or + ~azure.mgmt.keyvault.v2019_09_01.models.CertificatePermissions] + :keyword storage: Permissions to storage accounts. + :paramtype storage: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.StoragePermissions] + """ super(Permissions, self).__init__(**kwargs) self.keys = keys self.secrets = secrets @@ -949,6 +1145,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -968,12 +1166,12 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype 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". @@ -1010,6 +1208,15 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.etag = etag self.private_endpoint = private_endpoint @@ -1022,14 +1229,14 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Id of private endpoint connection. - :type id: str - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: + :ivar id: Id of private endpoint connection. + :vartype id: str + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype 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". @@ -1058,6 +1265,17 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword id: Id of private endpoint connection. + :paramtype id: str + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnectionItem, self).__init__(**kwargs) self.id = id self.etag = etag @@ -1085,8 +1303,8 @@ class PrivateLinkResource(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] + :ivar required_zone_names: Required DNS zone names of the the private link resource. + :vartype required_zone_names: list[str] """ _validation = { @@ -1116,6 +1334,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: Required DNS zone names of the the private link resource. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -1125,8 +1347,8 @@ def __init__( 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] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResource] """ _attribute_map = { @@ -1139,6 +1361,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -1146,15 +1372,15 @@ def __init__( 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 + :ivar 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 + :vartype status: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval or rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval or rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -1171,6 +1397,17 @@ def __init__( actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval or rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -1180,10 +1417,10 @@ def __init__( 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 + :ivar value: The list of vault resources. + :vartype value: list[~azure.mgmt.keyvault.v2019_09_01.models.Resource] + :ivar next_link: The URL to get the next set of vault resources. + :vartype next_link: str """ _attribute_map = { @@ -1198,6 +1435,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of vault resources. + :paramtype value: list[~azure.mgmt.keyvault.v2019_09_01.models.Resource] + :keyword next_link: The URL to get the next set of vault resources. + :paramtype next_link: str + """ super(ResourceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1206,10 +1449,11 @@ def __init__( 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] - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.MetricSpecification] + :ivar log_specifications: Log specifications of operation. + :vartype log_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.LogSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.keyvault.v2019_09_01.models.MetricSpecification] """ _attribute_map = { @@ -1224,6 +1468,13 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Log specifications of operation. + :paramtype log_specifications: list[~azure.mgmt.keyvault.v2019_09_01.models.LogSpecification] + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.keyvault.v2019_09_01.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -1234,11 +1485,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param family: Required. SKU family name. Possible values include: "A". - :type family: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuFamily - :param name: Required. SKU name to specify whether the key vault is a standard vault or a + :ivar family: Required. SKU family name. Possible values include: "A". + :vartype family: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuFamily + :ivar 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 + :vartype name: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuName """ _validation = { @@ -1258,6 +1509,13 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword family: Required. SKU family name. Possible values include: "A". + :paramtype family: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuFamily + :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: "standard", "premium". + :paramtype name: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.family = family self.name = name @@ -1276,12 +1534,12 @@ class Vault(msrest.serialization.Model): :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 + :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 properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultProperties """ _validation = { @@ -1308,6 +1566,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Azure location of the key vault resource. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to the key vault resource. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultProperties + """ super(Vault, self).__init__(**kwargs) self.id = None self.name = None @@ -1332,8 +1598,8 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): :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 + :ivar properties: Required. Properties of the access policy. + :vartype properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyProperties """ _validation = { @@ -1358,6 +1624,10 @@ def __init__( properties: "VaultAccessPolicyProperties", **kwargs ): + """ + :keyword properties: Required. Properties of the access policy. + :paramtype properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyProperties + """ super(VaultAccessPolicyParameters, self).__init__(**kwargs) self.id = None self.name = None @@ -1371,9 +1641,9 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): 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 + :ivar 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] + :vartype access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] """ _validation = { @@ -1390,6 +1660,11 @@ def __init__( access_policies: List["AccessPolicyEntry"], **kwargs ): + """ + :keyword 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. + :paramtype access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] + """ super(VaultAccessPolicyProperties, self).__init__(**kwargs) self.access_policies = access_policies @@ -1401,8 +1676,8 @@ class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The vault name. - :type name: str + :ivar name: Required. The vault name. + :vartype name: str :ivar type: The type of resource, Microsoft.KeyVault/vaults. Has constant value: "Microsoft.KeyVault/vaults". :vartype type: str @@ -1426,6 +1701,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -1435,12 +1714,12 @@ class VaultCreateOrUpdateParameters(msrest.serialization.Model): 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 + :ivar location: Required. The supported Azure location where the key vault should be created. + :vartype location: str + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultProperties """ _validation = { @@ -1462,6 +1741,15 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The supported Azure location where the key vault should be + created. + :paramtype location: str + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultProperties + """ super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) self.location = location self.tags = tags @@ -1471,10 +1759,10 @@ def __init__( 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 + :ivar value: The list of vaults. + :vartype value: list[~azure.mgmt.keyvault.v2019_09_01.models.Vault] + :ivar next_link: The URL to get the next set of vaults. + :vartype next_link: str """ _attribute_map = { @@ -1489,6 +1777,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2019_09_01.models.Vault] + :keyword next_link: The URL to get the next set of vaults. + :paramtype next_link: str + """ super(VaultListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1497,10 +1791,10 @@ def __init__( 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 + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultPatchProperties """ _attribute_map = { @@ -1515,6 +1809,12 @@ def __init__( properties: Optional["VaultPatchProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2019_09_01.models.VaultPatchProperties + """ super(VaultPatchParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -1523,47 +1823,47 @@ def __init__( class VaultPatchProperties(msrest.serialization.Model): """Properties of the vault. - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + :ivar 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 + :vartype tenant_id: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2019_09_01.models.Sku + :ivar 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 + :vartype access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] + :ivar 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 + :vartype enabled_for_deployment: bool + :ivar 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 + :vartype enabled_for_disk_encryption: bool + :ivar 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 + :vartype enabled_for_template_deployment: bool + :ivar 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 + :vartype enable_soft_delete: bool + :ivar 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. 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 + :vartype enable_rbac_authorization: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar 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 + :vartype create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode + :ivar 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 + :vartype enable_purge_protection: bool + :ivar 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 + :vartype network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet """ _attribute_map = { @@ -1598,6 +1898,50 @@ def __init__( network_acls: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. + :paramtype tenant_id: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2019_09_01.models.Sku + :keyword 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. + :paramtype access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword 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. + :paramtype enable_soft_delete: bool + :keyword 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. 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. + :paramtype enable_rbac_authorization: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode + :keyword 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. + :paramtype enable_purge_protection: bool + :keyword network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet + """ super(VaultPatchProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -1620,58 +1964,59 @@ class VaultProperties(msrest.serialization.Model): 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 + :ivar 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 1024 identities that have access to the key vault. All + :vartype tenant_id: str + :ivar sku: Required. SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2019_09_01.models.Sku + :ivar access_policies: An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. When ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. - :type access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. This + :vartype access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] + :ivar vault_uri: The URI of the vault for performing operations on keys and secrets. This property is readonly. - :type vault_uri: str + :vartype vault_uri: str :ivar hsm_pool_resource_id: The resource id of HSM Pool. :vartype hsm_pool_resource_id: str - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + :ivar 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 + :vartype enabled_for_deployment: bool + :ivar 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 + :vartype enabled_for_disk_encryption: bool + :ivar 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 + :vartype enabled_for_template_deployment: bool + :ivar 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 + :vartype enable_soft_delete: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar 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. 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 + :vartype enable_rbac_authorization: bool + :ivar 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 + :vartype create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode + :ivar 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 + :vartype enable_purge_protection: bool + :ivar network_acls: Rules governing the accessibility of the key vault from specific network locations. - :type network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet - :param provisioning_state: Provisioning state of the vault. Possible values include: + :vartype network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet + :ivar provisioning_state: Provisioning state of the vault. Possible values include: "Succeeded", "RegisteringDns". - :type provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.VaultProvisioningState + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2019_09_01.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: @@ -1723,6 +2068,60 @@ def __init__( provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, **kwargs ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword sku: Required. SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2019_09_01.models.Sku + :keyword access_policies: An array of 0 to 1024 identities that have access to the key vault. + All identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :paramtype access_policies: list[~azure.mgmt.keyvault.v2019_09_01.models.AccessPolicyEntry] + :keyword vault_uri: The URI of the vault for performing operations on keys and secrets. This + property is readonly. + :paramtype vault_uri: str + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword 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. + :paramtype enable_soft_delete: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword 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. 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. + :paramtype enable_rbac_authorization: bool + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode + :keyword 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. + :paramtype enable_purge_protection: bool + :keyword network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet + :keyword provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2019_09_01.models.VaultProvisioningState + """ super(VaultProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -1747,12 +2146,12 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. Full resource id of a vnet subnet, such as + :ivar id: Required. Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - :type id: str - :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + :vartype id: str + :ivar ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. - :type ignore_missing_vnet_service_endpoint: bool + :vartype ignore_missing_vnet_service_endpoint: bool """ _validation = { @@ -1771,6 +2170,14 @@ def __init__( ignore_missing_vnet_service_endpoint: Optional[bool] = None, **kwargs ): + """ + :keyword id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :paramtype id: str + :keyword ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + check if parent subnet has serviceEndpoints configured. + :paramtype ignore_missing_vnet_service_endpoint: bool + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.id = id self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py index 61c2db2715f0..91a4f39a39ad 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py @@ -5,23 +5,220 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_if_not_exist_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_version_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + key_version: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + "keyVersion": _SERIALIZER.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class KeysOperations(object): """KeysOperations operations. @@ -45,15 +242,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_if_not_exist( self, - resource_group_name, # type: str - vault_name, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Key" + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: "_models.KeyCreateParameters", + **kwargs: Any + ) -> "_models.Key": """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys. @@ -77,33 +274,23 @@ def create_if_not_exist( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_if_not_exist.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'KeyCreateParameters') + + request = build_create_if_not_exist_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + content_type=content_type, + json=_json, + template_url=self.create_if_not_exist.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'KeyCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,16 +304,18 @@ def create_if_not_exist( return cls(pipeline_response, deserialized, {}) return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Key" + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any + ) -> "_models.Key": """Gets the current version of the specified key from the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -146,28 +335,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,15 +360,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable["_models.KeyListResult"]: """Lists the keys in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -207,36 +388,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('KeyListResult', pipeline_response) + deserialized = self._deserialize("KeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -254,20 +432,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} # type: ignore + @distributed_trace def get_version( self, - resource_group_name, # type: str - vault_name, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Key" + resource_group_name: str, + vault_name: str, + key_name: str, + key_version: str, + **kwargs: Any + ) -> "_models.Key": """Gets the specified version of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -289,29 +468,19 @@ def get_version( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.get_version.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'keyVersion': self._serialize.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_version_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + key_version=key_version, + template_url=self.get_version.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -325,16 +494,18 @@ def get_version( return cls(pipeline_response, deserialized, {}) return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} # type: ignore + + @distributed_trace def list_versions( self, - resource_group_name, # type: str - vault_name, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any + ) -> Iterable["_models.KeyListResult"]: """Lists the versions of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -354,37 +525,35 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_versions.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('KeyListResult', pipeline_response) + deserialized = self._deserialize("KeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -402,6 +571,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py index 13cf909f52bd..d1a3c3c9c6c8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KeyVault/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult] + :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"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py index 8ccbf6b1cafe..3d10939601f3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py @@ -5,24 +5,147 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_put_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -46,14 +169,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -73,28 +196,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -110,17 +223,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -142,33 +257,23 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -179,49 +284,41 @@ def put( response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -229,29 +326,32 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} 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 + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -263,15 +363,19 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -286,25 +390,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -316,4 +412,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py index c0630a4d1a68..ba1a68a50688 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py @@ -5,22 +5,59 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_vault_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_vault( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -67,27 +104,17 @@ def list_by_vault( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.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') + + request = build_list_by_vault_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_vault.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +128,6 @@ def list_by_vault( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py index 837a738402c9..b2176b35134d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py @@ -5,25 +5,482 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_access_policy_request( + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "operationKind": _SERIALIZER.url("operation_kind", operation_kind, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_deleted_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_deleted_request( + vault_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}') + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_purge_deleted_request_initial( + vault_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge') + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2015-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2019-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VaultsOperations(object): """VaultsOperations operations. @@ -49,43 +506,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.Vault": cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +549,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - vault_name, # type: str - parameters, # type: "_models.VaultCreateOrUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Vault"] + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Vault"]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -123,15 +571,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2019_09_01.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Vault or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +594,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,16 +620,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - vault_name, # type: str - parameters, # type: "_models.VaultPatchParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultPatchParameters", + **kwargs: Any + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -203,32 +649,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VaultPatchParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -246,15 +682,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> None: """Deletes the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -271,27 +709,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -304,13 +732,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -327,27 +756,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,17 +780,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def update_access_policy( self, - resource_group_name, # type: str - vault_name, # type: str - operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] - parameters, # type: "_models.VaultAccessPolicyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultAccessPolicyParameters" + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", + **kwargs: Any + ) -> "_models.VaultAccessPolicyParameters": """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -392,33 +813,23 @@ def update_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -436,15 +847,17 @@ def update_access_policy( 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 + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultListResult"] + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -462,37 +875,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -510,17 +919,18 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. @@ -535,36 +945,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -582,21 +987,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + @distributed_trace def list_deleted( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedVaultListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult] + :return: An iterator like instance of either 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"] @@ -604,34 +1012,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -649,18 +1052,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + @distributed_trace def get_deleted( self, - vault_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedVault" + vault_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -677,27 +1081,17 @@ def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,41 +1105,32 @@ def get_deleted( 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 + vault_name: str, + location: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - accept = "application/json" - - # Construct URL - url = self._purge_deleted_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,13 +1143,14 @@ def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + @distributed_trace def begin_purge_deleted( self, - vault_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + vault_name: str, + location: str, + **kwargs: Any + ) -> LROPoller[None]: """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. :param vault_name: The name of the soft-deleted vault. @@ -773,15 +1159,17 @@ def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -795,21 +1183,14 @@ def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -821,21 +1202,23 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + @distributed_trace def list( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult] + :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"] @@ -843,38 +1226,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - api_version = "2015-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceListResult', pipeline_response) + deserialized = self._deserialize("ResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -892,17 +1268,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + @distributed_trace def check_name_availability( self, - vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + vault_name: "_models.VaultCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -917,30 +1294,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2019-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -954,4 +1321,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/__init__.py index 1283ff09177b..59fd240c9528 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['KeyVaultManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_configuration.py index f4c924a46664..f9327270c3a8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class KeyVaultManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -68,4 +65,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py index 50314d1a61e8..015a17059346 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py @@ -6,30 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import KeysOperations, ManagedHsmsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, SecretsOperations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import KeyVaultManagementClientConfiguration -from .operations import KeysOperations -from .operations import VaultsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import Operations -from .operations import SecretsOperations -from .operations import ManagedHsmsOperations -from . import models - -class KeyVaultManagementClient(object): +class KeyVaultManagementClient: """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. :ivar keys: KeysOperations operations @@ -37,9 +29,11 @@ class KeyVaultManagementClient(object): :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.keyvault.v2020_04_01_preview.operations.VaultsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.keyvault.v2020_04_01_preview.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.keyvault.v2020_04_01_preview.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.keyvault.v2020_04_01_preview.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.keyvault.v2020_04_01_preview.operations.PrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2020_04_01_preview.operations.Operations :ivar secrets: SecretsOperations operations @@ -48,62 +42,63 @@ class KeyVaultManagementClient(object): :vartype managed_hsms: azure.mgmt.keyvault.v2020_04_01_preview.operations.ManagedHsmsOperations :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) - self.keys = KeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.secrets = SecretsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json index ca969660e3b7..c39216492e36 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "KeyVaultManagementClient", "filename": "_key_vault_management_client", "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "keys": "KeysOperations", diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_vendor.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py index 726043aa858a..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.3.0" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/__init__.py index f54ed88d6ad2..8cff887e652d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._key_vault_management_client import KeyVaultManagementClient __all__ = ['KeyVaultManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_configuration.py index f4c6b89c942a..6c197f6eda16 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py index 4dea08f9daa3..7e63f6403854 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py @@ -6,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import KeysOperations, ManagedHsmsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, SecretsOperations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import KeyVaultManagementClientConfiguration -from .operations import KeysOperations -from .operations import VaultsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import Operations -from .operations import SecretsOperations -from .operations import ManagedHsmsOperations -from .. import models - - -class KeyVaultManagementClient(object): +class KeyVaultManagementClient: """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. :ivar keys: KeysOperations operations @@ -35,71 +29,77 @@ class KeyVaultManagementClient(object): :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.keyvault.v2020_04_01_preview.aio.operations.VaultsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.keyvault.v2020_04_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.keyvault.v2020_04_01_preview.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.keyvault.v2020_04_01_preview.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.keyvault.v2020_04_01_preview.aio.operations.PrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2020_04_01_preview.aio.operations.Operations :ivar secrets: SecretsOperations operations :vartype secrets: azure.mgmt.keyvault.v2020_04_01_preview.aio.operations.SecretsOperations :ivar managed_hsms: ManagedHsmsOperations operations - :vartype managed_hsms: azure.mgmt.keyvault.v2020_04_01_preview.aio.operations.ManagedHsmsOperations + :vartype managed_hsms: + azure.mgmt.keyvault.v2020_04_01_preview.aio.operations.ManagedHsmsOperations :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.keys = KeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.secrets = SecretsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_keys_operations.py index e4bdfff25116..b51665d1ab35 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_keys_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._keys_operations import build_create_if_not_exist_request, build_get_request, build_get_version_request, build_list_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_if_not_exist( self, resource_group_name: str, @@ -72,33 +78,23 @@ async def create_if_not_exist( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_if_not_exist.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'KeyCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_if_not_exist_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + content_type=content_type, + json=_json, + template_url=self.create_if_not_exist.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'KeyCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -112,8 +108,11 @@ async def create_if_not_exist( return cls(pipeline_response, deserialized, {}) return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -140,28 +139,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -192,7 +184,8 @@ def list( :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either KeyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] @@ -200,36 +193,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('KeyListResult', pipeline_response) + deserialized = self._deserialize("KeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -247,11 +237,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} # type: ignore + @distributed_trace_async async def get_version( self, resource_group_name: str, @@ -281,29 +273,19 @@ async def get_version( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_version.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'keyVersion': self._serialize.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_version_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + key_version=key_version, + template_url=self.get_version.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -317,8 +299,11 @@ async def get_version( return cls(pipeline_response, deserialized, {}) return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} # type: ignore + + @distributed_trace def list_versions( self, resource_group_name: str, @@ -337,7 +322,8 @@ def list_versions( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either KeyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] @@ -345,37 +331,35 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_versions.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('KeyListResult', pipeline_response) + deserialized = self._deserialize("KeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -393,6 +377,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py index 196e78fd77e9..152a1b385c1c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._managed_hsms_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,39 +60,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ManagedHsm') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedHsm') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) @@ -99,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -118,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -170,6 +166,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore async def _update_initial( @@ -184,39 +181,28 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ManagedHsm') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedHsm') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -247,15 +236,20 @@ async def begin_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -299,6 +287,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore async def _delete_initial( @@ -312,40 +301,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -360,15 +340,17 @@ async def begin_delete( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -382,21 +364,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -408,8 +383,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -432,33 +409,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -469,8 +436,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -485,8 +455,10 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] @@ -494,37 +466,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -537,17 +505,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + @distributed_trace def list_by_subscription( self, top: Optional[int] = None, @@ -559,8 +529,10 @@ def list_by_subscription( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] @@ -568,36 +540,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -610,12 +577,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py index b1491efc50bc..a95c403f6aa3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py index dfa7d8fd6ea1..19f7323dff90 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -5,18 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -68,28 +73,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -105,8 +100,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -136,33 +134,23 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -173,14 +161,17 @@ async def put( 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, @@ -193,28 +184,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -222,21 +203,25 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} 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 + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -255,15 +240,19 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -278,25 +267,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -308,4 +289,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py index f8781cca2d45..a0dc96b8f6f2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_list_by_vault_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_vault( self, resource_group_name: str, @@ -62,27 +67,17 @@ async def list_by_vault( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_vault.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_vault_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_vault.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -96,4 +91,6 @@ async def list_by_vault( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_secrets_operations.py index dd747132d9e6..c4ec1fca0939 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_secrets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._secrets_operations import build_create_or_update_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -60,7 +66,8 @@ async def create_or_update( :param secret_name: Name of the secret. :type secret_name: str :param parameters: Parameters to create or update the secret. - :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretCreateOrUpdateParameters + :type parameters: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: Secret, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Secret @@ -71,33 +78,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,8 +112,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -147,33 +147,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SecretPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SecretPatchParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,8 +181,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -219,28 +212,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -254,8 +237,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -275,7 +261,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SecretListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] @@ -283,38 +270,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SecretListResult', pipeline_response) + deserialized = self._deserialize("SecretListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -332,6 +316,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py index c57201e23b07..f4182ee471e7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._vaults_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request, build_get_deleted_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_deleted_request, build_list_request, build_purge_deleted_request_initial, build_update_access_policy_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +139,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,8 +165,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -196,32 +194,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,8 +227,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -263,27 +254,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -296,6 +277,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -318,27 +301,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -352,8 +325,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def update_access_policy( self, resource_group_name: str, @@ -369,7 +345,8 @@ async def update_access_policy( :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.v2020_04_01_preview.models.AccessPolicyUpdateKind + :type operation_kind: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyUpdateKind :param parameters: Access policy to merge into the vault. :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -382,33 +359,23 @@ async def update_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -426,8 +393,11 @@ async def update_access_policy( 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 + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -443,7 +413,8 @@ def list_by_resource_group( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] @@ -451,37 +422,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,11 +466,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, top: Optional[int] = None, @@ -515,7 +484,8 @@ def list_by_subscription( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] @@ -523,36 +493,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -570,11 +535,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + @distributed_trace def list_deleted( self, **kwargs: Any @@ -582,8 +549,10 @@ def list_deleted( """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultListResult] + :return: An iterator like instance of either DeletedVaultListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] @@ -591,34 +560,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -636,11 +600,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + @distributed_trace_async async def get_deleted( self, vault_name: str, @@ -663,27 +629,17 @@ async def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -697,8 +653,10 @@ async def get_deleted( 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, @@ -710,27 +668,17 @@ async def _purge_deleted_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._purge_deleted_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -743,6 +691,8 @@ async def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + @distributed_trace_async async def begin_purge_deleted( self, vault_name: str, @@ -757,15 +707,17 @@ async def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -779,21 +731,14 @@ async def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -805,8 +750,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + @distributed_trace def list( self, top: Optional[int] = None, @@ -818,7 +765,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourceListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] @@ -826,38 +774,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - api_version = "2015-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceListResult', pipeline_response) + deserialized = self._deserialize("ResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -875,11 +816,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + @distributed_trace_async async def check_name_availability( self, vault_name: "_models.VaultCheckNameAvailabilityParameters", @@ -888,7 +831,8 @@ async def check_name_availability( """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. - :type vault_name: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultCheckNameAvailabilityParameters + :type vault_name: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.CheckNameAvailabilityResult @@ -899,30 +843,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -936,4 +870,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py index 366550eeea67..6d63ffe92248 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py @@ -6,120 +6,63 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessPolicyEntry - from ._models_py3 import Attributes - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudErrorBody - from ._models_py3 import DeletedVault - from ._models_py3 import DeletedVaultListResult - from ._models_py3 import DeletedVaultProperties - from ._models_py3 import DimensionProperties - from ._models_py3 import Error - from ._models_py3 import IPRule - from ._models_py3 import Key - from ._models_py3 import KeyAttributes - from ._models_py3 import KeyCreateParameters - from ._models_py3 import KeyListResult - from ._models_py3 import KeyProperties - from ._models_py3 import LogSpecification - from ._models_py3 import ManagedHsm - from ._models_py3 import ManagedHsmError - from ._models_py3 import ManagedHsmListResult - from ._models_py3 import ManagedHsmProperties - from ._models_py3 import ManagedHsmResource - from ._models_py3 import ManagedHsmSku - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkRuleSet - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Permissions - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionItem - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import Resource - from ._models_py3 import ResourceListResult - from ._models_py3 import Secret - from ._models_py3 import SecretAttributes - from ._models_py3 import SecretCreateOrUpdateParameters - from ._models_py3 import SecretListResult - from ._models_py3 import SecretPatchParameters - from ._models_py3 import SecretPatchProperties - from ._models_py3 import SecretProperties - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import SystemData - from ._models_py3 import Vault - from ._models_py3 import VaultAccessPolicyParameters - from ._models_py3 import VaultAccessPolicyProperties - from ._models_py3 import VaultCheckNameAvailabilityParameters - from ._models_py3 import VaultCreateOrUpdateParameters - from ._models_py3 import VaultListResult - from ._models_py3 import VaultPatchParameters - from ._models_py3 import VaultPatchProperties - from ._models_py3 import VaultProperties - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccessPolicyEntry # type: ignore - from ._models import Attributes # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import DeletedVault # type: ignore - from ._models import DeletedVaultListResult # type: ignore - from ._models import DeletedVaultProperties # type: ignore - from ._models import DimensionProperties # type: ignore - from ._models import Error # type: ignore - from ._models import IPRule # type: ignore - from ._models import Key # type: ignore - from ._models import KeyAttributes # type: ignore - from ._models import KeyCreateParameters # type: ignore - from ._models import KeyListResult # type: ignore - from ._models import KeyProperties # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import ManagedHsm # type: ignore - from ._models import ManagedHsmError # type: ignore - from ._models import ManagedHsmListResult # type: ignore - from ._models import ManagedHsmProperties # type: ignore - from ._models import ManagedHsmResource # type: ignore - from ._models import ManagedHsmSku # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Permissions # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionItem # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceListResult # type: ignore - from ._models import Secret # type: ignore - from ._models import SecretAttributes # type: ignore - from ._models import SecretCreateOrUpdateParameters # type: ignore - from ._models import SecretListResult # type: ignore - from ._models import SecretPatchParameters # type: ignore - from ._models import SecretPatchProperties # type: ignore - from ._models import SecretProperties # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SystemData # type: ignore - from ._models import Vault # type: ignore - from ._models import VaultAccessPolicyParameters # type: ignore - from ._models import VaultAccessPolicyProperties # type: ignore - from ._models import VaultCheckNameAvailabilityParameters # type: ignore - from ._models import VaultCreateOrUpdateParameters # type: ignore - from ._models import VaultListResult # type: ignore - from ._models import VaultPatchParameters # type: ignore - from ._models import VaultPatchProperties # type: ignore - from ._models import VaultProperties # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccessPolicyEntry +from ._models_py3 import Attributes +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import DeletedVault +from ._models_py3 import DeletedVaultListResult +from ._models_py3 import DeletedVaultProperties +from ._models_py3 import DimensionProperties +from ._models_py3 import Error +from ._models_py3 import IPRule +from ._models_py3 import Key +from ._models_py3 import KeyAttributes +from ._models_py3 import KeyCreateParameters +from ._models_py3 import KeyListResult +from ._models_py3 import KeyProperties +from ._models_py3 import LogSpecification +from ._models_py3 import ManagedHsm +from ._models_py3 import ManagedHsmError +from ._models_py3 import ManagedHsmListResult +from ._models_py3 import ManagedHsmProperties +from ._models_py3 import ManagedHsmResource +from ._models_py3 import ManagedHsmSku +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Permissions +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionItem +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import ResourceListResult +from ._models_py3 import Secret +from ._models_py3 import SecretAttributes +from ._models_py3 import SecretCreateOrUpdateParameters +from ._models_py3 import SecretListResult +from ._models_py3 import SecretPatchParameters +from ._models_py3 import SecretPatchProperties +from ._models_py3 import SecretProperties +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SystemData +from ._models_py3 import Vault +from ._models_py3 import VaultAccessPolicyParameters +from ._models_py3 import VaultAccessPolicyProperties +from ._models_py3 import VaultCheckNameAvailabilityParameters +from ._models_py3 import VaultCreateOrUpdateParameters +from ._models_py3 import VaultListResult +from ._models_py3 import VaultPatchParameters +from ._models_py3 import VaultPatchProperties +from ._models_py3 import VaultProperties +from ._models_py3 import VirtualNetworkRule + from ._key_vault_management_client_enums import ( AccessPolicyUpdateKind, diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py index 03c4ca86b669..23be3c2ce791 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py @@ -6,39 +6,24 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessPolicyUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class ActionsRequired(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """A message indicating if changes on the service provider require any updates on the consumer. """ NONE = "None" -class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "get" LIST = "list" @@ -57,14 +42,14 @@ class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) BACKUP = "backup" RESTORE = "restore" -class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval. @@ -75,7 +60,7 @@ class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) RECOVERABLE = "Recoverable" RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity. """ @@ -84,7 +69,7 @@ class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class JsonWebKeyCurveName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The elliptic curve name. For valid values, see JsonWebKeyCurveName. """ @@ -93,7 +78,7 @@ class JsonWebKeyCurveName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): P521 = "P-521" P256_K = "P-256K" -class JsonWebKeyOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The permitted JSON web key operations of the key. For more information, see JsonWebKeyOperation. """ @@ -106,7 +91,7 @@ class JsonWebKeyOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UNWRAP_KEY = "unwrapKey" IMPORT_ENUM = "import" -class JsonWebKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the key. For valid values, see JsonWebKeyType. """ @@ -115,7 +100,7 @@ class JsonWebKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RSA = "RSA" RSA_HSM = "RSA-HSM" -class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -134,20 +119,20 @@ class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class ManagedHsmSkuFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU Family of the managed HSM Pool """ B = "B" -class ManagedHsmSkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU of the managed HSM Pool """ STANDARD_B1 = "Standard_B1" CUSTOM_B32 = "Custom_B32" -class NetworkRuleAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. """ @@ -155,7 +140,7 @@ class NetworkRuleAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" -class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. """ @@ -163,7 +148,7 @@ class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu AZURE_SERVICES = "AzureServices" NONE = "None" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -174,7 +159,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive FAILED = "Failed" DISCONNECTED = "Disconnected" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -183,7 +168,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state. """ @@ -204,7 +189,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The managed HSM pool is being restored from full HSM backup. RESTORING = "Restoring" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -212,7 +197,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "get" LIST = "list" @@ -223,20 +208,20 @@ class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU family name """ A = "A" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "get" LIST = "list" @@ -253,7 +238,7 @@ class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GETSAS = "getsas" DELETESAS = "deletesas" -class VaultProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VaultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the vault. """ diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py deleted file mode 100644 index f6eaade6688d..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py +++ /dev/null @@ -1,2164 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AccessPolicyEntry(msrest.serialization.Model): - """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. - - All required parameters must be populated in order to send to Azure. - - :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for - authenticating requests to the key vault. - :type tenant_id: str - :param object_id: Required. The object ID of a user, service principal or security group in the - Azure Active Directory tenant for the vault. The object ID must be unique for the list of - access policies. - :type object_id: str - :param application_id: Application ID of the client making request on behalf of a principal. - :type application_id: str - :param permissions: Required. Permissions the identity has for keys, secrets and certificates. - :type permissions: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Permissions - """ - - _validation = { - 'tenant_id': {'required': True}, - 'object_id': {'required': True}, - 'permissions': {'required': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, - 'application_id': {'key': 'applicationId', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'Permissions'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessPolicyEntry, self).__init__(**kwargs) - self.tenant_id = kwargs['tenant_id'] - self.object_id = kwargs['object_id'] - self.application_id = kwargs.get('application_id', None) - self.permissions = kwargs['permissions'] - - -class Attributes(msrest.serialization.Model): - """The object attributes managed by the KeyVault service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: Determines whether the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: ~datetime.datetime - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: ~datetime.datetime - :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. - :vartype created: ~datetime.datetime - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: ~datetime.datetime - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - } - - def __init__( - self, - **kwargs - ): - super(Attributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.not_before = kwargs.get('not_before', None) - self.expires = kwargs.get('expires', None) - self.created = None - self.updated = None - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: A boolean value that indicates whether the name is available for you to - use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.Reason - :ivar message: An error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from Key Vault resource provider. - - :param code: Error code. This is a mnemonic that can be consumed programmatically. - :type code: str - :param message: User friendly error message. The message is typically localized and may vary - with service version. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class 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.v2020_04_01_preview.models.DeletedVaultProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedVault, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = kwargs.get('properties', None) - - -class DeletedVaultListResult(msrest.serialization.Model): - """List of vaults. - - :param value: The list of deleted vaults. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault] - :param next_link: The URL to get the next set of deleted vaults. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedVault]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedVaultListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class DeletedVaultProperties(msrest.serialization.Model): - """Properties of the deleted vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vault_id: The resource id of the original vault. - :vartype vault_id: str - :ivar location: The location of the original vault. - :vartype location: str - :ivar deletion_date: The deleted date. - :vartype deletion_date: ~datetime.datetime - :ivar scheduled_purge_date: The scheduled purged date. - :vartype scheduled_purge_date: ~datetime.datetime - :ivar tags: A set of tags. Tags of the original vault. - :vartype tags: dict[str, str] - :ivar purge_protection_enabled: Purge protection status of the original vault. - :vartype purge_protection_enabled: bool - """ - - _validation = { - 'vault_id': {'readonly': True}, - 'location': {'readonly': True}, - 'deletion_date': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'tags': {'readonly': True}, - 'purge_protection_enabled': {'readonly': True}, - } - - _attribute_map = { - 'vault_id': {'key': 'vaultId', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedVaultProperties, self).__init__(**kwargs) - self.vault_id = None - self.location = None - self.deletion_date = None - self.scheduled_purge_date = None - self.tags = None - self.purge_protection_enabled = None - - -class DimensionProperties(msrest.serialization.Model): - """Type of operation: get, read, delete, etc. - - :param name: Name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported - for shoebox. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DimensionProperties, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class Error(msrest.serialization.Model): - """The server error. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar inner_error: The inner error, contains a more specific error code. - :vartype inner_error: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Error - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'inner_error': {'key': 'innererror', 'type': 'Error'}, - } - - def __init__( - self, - **kwargs - ): - super(Error, self).__init__(**kwargs) - self.code = None - self.message = None - self.inner_error = None - - -class IPRule(msrest.serialization.Model): - """A rule governing the accessibility of a vault from a specific ip address or ip range. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple - IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). - :type value: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.value = kwargs['value'] - - -class Resource(msrest.serialization.Model): - """Key Vault resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None - - -class Key(Resource): - """The key resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :param attributes: The attributes of the key. - :type attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyAttributes - :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". - :type kty: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyOperation] - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :type key_size: int - :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". - :type curve_name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyCurveName - :ivar key_uri: The URI to retrieve the current version of the key. - :vartype key_uri: str - :ivar key_uri_with_version: The URI to retrieve the specific version of the key. - :vartype key_uri_with_version: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - 'key_uri': {'readonly': True}, - 'key_uri_with_version': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'attributes': {'key': 'properties.attributes', 'type': 'KeyAttributes'}, - 'kty': {'key': 'properties.kty', 'type': 'str'}, - 'key_ops': {'key': 'properties.keyOps', 'type': '[str]'}, - 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'curve_name': {'key': 'properties.curveName', 'type': 'str'}, - 'key_uri': {'key': 'properties.keyUri', 'type': 'str'}, - 'key_uri_with_version': {'key': 'properties.keyUriWithVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Key, self).__init__(**kwargs) - self.attributes = kwargs.get('attributes', None) - self.kty = kwargs.get('kty', None) - self.key_ops = kwargs.get('key_ops', None) - self.key_size = kwargs.get('key_size', None) - self.curve_name = kwargs.get('curve_name', None) - self.key_uri = None - self.key_uri_with_version = None - - -class KeyAttributes(msrest.serialization.Model): - """The attributes of the key. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: Determines whether or not the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: long - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: long - :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. - :vartype created: long - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: long - :ivar recovery_level: The deletion recovery level currently in effect for the object. If it - contains 'Purgeable', then the object can be permanently deleted by a privileged user; - otherwise, only the system can purge the object at the end of the retention interval. Possible - values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", - "Recoverable+ProtectedSubscription". - :vartype recovery_level: str or - ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletionRecoveryLevel - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'long'}, - 'expires': {'key': 'exp', 'type': 'long'}, - 'created': {'key': 'created', 'type': 'long'}, - 'updated': {'key': 'updated', 'type': 'long'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.not_before = kwargs.get('not_before', None) - self.expires = kwargs.get('expires', None) - self.created = None - self.updated = None - self.recovery_level = None - - -class KeyCreateParameters(msrest.serialization.Model): - """The parameters used to create a key. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. The tags that will be assigned to the key. - :type tags: dict[str, str] - :param properties: Required. The properties of the key to be created. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'KeyProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyCreateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.properties = kwargs['properties'] - - -class KeyListResult(msrest.serialization.Model): - """The page of keys. - - :param value: The key resources. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Key] - :param next_link: The URL to get the next page of keys. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Key]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class KeyProperties(msrest.serialization.Model): - """The properties of the key. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param attributes: The attributes of the key. - :type attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyAttributes - :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". - :type kty: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyOperation] - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :type key_size: int - :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". - :type curve_name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyCurveName - :ivar key_uri: The URI to retrieve the current version of the key. - :vartype key_uri: str - :ivar key_uri_with_version: The URI to retrieve the specific version of the key. - :vartype key_uri_with_version: str - """ - - _validation = { - 'key_uri': {'readonly': True}, - 'key_uri_with_version': {'readonly': True}, - } - - _attribute_map = { - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'kty': {'key': 'kty', 'type': 'str'}, - 'key_ops': {'key': 'keyOps', 'type': '[str]'}, - 'key_size': {'key': 'keySize', 'type': 'int'}, - 'curve_name': {'key': 'curveName', 'type': 'str'}, - 'key_uri': {'key': 'keyUri', 'type': 'str'}, - 'key_uri_with_version': {'key': 'keyUriWithVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyProperties, self).__init__(**kwargs) - self.attributes = kwargs.get('attributes', None) - self.kty = kwargs.get('kty', None) - self.key_ops = kwargs.get('key_ops', None) - self.key_size = kwargs.get('key_size', None) - self.curve_name = kwargs.get('curve_name', None) - self.key_uri = None - self.key_uri_with_version = None - - -class LogSpecification(msrest.serialization.Model): - """Log specification of operation. - - :param name: Name of log specification. - :type name: str - :param display_name: Display name of log specification. - :type display_name: str - :param blob_duration: Blob duration of specification. - :type blob_duration: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class ManagedHsmResource(msrest.serialization.Model): - """Managed HSM resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. - :vartype id: str - :ivar name: The name of the managed HSM Pool. - :vartype name: str - :ivar type: The resource type of the managed HSM Pool. - :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - """ - - _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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - - -class ManagedHsm(ManagedHsmResource): - """Resource information with extended details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. - :vartype id: str - :ivar name: The name of the managed HSM Pool. - :vartype name: str - :ivar type: The resource type of the managed HSM Pool. - :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param properties: Properties of the managed HSM. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmProperties - """ - - _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'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'ManagedHsmProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsm, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ManagedHsmError(msrest.serialization.Model): - """The error exception. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: The server error. - :vartype error: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Error - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmError, self).__init__(**kwargs) - self.error = None - - -class ManagedHsmListResult(msrest.serialization.Model): - """List of managed HSM Pools. - - :param value: The list of managed HSM Pools. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] - :param next_link: The URL to get the next set of managed HSM Pools. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedHsm]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ManagedHsmProperties(msrest.serialization.Model): - """Properties of the managed HSM Pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating - requests to the managed HSM pool. - :type tenant_id: str - :param initial_admin_object_ids: Array of initial administrators object ids for this managed - hsm pool. - :type initial_admin_object_ids: list[str] - :ivar hsm_uri: The URI of the managed hsm pool for performing operations on keys. - :vartype hsm_uri: str - :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is - enabled for this managed HSM pool. If it's not set to any value(true or false) when creating - new managed HSM pool, it will be set to true by default. Once set to true, it cannot be - reverted to false. - :type enable_soft_delete: bool - :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. - :type soft_delete_retention_in_days: int - :param enable_purge_protection: Property specifying whether protection against purge is enabled - for this managed HSM pool. Setting this property to true activates protection against purge for - this managed HSM pool and its content - only the Managed HSM service may initiate a hard, - irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling - this functionality is irreversible. - :type enable_purge_protection: bool - :param create_mode: The create mode to indicate whether the resource is being created or is - being recovered from a deleted resource. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode - :ivar status_message: Resource Status Message. - :vartype status_message: str - :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", - "Provisioning", "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", - "Restoring". - :vartype provisioning_state: str or - ~azure.mgmt.keyvault.v2020_04_01_preview.models.ProvisioningState - """ - - _validation = { - 'hsm_uri': {'readonly': True}, - 'status_message': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'initial_admin_object_ids': {'key': 'initialAdminObjectIds', 'type': '[str]'}, - 'hsm_uri': {'key': 'hsmUri', 'type': 'str'}, - 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, - 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'status_message': {'key': 'statusMessage', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmProperties, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.initial_admin_object_ids = kwargs.get('initial_admin_object_ids', None) - self.hsm_uri = None - self.enable_soft_delete = kwargs.get('enable_soft_delete', True) - self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', 90) - self.enable_purge_protection = kwargs.get('enable_purge_protection', True) - self.create_mode = kwargs.get('create_mode', None) - self.status_message = None - self.provisioning_state = None - - -class ManagedHsmSku(msrest.serialization.Model): - """SKU details. - - All required parameters must be populated in order to send to Azure. - - :param family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". - :type family: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuFamily - :param name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", - "Custom_B32". - :type name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuName - """ - - _validation = { - 'family': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmSku, self).__init__(**kwargs) - self.family = kwargs.get('family', "B") - self.name = kwargs['name'] - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of Metric specification. - :type display_name: str - :param display_description: Display description of Metric specification. - :type display_description: str - :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. - :type unit: str - :param aggregation_type: The metric aggregation type. Possible values include: 'Average', - 'Count', 'Total'. - :type aggregation_type: str - :param supported_aggregation_types: The supported aggregation types for the metrics. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: The supported time grain types for the metrics. - :type supported_time_grain_types: list[str] - :param lock_aggregation_type: The metric lock aggregation type. - :type lock_aggregation_type: str - :param dimensions: The dimensions of metric. - :type dimensions: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.DimensionProperties] - :param fill_gap_with_zero: Property to specify whether to fill gap with zero. - :type fill_gap_with_zero: bool - :param internal_metric_name: The internal metric name. - :type internal_metric_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.lock_aggregation_type = kwargs.get('lock_aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.internal_metric_name = kwargs.get('internal_metric_name', None) - - -class NetworkRuleSet(msrest.serialization.Model): - """A set of rules governing the network accessibility of a vault. - - :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.v2020_04_01_preview.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and from - virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleAction - :param ip_rules: The list of IP address rules. - :type ip_rules: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.IPRule] - :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.keyvault.v2020_04_01_preview.models.VirtualNetworkRule] - """ - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', None) - self.default_action = kwargs.get('default_action', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - - -class Operation(msrest.serialization.Model): - """Key Vault REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param is_data_action: Property to specify whether the action is a data action. - :type is_data_action: bool - :param service_specification: One property of operation, include metric specifications. - :type service_specification: - ~azure.mgmt.keyvault.v2020_04_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Key Vault. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Operation] - :param next_link: The URL to get the next set of operations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class Permissions(msrest.serialization.Model): - """Permissions the identity has for keys, secrets, certificates and storage. - - :param keys: Permissions to keys. - :type keys: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyPermissions] - :param secrets: Permissions to secrets. - :type secrets: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretPermissions] - :param certificates: Permissions to certificates. - :type certificates: list[str or - ~azure.mgmt.keyvault.v2020_04_01_preview.models.CertificatePermissions] - :param storage: Permissions to storage accounts. - :type storage: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.StoragePermissions] - """ - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[str]'}, - 'secrets': {'key': 'secrets', 'type': '[str]'}, - 'certificates': {'key': 'certificates', 'type': '[str]'}, - 'storage': {'key': 'storage', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Permissions, self).__init__(**kwargs) - self.keys = kwargs.get('keys', None) - self.secrets = kwargs.get('secrets', None) - self.certificates = kwargs.get('certificates', None) - self.storage = kwargs.get('storage', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """Private endpoint object properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Full identifier of the private endpoint resource. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(Resource): - """Private endpoint connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: - ~azure.mgmt.keyvault.v2020_04_01_preview.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.v2020_04_01_preview.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}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = 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 id: Id of private endpoint connection. - :type id: str - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: - ~azure.mgmt.keyvault.v2020_04_01_preview.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.v2020_04_01_preview.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.etag = kwargs.get('etag', None) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = 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.v2020_04_01_preview.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """An object that represents the approval state of the private link connection. - - :param status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or - ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval or rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". - :type actions_required: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ActionsRequired - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class ResourceListResult(msrest.serialization.Model): - """List of vault resources. - - :param value: The list of vault resources. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Resource] - :param next_link: The URL to get the next set of vault resources. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Resource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class Secret(Resource): - """Resource information with extended details. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :param properties: Required. Properties of the secret. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'SecretProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Secret, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class SecretAttributes(Attributes): - """The secret management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: Determines whether the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: ~datetime.datetime - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: ~datetime.datetime - :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. - :vartype created: ~datetime.datetime - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: ~datetime.datetime - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretAttributes, self).__init__(**kwargs) - - -class SecretCreateOrUpdateParameters(msrest.serialization.Model): - """Parameters for creating or updating a secret. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. The tags that will be assigned to the secret. - :type tags: dict[str, str] - :param properties: Required. Properties of the secret. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'SecretProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretCreateOrUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.properties = kwargs['properties'] - - -class SecretListResult(msrest.serialization.Model): - """List of secrets. - - :param value: The list of secrets. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Secret] - :param next_link: The URL to get the next set of secrets. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Secret]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class SecretPatchParameters(msrest.serialization.Model): - """Parameters for patching a secret. - - :param tags: A set of tags. The tags that will be assigned to the secret. - :type tags: dict[str, str] - :param properties: Properties of the secret. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretPatchProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'SecretPatchProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretPatchParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) - - -class SecretPatchProperties(msrest.serialization.Model): - """Properties of the secret. - - :param value: The value of the secret. - :type value: str - :param content_type: The content type of the secret. - :type content_type: str - :param attributes: The attributes of the secret. - :type attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretAttributes - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretPatchProperties, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.content_type = kwargs.get('content_type', None) - self.attributes = kwargs.get('attributes', None) - - -class SecretProperties(msrest.serialization.Model): - """Properties of the secret. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: The value of the secret. NOTE: 'value' will never be returned from the service, - as APIs using this model are is intended for internal use in ARM deployments. Users should use - the data-plane REST service for interaction with vault secrets. - :type value: str - :param content_type: The content type of the secret. - :type content_type: str - :param attributes: The attributes of the secret. - :type attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretAttributes - :ivar secret_uri: The URI to retrieve the current version of the secret. - :vartype secret_uri: str - :ivar secret_uri_with_version: The URI to retrieve the specific version of the secret. - :vartype secret_uri_with_version: str - """ - - _validation = { - 'secret_uri': {'readonly': True}, - 'secret_uri_with_version': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'secret_uri': {'key': 'secretUri', 'type': 'str'}, - 'secret_uri_with_version': {'key': 'secretUriWithVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretProperties, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.content_type = kwargs.get('content_type', None) - self.attributes = kwargs.get('attributes', None) - self.secret_uri = None - self.secret_uri_with_version = None - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include log specifications. - - :param log_specifications: Log specifications of operation. - :type log_specifications: - list[~azure.mgmt.keyvault.v2020_04_01_preview.models.LogSpecification] - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: - list[~azure.mgmt.keyvault.v2020_04_01_preview.models.MetricSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """SKU details. - - All required parameters must be populated in order to send to Azure. - - :param family: Required. SKU family name. Possible values include: "A". - :type family: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuFamily - :param name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". - :type name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuName - """ - - _validation = { - 'family': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.family = kwargs.get('family', "A") - self.name = kwargs['name'] - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of key vault resource. - - :param created_by: The identity that created key vault resource. - :type created_by: str - :param created_by_type: The type of identity that created key vault resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.IdentityType - :param created_at: The timestamp of key vault resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified key vault resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified key vault resource. - Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.keyvault.v2020_04_01_preview.models.IdentityType - :param last_modified_at: The timestamp of key vault resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Vault(msrest.serialization.Model): - """Resource information with extended details. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :param location: Azure location of the key vault resource. - :type location: str - :param tags: A set of tags. Tags assigned to the key vault resource. - :type tags: dict[str, str] - :ivar system_data: System metadata for the key vault. - :vartype system_data: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SystemData - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'VaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Vault, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.system_data = None - self.properties = kwargs['properties'] - - -class VaultAccessPolicyParameters(msrest.serialization.Model): - """Parameters for updating the access policy in a vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource id of the access policy. - :vartype id: str - :ivar name: The resource name of the access policy. - :vartype name: str - :ivar type: The resource name of the access policy. - :vartype type: str - :ivar location: The resource type of the access policy. - :vartype location: str - :param properties: Required. Properties of the access policy. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultAccessPolicyParameters, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.properties = kwargs['properties'] - - -class VaultAccessPolicyProperties(msrest.serialization.Model): - """Properties of the vault access policy. - - All required parameters must be populated in order to send to Azure. - - :param access_policies: Required. An array of 0 to 16 identities that have access to the key - vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. - :type access_policies: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] - """ - - _validation = { - 'access_policies': {'required': True}, - } - - _attribute_map = { - 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultAccessPolicyProperties, self).__init__(**kwargs) - self.access_policies = kwargs['access_policies'] - - -class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the vault name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The vault name. - :type name: str - :ivar type: The type of resource, Microsoft.KeyVault/vaults. Has constant value: - "Microsoft.KeyVault/vaults". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.KeyVault/vaults" - - def __init__( - self, - **kwargs - ): - super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class VaultCreateOrUpdateParameters(msrest.serialization.Model): - """Parameters for creating or updating a vault. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. The supported Azure location where the key vault should be created. - :type location: str - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProperties - """ - - _validation = { - 'location': {'required': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'VaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.properties = kwargs['properties'] - - -class VaultListResult(msrest.serialization.Model): - """List of vaults. - - :param value: The list of vaults. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault] - :param next_link: The URL to get the next set of vaults. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Vault]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class VaultPatchParameters(msrest.serialization.Model): - """Parameters for creating or updating a vault. - - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultPatchProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultPatchParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) - - -class VaultPatchProperties(msrest.serialization.Model): - """Properties of the vault. - - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating - requests to the key vault. - :type tenant_id: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to the key vault. All - identities in the array must use the same tenant ID as the key vault's tenant ID. - :type access_policies: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted - to retrieve certificates stored as secrets from the key vault. - :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is - permitted to retrieve secrets from the vault and unwrap keys. - :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is - permitted to retrieve secrets from the key vault. - :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is - enabled for this key vault. Once set to true, it cannot be reverted to false. - :type enable_soft_delete: bool - :param enable_rbac_authorization: Property that controls how data actions are authorized. When - true, the key vault will use Role Based Access Control (RBAC) for authorization of data - actions, and the access policies specified in vault properties will be ignored. 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.v2020_04_01_preview.models.CreateMode - :param enable_purge_protection: Property specifying whether protection against purge is enabled - for this vault. Setting this property to true activates protection against purge for this vault - and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this functionality is - irreversible - that is, the property does not accept false as its value. - :type enable_purge_protection: bool - :param network_acls: A collection of rules governing the accessibility of the vault from - specific network locations. - :type network_acls: ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet - """ - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, - 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, - 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, - 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, - 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, - 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, - 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultPatchProperties, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.sku = kwargs.get('sku', None) - self.access_policies = kwargs.get('access_policies', None) - self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) - self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) - self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) - self.enable_soft_delete = kwargs.get('enable_soft_delete', None) - self.enable_rbac_authorization = kwargs.get('enable_rbac_authorization', None) - self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', None) - self.create_mode = kwargs.get('create_mode', None) - self.enable_purge_protection = kwargs.get('enable_purge_protection', None) - self.network_acls = kwargs.get('network_acls', None) - - -class VaultProperties(msrest.serialization.Model): - """Properties of the vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for - authenticating requests to the key vault. - :type tenant_id: str - :param sku: Required. SKU details. - :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Sku - :param access_policies: An array of 0 to 1024 identities that have access to the key vault. All - identities in the array must use the same tenant ID as the key vault's tenant ID. When - ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access - policies are required. - :type access_policies: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. - :type vault_uri: str - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted - to retrieve certificates stored as secrets from the key vault. - :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is - permitted to retrieve secrets from the vault and unwrap keys. - :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is - permitted to retrieve secrets from the key vault. - :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is - enabled for this key vault. If it's not set to any value(true or false) when creating new key - vault, it will be set to true by default. Once set to true, it cannot be reverted to false. - :type enable_soft_delete: bool - :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. - :type soft_delete_retention_in_days: int - :param enable_rbac_authorization: Property that controls how data actions are authorized. When - true, the key vault will use Role Based Access Control (RBAC) for authorization of data - actions, and the access policies specified in vault properties will be ignored. 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.v2020_04_01_preview.models.CreateMode - :param enable_purge_protection: Property specifying whether protection against purge is enabled - for this vault. Setting this property to true activates protection against purge for this vault - and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this functionality is - irreversible - that is, the property does not accept false as its value. - :type enable_purge_protection: bool - :param network_acls: Rules governing the accessibility of the key vault from specific network - locations. - :type network_acls: ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet - :param provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". - :type provisioning_state: str or - ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProvisioningState - :ivar private_endpoint_connections: List of private endpoint connections associated with the - key vault. - :vartype private_endpoint_connections: - list[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnectionItem] - """ - - _validation = { - 'tenant_id': {'required': True}, - 'sku': {'required': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, - 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, - 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, - 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, - 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, - 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, - 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, - 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultProperties, self).__init__(**kwargs) - self.tenant_id = kwargs['tenant_id'] - self.sku = kwargs['sku'] - self.access_policies = kwargs.get('access_policies', None) - self.vault_uri = kwargs.get('vault_uri', None) - self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) - self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) - self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) - self.enable_soft_delete = kwargs.get('enable_soft_delete', True) - self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', 90) - self.enable_rbac_authorization = kwargs.get('enable_rbac_authorization', False) - self.create_mode = kwargs.get('create_mode', None) - self.enable_purge_protection = kwargs.get('enable_purge_protection', None) - self.network_acls = kwargs.get('network_acls', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.private_endpoint_connections = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """A rule governing the accessibility of a vault from a specific virtual network. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - :type id: str - :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the - check if parent subnet has serviceEndpoints configured. - :type ignore_missing_vnet_service_endpoint: bool - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.id = kwargs['id'] - self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py index 1cb27b3477be..92673a41c401 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py @@ -20,17 +20,17 @@ class AccessPolicyEntry(msrest.serialization.Model): 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 + :ivar 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 + :vartype tenant_id: str + :ivar 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.v2020_04_01_preview.models.Permissions + :vartype object_id: str + :ivar application_id: Application ID of the client making request on behalf of a principal. + :vartype application_id: str + :ivar permissions: Required. Permissions the identity has for keys, secrets and certificates. + :vartype permissions: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Permissions """ _validation = { @@ -55,6 +55,20 @@ def __init__( application_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword 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. + :paramtype object_id: str + :keyword application_id: Application ID of the client making request on behalf of a principal. + :paramtype application_id: str + :keyword permissions: Required. Permissions the identity has for keys, secrets and + certificates. + :paramtype permissions: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Permissions + """ super(AccessPolicyEntry, self).__init__(**kwargs) self.tenant_id = tenant_id self.object_id = object_id @@ -67,12 +81,12 @@ class Attributes(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: Determines whether the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: ~datetime.datetime - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: ~datetime.datetime + :ivar enabled: Determines whether the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :vartype not_before: ~datetime.datetime + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: ~datetime.datetime :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. :vartype created: ~datetime.datetime :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. @@ -100,6 +114,14 @@ def __init__( expires: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword enabled: Determines whether the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :paramtype not_before: ~datetime.datetime + :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :paramtype expires: ~datetime.datetime + """ super(Attributes, self).__init__(**kwargs) self.enabled = enabled self.not_before = not_before @@ -141,6 +163,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -150,11 +174,11 @@ def __init__( 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 + :ivar code: Error code. This is a mnemonic that can be consumed programmatically. + :vartype code: str + :ivar message: User friendly error message. The message is typically localized and may vary with service version. - :type message: str + :vartype message: str """ _attribute_map = { @@ -169,6 +193,13 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Error code. This is a mnemonic that can be consumed programmatically. + :paramtype code: str + :keyword message: User friendly error message. The message is typically localized and may vary + with service version. + :paramtype message: str + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -185,8 +216,8 @@ class DeletedVault(msrest.serialization.Model): :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.v2020_04_01_preview.models.DeletedVaultProperties + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultProperties """ _validation = { @@ -208,6 +239,10 @@ def __init__( properties: Optional["DeletedVaultProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultProperties + """ super(DeletedVault, self).__init__(**kwargs) self.id = None self.name = None @@ -218,10 +253,10 @@ def __init__( class DeletedVaultListResult(msrest.serialization.Model): """List of vaults. - :param value: The list of deleted vaults. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault] - :param next_link: The URL to get the next set of deleted vaults. - :type next_link: str + :ivar value: The list of deleted vaults. + :vartype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault] + :ivar next_link: The URL to get the next set of deleted vaults. + :vartype next_link: str """ _attribute_map = { @@ -236,6 +271,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of deleted vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault] + :keyword next_link: The URL to get the next set of deleted vaults. + :paramtype next_link: str + """ super(DeletedVaultListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -282,6 +323,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -294,13 +337,13 @@ def __init__( class DimensionProperties(msrest.serialization.Model): """Type of operation: get, read, delete, etc. - :param name: Name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported + :ivar name: Name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Property to specify whether the dimension should be exported for shoebox. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -317,6 +360,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Property to specify whether the dimension should be + exported for shoebox. + :paramtype to_be_exported_for_shoebox: bool + """ super(DimensionProperties, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -352,6 +404,8 @@ def __init__( self, **kwargs ): + """ + """ super(Error, self).__init__(**kwargs) self.code = None self.message = None @@ -363,9 +417,9 @@ class IPRule(msrest.serialization.Model): 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 + :ivar 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 + :vartype value: str """ _validation = { @@ -382,6 +436,11 @@ def __init__( value: str, **kwargs ): + """ + :keyword 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). + :paramtype value: str + """ super(IPRule, self).__init__(**kwargs) self.value = value @@ -423,6 +482,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -446,18 +507,19 @@ class Key(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] - :param attributes: The attributes of the key. - :type attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyAttributes - :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + :ivar attributes: The attributes of the key. + :vartype attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyAttributes + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM". - :type kty: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyOperation] - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :type key_size: int - :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + :vartype kty: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyType + :ivar key_ops: + :vartype key_ops: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyOperation] + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :vartype key_size: int + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: "P-256", "P-384", "P-521", "P-256K". - :type curve_name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyCurveName + :vartype curve_name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str :ivar key_uri_with_version: The URI to retrieve the specific version of the key. @@ -499,6 +561,22 @@ def __init__( curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, **kwargs ): + """ + :keyword attributes: The attributes of the key. + :paramtype attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyAttributes + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values + include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :paramtype kty: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyType + :keyword key_ops: + :paramtype key_ops: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyOperation] + :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :paramtype key_size: int + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. + Possible values include: "P-256", "P-384", "P-521", "P-256K". + :paramtype curve_name: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyCurveName + """ super(Key, self).__init__(**kwargs) self.attributes = attributes self.kty = kty @@ -514,12 +592,12 @@ class KeyAttributes(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: Determines whether or not the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: long - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: long + :ivar enabled: Determines whether or not the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :vartype not_before: long + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: long :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. :vartype created: long :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. @@ -556,6 +634,14 @@ def __init__( expires: Optional[int] = None, **kwargs ): + """ + :keyword enabled: Determines whether or not the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :paramtype not_before: long + :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :paramtype expires: long + """ super(KeyAttributes, self).__init__(**kwargs) self.enabled = enabled self.not_before = not_before @@ -570,10 +656,10 @@ class KeyCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. The tags that will be assigned to the key. - :type tags: dict[str, str] - :param properties: Required. The properties of the key to be created. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyProperties + :ivar tags: A set of tags. The tags that will be assigned to the key. + :vartype tags: dict[str, str] + :ivar properties: Required. The properties of the key to be created. + :vartype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyProperties """ _validation = { @@ -592,6 +678,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the key. + :paramtype tags: dict[str, str] + :keyword properties: Required. The properties of the key to be created. + :paramtype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyProperties + """ super(KeyCreateParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -600,10 +692,10 @@ def __init__( class KeyListResult(msrest.serialization.Model): """The page of keys. - :param value: The key resources. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Key] - :param next_link: The URL to get the next page of keys. - :type next_link: str + :ivar value: The key resources. + :vartype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Key] + :ivar next_link: The URL to get the next page of keys. + :vartype next_link: str """ _attribute_map = { @@ -618,6 +710,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The key resources. + :paramtype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Key] + :keyword next_link: The URL to get the next page of keys. + :paramtype next_link: str + """ super(KeyListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -628,18 +726,19 @@ class KeyProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param attributes: The attributes of the key. - :type attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyAttributes - :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + :ivar attributes: The attributes of the key. + :vartype attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyAttributes + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM". - :type kty: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyOperation] - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :type key_size: int - :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + :vartype kty: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyType + :ivar key_ops: + :vartype key_ops: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyOperation] + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :vartype key_size: int + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: "P-256", "P-384", "P-521", "P-256K". - :type curve_name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyCurveName + :vartype curve_name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str :ivar key_uri_with_version: The URI to retrieve the specific version of the key. @@ -671,6 +770,22 @@ def __init__( curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, **kwargs ): + """ + :keyword attributes: The attributes of the key. + :paramtype attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyAttributes + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values + include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :paramtype kty: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyType + :keyword key_ops: + :paramtype key_ops: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyOperation] + :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :paramtype key_size: int + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. + Possible values include: "P-256", "P-384", "P-521", "P-256K". + :paramtype curve_name: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyCurveName + """ super(KeyProperties, self).__init__(**kwargs) self.attributes = attributes self.kty = kty @@ -684,12 +799,12 @@ def __init__( 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 + :ivar name: Name of log specification. + :vartype name: str + :ivar display_name: Display name of log specification. + :vartype display_name: str + :ivar blob_duration: Blob duration of specification. + :vartype blob_duration: str """ _attribute_map = { @@ -706,6 +821,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of log specification. + :paramtype name: str + :keyword display_name: Display name of log specification. + :paramtype display_name: str + :keyword blob_duration: Blob duration of specification. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -723,12 +846,12 @@ class ManagedHsmResource(msrest.serialization.Model): :vartype name: str :ivar type: The resource type of the managed HSM Pool. :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] """ _validation = { @@ -754,6 +877,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ManagedHsmResource, self).__init__(**kwargs) self.id = None self.name = None @@ -774,14 +905,14 @@ class ManagedHsm(ManagedHsmResource): :vartype name: str :ivar type: The resource type of the managed HSM Pool. :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param properties: Properties of the managed HSM. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmProperties + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Properties of the managed HSM. + :vartype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmProperties """ _validation = { @@ -809,6 +940,16 @@ def __init__( properties: Optional["ManagedHsmProperties"] = None, **kwargs ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the managed HSM. + :paramtype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmProperties + """ super(ManagedHsm, self).__init__(location=location, sku=sku, tags=tags, **kwargs) self.properties = properties @@ -834,6 +975,8 @@ def __init__( self, **kwargs ): + """ + """ super(ManagedHsmError, self).__init__(**kwargs) self.error = None @@ -841,10 +984,10 @@ def __init__( class ManagedHsmListResult(msrest.serialization.Model): """List of managed HSM Pools. - :param value: The list of managed HSM Pools. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] - :param next_link: The URL to get the next set of managed HSM Pools. - :type next_link: str + :ivar value: The list of managed HSM Pools. + :vartype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] + :ivar next_link: The URL to get the next set of managed HSM Pools. + :vartype next_link: str """ _attribute_map = { @@ -859,6 +1002,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of managed HSM Pools. + :paramtype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] + :keyword next_link: The URL to get the next set of managed HSM Pools. + :paramtype next_link: str + """ super(ManagedHsmListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -869,30 +1018,30 @@ class ManagedHsmProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + :ivar tenant_id: The Azure Active Directory tenant ID that should be used for authenticating requests to the managed HSM pool. - :type tenant_id: str - :param initial_admin_object_ids: Array of initial administrators object ids for this managed - hsm pool. - :type initial_admin_object_ids: list[str] + :vartype tenant_id: str + :ivar initial_admin_object_ids: Array of initial administrators object ids for this managed hsm + pool. + :vartype initial_admin_object_ids: list[str] :ivar hsm_uri: The URI of the managed hsm pool for performing operations on keys. :vartype hsm_uri: str - :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + :ivar enable_soft_delete: Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. If it's not set to any value(true or false) when creating new managed HSM pool, it will be set to true by default. Once set to true, it cannot be reverted to false. - :type enable_soft_delete: bool - :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. - :type soft_delete_retention_in_days: int - :param enable_purge_protection: Property specifying whether protection against purge is enabled + :vartype enable_soft_delete: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this managed HSM pool. Setting this property to true activates protection against purge for this managed HSM pool and its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling this functionality is irreversible. - :type enable_purge_protection: bool - :param create_mode: The create mode to indicate whether the resource is being created or is + :vartype enable_purge_protection: bool + :ivar create_mode: The create mode to indicate whether the resource is being created or is being recovered from a deleted resource. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode + :vartype create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode :ivar status_message: Resource Status Message. :vartype status_message: str :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", @@ -931,6 +1080,31 @@ def __init__( create_mode: Optional[Union[str, "CreateMode"]] = None, **kwargs ): + """ + :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the managed HSM pool. + :paramtype tenant_id: str + :keyword initial_admin_object_ids: Array of initial administrators object ids for this managed + hsm pool. + :paramtype initial_admin_object_ids: list[str] + :keyword enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this managed HSM pool. If it's not set to any value(true or false) when creating + new managed HSM pool, it will be set to true by default. Once set to true, it cannot be + reverted to false. + :paramtype enable_soft_delete: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword enable_purge_protection: Property specifying whether protection against purge is + enabled for this managed HSM pool. Setting this property to true activates protection against + purge for this managed HSM pool and its content - only the Managed HSM service may initiate a + hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. + Enabling this functionality is irreversible. + :paramtype enable_purge_protection: bool + :keyword create_mode: The create mode to indicate whether the resource is being created or is + being recovered from a deleted resource. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode + """ super(ManagedHsmProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.initial_admin_object_ids = initial_admin_object_ids @@ -948,11 +1122,11 @@ class ManagedHsmSku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". - :type family: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuFamily - :param name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + :ivar family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :vartype family: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuFamily + :ivar name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", "Custom_B32". - :type name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuName + :vartype name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuName """ _validation = { @@ -972,6 +1146,13 @@ def __init__( name: Union[str, "ManagedHsmSkuName"], **kwargs ): + """ + :keyword family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :paramtype family: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuFamily + :keyword name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + "Custom_B32". + :paramtype name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuName + """ super(ManagedHsmSku, self).__init__(**kwargs) self.family = family self.name = name @@ -980,29 +1161,29 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of Metric specification. - :type display_name: str - :param display_description: Display description of Metric specification. - :type display_description: str - :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. - :type unit: str - :param aggregation_type: The metric aggregation type. Possible values include: 'Average', + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of Metric specification. + :vartype display_name: str + :ivar display_description: Display description of Metric specification. + :vartype display_description: str + :ivar unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :vartype unit: str + :ivar aggregation_type: The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'. - :type aggregation_type: str - :param supported_aggregation_types: The supported aggregation types for the metrics. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: The supported time grain types for the metrics. - :type supported_time_grain_types: list[str] - :param lock_aggregation_type: The metric lock aggregation type. - :type lock_aggregation_type: str - :param dimensions: The dimensions of metric. - :type dimensions: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.DimensionProperties] - :param fill_gap_with_zero: Property to specify whether to fill gap with zero. - :type fill_gap_with_zero: bool - :param internal_metric_name: The internal metric name. - :type internal_metric_name: str + :vartype aggregation_type: str + :ivar supported_aggregation_types: The supported aggregation types for the metrics. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: The supported time grain types for the metrics. + :vartype supported_time_grain_types: list[str] + :ivar lock_aggregation_type: The metric lock aggregation type. + :vartype lock_aggregation_type: str + :ivar dimensions: The dimensions of metric. + :vartype dimensions: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.DimensionProperties] + :ivar fill_gap_with_zero: Property to specify whether to fill gap with zero. + :vartype fill_gap_with_zero: bool + :ivar internal_metric_name: The internal metric name. + :vartype internal_metric_name: str """ _attribute_map = { @@ -1035,6 +1216,32 @@ def __init__( internal_metric_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of Metric specification. + :paramtype display_name: str + :keyword display_description: Display description of Metric specification. + :paramtype display_description: str + :keyword unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :paramtype unit: str + :keyword aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: The supported aggregation types for the metrics. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: The supported time grain types for the metrics. + :paramtype supported_time_grain_types: list[str] + :keyword lock_aggregation_type: The metric lock aggregation type. + :paramtype lock_aggregation_type: str + :keyword dimensions: The dimensions of metric. + :paramtype dimensions: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.DimensionProperties] + :keyword fill_gap_with_zero: Property to specify whether to fill gap with zero. + :paramtype fill_gap_with_zero: bool + :keyword internal_metric_name: The internal metric name. + :paramtype internal_metric_name: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1052,18 +1259,20 @@ def __init__( 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 + :ivar 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.v2020_04_01_preview.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and from - virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleAction - :param ip_rules: The list of IP address rules. - :type ip_rules: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.IPRule] - :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: + :vartype bypass: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleBypassOptions + :ivar 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". + :vartype default_action: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleAction + :ivar ip_rules: The list of IP address rules. + :vartype ip_rules: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.IPRule] + :ivar virtual_network_rules: The list of virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.VirtualNetworkRule] """ @@ -1083,6 +1292,23 @@ def __init__( virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype bypass: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleBypassOptions + :keyword 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". + :paramtype default_action: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleAction + :keyword ip_rules: The list of IP address rules. + :paramtype ip_rules: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.IPRule] + :keyword virtual_network_rules: The list of virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.VirtualNetworkRule] + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.default_action = default_action @@ -1093,16 +1319,16 @@ def __init__( 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.v2020_04_01_preview.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param is_data_action: Property to specify whether the action is a data action. - :type is_data_action: bool - :param service_specification: One property of operation, include metric specifications. - :type service_specification: + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar is_data_action: Property to specify whether the action is a data action. + :vartype is_data_action: bool + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ServiceSpecification """ @@ -1124,6 +1350,19 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword is_data_action: Property to specify whether the action is a data action. + :paramtype is_data_action: bool + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1135,14 +1374,14 @@ def __init__( 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 + :ivar provider: Service provider: Microsoft Key Vault. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of operation. + :vartype description: str """ _attribute_map = { @@ -1161,6 +1400,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Key Vault. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1171,10 +1420,10 @@ def __init__( 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.v2020_04_01_preview.models.Operation] - :param next_link: The URL to get the next set of operations. - :type next_link: str + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Operation] + :ivar next_link: The URL to get the next set of operations. + :vartype next_link: str """ _attribute_map = { @@ -1189,6 +1438,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Operation] + :keyword next_link: The URL to get the next set of operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1197,15 +1452,17 @@ def __init__( 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.v2020_04_01_preview.models.KeyPermissions] - :param secrets: Permissions to secrets. - :type secrets: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretPermissions] - :param certificates: Permissions to certificates. - :type certificates: list[str or + :ivar keys: Permissions to keys. + :vartype keys: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyPermissions] + :ivar secrets: Permissions to secrets. + :vartype secrets: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretPermissions] + :ivar certificates: Permissions to certificates. + :vartype certificates: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CertificatePermissions] - :param storage: Permissions to storage accounts. - :type storage: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.StoragePermissions] + :ivar storage: Permissions to storage accounts. + :vartype storage: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.StoragePermissions] """ _attribute_map = { @@ -1224,6 +1481,19 @@ def __init__( storage: Optional[List[Union[str, "StoragePermissions"]]] = None, **kwargs ): + """ + :keyword keys: Permissions to keys. + :paramtype keys: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyPermissions] + :keyword secrets: Permissions to secrets. + :paramtype secrets: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretPermissions] + :keyword certificates: Permissions to certificates. + :paramtype certificates: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.CertificatePermissions] + :keyword storage: Permissions to storage accounts. + :paramtype storage: list[str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.StoragePermissions] + """ super(Permissions, self).__init__(**kwargs) self.keys = keys self.secrets = secrets @@ -1252,6 +1522,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1271,12 +1543,12 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". @@ -1313,6 +1585,15 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.etag = etag self.private_endpoint = private_endpoint @@ -1325,14 +1606,14 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Id of private endpoint connection. - :type id: str - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: + :ivar id: Id of private endpoint connection. + :vartype id: str + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkServiceConnectionState :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". @@ -1361,6 +1642,17 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, **kwargs ): + """ + :keyword id: Id of private endpoint connection. + :paramtype id: str + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkServiceConnectionState + """ super(PrivateEndpointConnectionItem, self).__init__(**kwargs) self.id = id self.etag = etag @@ -1388,8 +1680,8 @@ class PrivateLinkResource(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] + :ivar required_zone_names: Required DNS zone names of the the private link resource. + :vartype required_zone_names: list[str] """ _validation = { @@ -1419,6 +1711,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: Required DNS zone names of the the private link resource. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -1428,8 +1724,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResource] """ _attribute_map = { @@ -1442,6 +1738,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -1449,15 +1749,16 @@ def __init__( 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 + :ivar 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 + :vartype status: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval or rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval or rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. Possible values include: "None". - :type actions_required: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ActionsRequired + :vartype actions_required: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ActionsRequired """ _attribute_map = { @@ -1474,6 +1775,18 @@ def __init__( actions_required: Optional[Union[str, "ActionsRequired"]] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval or rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None". + :paramtype actions_required: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.ActionsRequired + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -1483,10 +1796,10 @@ def __init__( class ResourceListResult(msrest.serialization.Model): """List of vault resources. - :param value: The list of vault resources. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Resource] - :param next_link: The URL to get the next set of vault resources. - :type next_link: str + :ivar value: The list of vault resources. + :vartype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Resource] + :ivar next_link: The URL to get the next set of vault resources. + :vartype next_link: str """ _attribute_map = { @@ -1501,6 +1814,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of vault resources. + :paramtype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Resource] + :keyword next_link: The URL to get the next set of vault resources. + :paramtype next_link: str + """ super(ResourceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1523,8 +1842,8 @@ class Secret(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] - :param properties: Required. Properties of the secret. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretProperties + :ivar properties: Required. Properties of the secret. + :vartype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretProperties """ _validation = { @@ -1551,6 +1870,10 @@ def __init__( properties: "SecretProperties", **kwargs ): + """ + :keyword properties: Required. Properties of the secret. + :paramtype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretProperties + """ super(Secret, self).__init__(**kwargs) self.properties = properties @@ -1560,12 +1883,12 @@ class SecretAttributes(Attributes): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: Determines whether the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: ~datetime.datetime - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: ~datetime.datetime + :ivar enabled: Determines whether the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :vartype not_before: ~datetime.datetime + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: ~datetime.datetime :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. :vartype created: ~datetime.datetime :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. @@ -1593,6 +1916,14 @@ def __init__( expires: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword enabled: Determines whether the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :paramtype not_before: ~datetime.datetime + :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :paramtype expires: ~datetime.datetime + """ super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) @@ -1601,10 +1932,10 @@ class SecretCreateOrUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. The tags that will be assigned to the secret. - :type tags: dict[str, str] - :param properties: Required. Properties of the secret. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretProperties + :ivar tags: A set of tags. The tags that will be assigned to the secret. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the secret. + :vartype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretProperties """ _validation = { @@ -1623,6 +1954,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the secret. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the secret. + :paramtype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretProperties + """ super(SecretCreateOrUpdateParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -1631,10 +1968,10 @@ def __init__( class SecretListResult(msrest.serialization.Model): """List of secrets. - :param value: The list of secrets. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Secret] - :param next_link: The URL to get the next set of secrets. - :type next_link: str + :ivar value: The list of secrets. + :vartype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Secret] + :ivar next_link: The URL to get the next set of secrets. + :vartype next_link: str """ _attribute_map = { @@ -1649,6 +1986,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of secrets. + :paramtype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Secret] + :keyword next_link: The URL to get the next set of secrets. + :paramtype next_link: str + """ super(SecretListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1657,10 +2000,10 @@ def __init__( class SecretPatchParameters(msrest.serialization.Model): """Parameters for patching a secret. - :param tags: A set of tags. The tags that will be assigned to the secret. - :type tags: dict[str, str] - :param properties: Properties of the secret. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretPatchProperties + :ivar tags: A set of tags. The tags that will be assigned to the secret. + :vartype tags: dict[str, str] + :ivar properties: Properties of the secret. + :vartype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretPatchProperties """ _attribute_map = { @@ -1675,6 +2018,12 @@ def __init__( properties: Optional["SecretPatchProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the secret. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the secret. + :paramtype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretPatchProperties + """ super(SecretPatchParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -1683,12 +2032,12 @@ def __init__( class SecretPatchProperties(msrest.serialization.Model): """Properties of the secret. - :param value: The value of the secret. - :type value: str - :param content_type: The content type of the secret. - :type content_type: str - :param attributes: The attributes of the secret. - :type attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretAttributes + :ivar value: The value of the secret. + :vartype value: str + :ivar content_type: The content type of the secret. + :vartype content_type: str + :ivar attributes: The attributes of the secret. + :vartype attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretAttributes """ _attribute_map = { @@ -1705,6 +2054,14 @@ def __init__( attributes: Optional["SecretAttributes"] = None, **kwargs ): + """ + :keyword value: The value of the secret. + :paramtype value: str + :keyword content_type: The content type of the secret. + :paramtype content_type: str + :keyword attributes: The attributes of the secret. + :paramtype attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretAttributes + """ super(SecretPatchProperties, self).__init__(**kwargs) self.value = value self.content_type = content_type @@ -1716,14 +2073,14 @@ class SecretProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: The value of the secret. NOTE: 'value' will never be returned from the service, - as APIs using this model are is intended for internal use in ARM deployments. Users should use - the data-plane REST service for interaction with vault secrets. - :type value: str - :param content_type: The content type of the secret. - :type content_type: str - :param attributes: The attributes of the secret. - :type attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretAttributes + :ivar value: The value of the secret. NOTE: 'value' will never be returned from the service, as + APIs using this model are is intended for internal use in ARM deployments. Users should use the + data-plane REST service for interaction with vault secrets. + :vartype value: str + :ivar content_type: The content type of the secret. + :vartype content_type: str + :ivar attributes: The attributes of the secret. + :vartype attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretAttributes :ivar secret_uri: The URI to retrieve the current version of the secret. :vartype secret_uri: str :ivar secret_uri_with_version: The URI to retrieve the specific version of the secret. @@ -1751,6 +2108,16 @@ def __init__( attributes: Optional["SecretAttributes"] = None, **kwargs ): + """ + :keyword value: The value of the secret. NOTE: 'value' will never be returned from the service, + as APIs using this model are is intended for internal use in ARM deployments. Users should use + the data-plane REST service for interaction with vault secrets. + :paramtype value: str + :keyword content_type: The content type of the secret. + :paramtype content_type: str + :keyword attributes: The attributes of the secret. + :paramtype attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretAttributes + """ super(SecretProperties, self).__init__(**kwargs) self.value = value self.content_type = content_type @@ -1762,11 +2129,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include log specifications. - :param log_specifications: Log specifications of operation. - :type log_specifications: + :ivar log_specifications: Log specifications of operation. + :vartype log_specifications: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.LogSpecification] - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.MetricSpecification] """ @@ -1782,6 +2149,14 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Log specifications of operation. + :paramtype log_specifications: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.LogSpecification] + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -1792,11 +2167,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param family: Required. SKU family name. Possible values include: "A". - :type family: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuFamily - :param name: Required. SKU name to specify whether the key vault is a standard vault or a + :ivar family: Required. SKU family name. Possible values include: "A". + :vartype family: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuFamily + :ivar 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.v2020_04_01_preview.models.SkuName + :vartype name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuName """ _validation = { @@ -1816,6 +2191,13 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword family: Required. SKU family name. Possible values include: "A". + :paramtype family: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuFamily + :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: "standard", "premium". + :paramtype name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.family = family self.name = name @@ -1824,21 +2206,21 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of key vault resource. - :param created_by: The identity that created key vault resource. - :type created_by: str - :param created_by_type: The type of identity that created key vault resource. Possible values + :ivar created_by: The identity that created key vault resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created key vault resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.IdentityType - :param created_at: The timestamp of key vault resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified key vault resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified key vault resource. + :vartype created_by_type: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.IdentityType + :ivar created_at: The timestamp of key vault resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified key vault resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified key vault resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.IdentityType - :param last_modified_at: The timestamp of key vault resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of key vault resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1861,6 +2243,23 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created key vault resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created key vault resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.IdentityType + :keyword created_at: The timestamp of key vault resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified key vault resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified key vault resource. + Possible values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.IdentityType + :keyword last_modified_at: The timestamp of key vault resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -1883,14 +2282,14 @@ class Vault(msrest.serialization.Model): :vartype name: str :ivar type: Resource type of the key vault resource. :vartype type: str - :param location: Azure location of the key vault resource. - :type location: str - :param tags: A set of tags. Tags assigned to the key vault resource. - :type tags: dict[str, str] + :ivar 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 system_data: System metadata for the key vault. :vartype system_data: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SystemData - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProperties + :ivar properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProperties """ _validation = { @@ -1919,6 +2318,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Azure location of the key vault resource. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to the key vault resource. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProperties + """ super(Vault, self).__init__(**kwargs) self.id = None self.name = None @@ -1944,8 +2351,9 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): :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.v2020_04_01_preview.models.VaultAccessPolicyProperties + :ivar properties: Required. Properties of the access policy. + :vartype properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyProperties """ _validation = { @@ -1970,6 +2378,11 @@ def __init__( properties: "VaultAccessPolicyProperties", **kwargs ): + """ + :keyword properties: Required. Properties of the access policy. + :paramtype properties: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyProperties + """ super(VaultAccessPolicyParameters, self).__init__(**kwargs) self.id = None self.name = None @@ -1983,9 +2396,10 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): 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 + :ivar 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.v2020_04_01_preview.models.AccessPolicyEntry] + :vartype access_policies: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] """ _validation = { @@ -2002,6 +2416,12 @@ def __init__( access_policies: List["AccessPolicyEntry"], **kwargs ): + """ + :keyword 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. + :paramtype access_policies: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] + """ super(VaultAccessPolicyProperties, self).__init__(**kwargs) self.access_policies = access_policies @@ -2013,8 +2433,8 @@ class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The vault name. - :type name: str + :ivar name: Required. The vault name. + :vartype name: str :ivar type: The type of resource, Microsoft.KeyVault/vaults. Has constant value: "Microsoft.KeyVault/vaults". :vartype type: str @@ -2038,6 +2458,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -2047,12 +2471,12 @@ class VaultCreateOrUpdateParameters(msrest.serialization.Model): 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.v2020_04_01_preview.models.VaultProperties + :ivar location: Required. The supported Azure location where the key vault should be created. + :vartype location: str + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProperties """ _validation = { @@ -2074,6 +2498,15 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The supported Azure location where the key vault should be + created. + :paramtype location: str + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProperties + """ super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2083,10 +2516,10 @@ def __init__( class VaultListResult(msrest.serialization.Model): """List of vaults. - :param value: The list of vaults. - :type value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault] - :param next_link: The URL to get the next set of vaults. - :type next_link: str + :ivar value: The list of vaults. + :vartype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault] + :ivar next_link: The URL to get the next set of vaults. + :vartype next_link: str """ _attribute_map = { @@ -2101,6 +2534,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault] + :keyword next_link: The URL to get the next set of vaults. + :paramtype next_link: str + """ super(VaultListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2109,10 +2548,10 @@ def __init__( 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.v2020_04_01_preview.models.VaultPatchProperties + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultPatchProperties """ _attribute_map = { @@ -2127,6 +2566,12 @@ def __init__( properties: Optional["VaultPatchProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultPatchProperties + """ super(VaultPatchParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -2135,47 +2580,48 @@ def __init__( class VaultPatchProperties(msrest.serialization.Model): """Properties of the vault. - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + :ivar 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.v2020_04_01_preview.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to the key vault. All + :vartype tenant_id: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Sku + :ivar 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.v2020_04_01_preview.models.AccessPolicyEntry] - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + :vartype access_policies: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] + :ivar 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 + :vartype enabled_for_deployment: bool + :ivar 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 + :vartype enabled_for_disk_encryption: bool + :ivar 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 + :vartype enabled_for_template_deployment: bool + :ivar 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 + :vartype enable_soft_delete: bool + :ivar 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. 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 + :vartype enable_rbac_authorization: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar 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.v2020_04_01_preview.models.CreateMode - :param enable_purge_protection: Property specifying whether protection against purge is enabled + :vartype create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode + :ivar 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 + :vartype enable_purge_protection: bool + :ivar network_acls: A collection of rules governing the accessibility of the vault from specific network locations. - :type network_acls: ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet + :vartype network_acls: ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet """ _attribute_map = { @@ -2210,6 +2656,51 @@ def __init__( network_acls: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. + :paramtype tenant_id: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Sku + :keyword 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. + :paramtype access_policies: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword 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. + :paramtype enable_soft_delete: bool + :keyword 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. 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. + :paramtype enable_rbac_authorization: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode + :keyword 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. + :paramtype enable_purge_protection: bool + :keyword network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet + """ super(VaultPatchProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -2232,55 +2723,56 @@ class VaultProperties(msrest.serialization.Model): 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 + :ivar 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.v2020_04_01_preview.models.Sku - :param access_policies: An array of 0 to 1024 identities that have access to the key vault. All + :vartype tenant_id: str + :ivar sku: Required. SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Sku + :ivar access_policies: An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. When ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. - :type access_policies: list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. - :type vault_uri: str - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + :vartype access_policies: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] + :ivar vault_uri: The URI of the vault for performing operations on keys and secrets. + :vartype vault_uri: str + :ivar 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 + :vartype enabled_for_deployment: bool + :ivar 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 + :vartype enabled_for_disk_encryption: bool + :ivar 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 + :vartype enabled_for_template_deployment: bool + :ivar 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 + :vartype enable_soft_delete: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar 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. 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 + :vartype enable_rbac_authorization: bool + :ivar 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.v2020_04_01_preview.models.CreateMode - :param enable_purge_protection: Property specifying whether protection against purge is enabled + :vartype create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode + :ivar 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 + :vartype enable_purge_protection: bool + :ivar network_acls: Rules governing the accessibility of the key vault from specific network locations. - :type network_acls: ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet - :param provisioning_state: Provisioning state of the vault. Possible values include: + :vartype network_acls: ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet + :ivar provisioning_state: Provisioning state of the vault. Possible values include: "Succeeded", "RegisteringDns". - :type provisioning_state: str or + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. @@ -2331,6 +2823,60 @@ def __init__( provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, **kwargs ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword sku: Required. SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Sku + :keyword access_policies: An array of 0 to 1024 identities that have access to the key vault. + All identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :paramtype access_policies: + list[~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyEntry] + :keyword vault_uri: The URI of the vault for performing operations on keys and secrets. + :paramtype vault_uri: str + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword 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. + :paramtype enable_soft_delete: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword 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. 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. + :paramtype enable_rbac_authorization: bool + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode + :keyword 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. + :paramtype enable_purge_protection: bool + :keyword network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet + :keyword provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProvisioningState + """ super(VaultProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -2354,12 +2900,12 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. Full resource id of a vnet subnet, such as + :ivar id: Required. Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - :type id: str - :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + :vartype id: str + :ivar ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. - :type ignore_missing_vnet_service_endpoint: bool + :vartype ignore_missing_vnet_service_endpoint: bool """ _validation = { @@ -2378,6 +2924,14 @@ def __init__( ignore_missing_vnet_service_endpoint: Optional[bool] = None, **kwargs ): + """ + :keyword id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :paramtype id: str + :keyword ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + check if parent subnet has serviceEndpoints configured. + :paramtype ignore_missing_vnet_service_endpoint: bool + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.id = id self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_keys_operations.py index 0e2d13a935f6..650adcf6c201 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_keys_operations.py @@ -5,23 +5,220 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_if_not_exist_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_version_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + key_version: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + "keyVersion": _SERIALIZER.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class KeysOperations(object): """KeysOperations operations. @@ -45,15 +242,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_if_not_exist( self, - resource_group_name, # type: str - vault_name, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Key" + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: "_models.KeyCreateParameters", + **kwargs: Any + ) -> "_models.Key": """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys. @@ -77,33 +274,23 @@ def create_if_not_exist( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_if_not_exist.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'KeyCreateParameters') + + request = build_create_if_not_exist_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + content_type=content_type, + json=_json, + template_url=self.create_if_not_exist.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'KeyCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,16 +304,18 @@ def create_if_not_exist( return cls(pipeline_response, deserialized, {}) return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Key" + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any + ) -> "_models.Key": """Gets the current version of the specified key from the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -146,28 +335,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,15 +360,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable["_models.KeyListResult"]: """Lists the keys in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -199,7 +380,8 @@ def list( :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either KeyListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] @@ -207,36 +389,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('KeyListResult', pipeline_response) + deserialized = self._deserialize("KeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -254,20 +433,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} # type: ignore + @distributed_trace def get_version( self, - resource_group_name, # type: str - vault_name, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Key" + resource_group_name: str, + vault_name: str, + key_name: str, + key_version: str, + **kwargs: Any + ) -> "_models.Key": """Gets the specified version of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -289,29 +469,19 @@ def get_version( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_version.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'keyVersion': self._serialize.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_version_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + key_version=key_version, + template_url=self.get_version.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -325,16 +495,18 @@ def get_version( return cls(pipeline_response, deserialized, {}) return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} # type: ignore + + @distributed_trace def list_versions( self, - resource_group_name, # type: str - vault_name, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any + ) -> Iterable["_models.KeyListResult"]: """Lists the versions of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -346,7 +518,8 @@ def list_versions( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either KeyListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] @@ -354,37 +527,35 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_versions.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('KeyListResult', pipeline_response) + deserialized = self._deserialize("KeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -402,6 +573,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py index 606ac7e1077c..d77be81bf59b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py @@ -5,25 +5,258 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ManagedHsmsOperations(object): """ManagedHsmsOperations operations. @@ -49,50 +282,38 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ManagedHsm" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedHsm" + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> "_models.ManagedHsm": cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ManagedHsm') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedHsm') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) @@ -104,16 +325,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ManagedHsm" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ManagedHsm"] + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> LROPoller["_models.ManagedHsm"]: """Create or update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -124,15 +347,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,27 +371,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -176,54 +397,43 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ManagedHsm" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedHsm" + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> "_models.ManagedHsm": cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ManagedHsm') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedHsm') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) @@ -235,16 +445,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ManagedHsm" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ManagedHsm"] + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> LROPoller["_models.ManagedHsm"]: """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -255,15 +467,19 @@ def begin_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', @@ -275,27 +491,21 @@ def begin_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -307,61 +517,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -370,15 +570,17 @@ def begin_delete( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -392,21 +594,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -418,15 +613,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ManagedHsm"] + resource_group_name: str, + name: str, + **kwargs: Any + ) -> Optional["_models.ManagedHsm"]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -443,33 +639,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -480,15 +666,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ManagedHsmListResult"] + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ManagedHsmListResult"]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -497,8 +685,10 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] @@ -506,37 +696,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -549,31 +735,34 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + @distributed_trace def list_by_subscription( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ManagedHsmListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ManagedHsmListResult"]: """The List operation gets information about the managed HSM Pools associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] @@ -581,36 +770,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -623,12 +807,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py index 383f84ec4465..2ada97c7b491 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KeyVault/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py index 24fc5832cac5..7d7fe4e03ef9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py @@ -5,24 +5,147 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _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]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_put_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -46,14 +169,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -73,28 +196,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -110,17 +223,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -142,33 +257,23 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -179,49 +284,41 @@ def put( response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -229,29 +326,32 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} 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 + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -263,15 +363,19 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -286,25 +390,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -316,4 +412,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py index 0b0c68d86f1c..bae806084e43 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py @@ -5,22 +5,59 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_vault_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_vault( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -67,27 +104,17 @@ def list_by_vault( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_vault.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_vault_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_vault.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +128,6 @@ def list_by_vault( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_secrets_operations.py index e79f367d185c..63c6c76933f4 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_secrets_operations.py @@ -5,23 +5,194 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + vault_name: str, + secret_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "secretName": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + vault_name: str, + secret_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "secretName": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vault_name: str, + secret_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "secretName": _SERIALIZER.url("secret_name", secret_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SecretsOperations(object): """SecretsOperations operations. @@ -45,15 +216,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - vault_name, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretCreateOrUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Secret" + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: "_models.SecretCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.Secret": """Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -65,7 +236,8 @@ def create_or_update( :param secret_name: Name of the secret. :type secret_name: str :param parameters: Parameters to create or update the secret. - :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretCreateOrUpdateParameters + :type parameters: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: Secret, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Secret @@ -76,33 +248,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,17 +282,19 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - vault_name, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretPatchParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Secret" + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: "_models.SecretPatchParameters", + **kwargs: Any + ) -> "_models.Secret": """Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -153,33 +317,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SecretPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SecretPatchParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,16 +351,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Secret" + resource_group_name: str, + vault_name: str, + secret_name: str, + **kwargs: Any + ) -> "_models.Secret": """Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -226,28 +382,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -261,16 +407,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vault_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + resource_group_name: str, + vault_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SecretListResult"]: """The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -283,7 +431,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SecretListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] @@ -291,38 +440,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SecretListResult', pipeline_response) + deserialized = self._deserialize("SecretListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -340,6 +486,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py index f212d3172205..388e4a923064 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py @@ -5,25 +5,482 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_access_policy_request( + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "operationKind": _SERIALIZER.url("operation_kind", operation_kind, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_deleted_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_deleted_request( + vault_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}') + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_purge_deleted_request_initial( + vault_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge') + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2015-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VaultsOperations(object): """VaultsOperations operations. @@ -49,43 +506,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.Vault": cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +549,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - vault_name, # type: str - parameters, # type: "_models.VaultCreateOrUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Vault"] + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Vault"]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -123,15 +571,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Vault or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +594,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,16 +620,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - vault_name, # type: str - parameters, # type: "_models.VaultPatchParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultPatchParameters", + **kwargs: Any + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -203,32 +649,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VaultPatchParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -246,15 +682,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> None: """Deletes the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -271,27 +709,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -304,13 +732,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -327,27 +756,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,17 +780,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def update_access_policy( self, - resource_group_name, # type: str - vault_name, # type: str - operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] - parameters, # type: "_models.VaultAccessPolicyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultAccessPolicyParameters" + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", + **kwargs: Any + ) -> "_models.VaultAccessPolicyParameters": """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -379,7 +800,8 @@ def update_access_policy( :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.v2020_04_01_preview.models.AccessPolicyUpdateKind + :type operation_kind: str or + ~azure.mgmt.keyvault.v2020_04_01_preview.models.AccessPolicyUpdateKind :param parameters: Access policy to merge into the vault. :type parameters: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -392,33 +814,23 @@ def update_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -436,15 +848,17 @@ def update_access_policy( 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 + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultListResult"] + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -454,7 +868,8 @@ def list_by_resource_group( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] @@ -462,37 +877,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -510,24 +921,26 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] @@ -535,36 +948,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -582,21 +990,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + @distributed_trace def list_deleted( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedVaultListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultListResult] + :return: An iterator like instance of either DeletedVaultListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] @@ -604,34 +1015,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -649,18 +1055,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + @distributed_trace def get_deleted( self, - vault_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedVault" + vault_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -677,27 +1084,17 @@ def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,41 +1108,32 @@ def get_deleted( 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 + vault_name: str, + location: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._purge_deleted_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,13 +1146,14 @@ def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + @distributed_trace def begin_purge_deleted( self, - vault_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + vault_name: str, + location: str, + **kwargs: Any + ) -> LROPoller[None]: """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. :param vault_name: The name of the soft-deleted vault. @@ -773,15 +1162,17 @@ def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -795,21 +1186,14 @@ def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -821,21 +1205,23 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + @distributed_trace def list( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourceListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] @@ -843,38 +1229,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - api_version = "2015-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceListResult', pipeline_response) + deserialized = self._deserialize("ResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -892,21 +1271,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + @distributed_trace def check_name_availability( self, - vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + vault_name: "_models.VaultCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. - :type vault_name: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultCheckNameAvailabilityParameters + :type vault_name: + ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.CheckNameAvailabilityResult @@ -917,30 +1298,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -954,4 +1325,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/__init__.py index 1283ff09177b..59fd240c9528 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['KeyVaultManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_configuration.py index 02b11e932577..9aab24270851 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class KeyVaultManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -68,4 +65,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_key_vault_management_client.py index 790414eed7a4..752592a815ed 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_key_vault_management_client.py @@ -6,104 +6,101 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import MHSMPrivateEndpointConnectionsOperations, MHSMPrivateLinkResourcesOperations, ManagedHsmsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import KeyVaultManagementClientConfiguration -from .operations import VaultsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ManagedHsmsOperations -from .operations import MHSMPrivateEndpointConnectionsOperations -from .operations import MHSMPrivateLinkResourcesOperations -from .operations import Operations -from . import models - -class KeyVaultManagementClient(object): +class KeyVaultManagementClient: """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.keyvault.v2021_04_01_preview.operations.VaultsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.keyvault.v2021_04_01_preview.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.keyvault.v2021_04_01_preview.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.keyvault.v2021_04_01_preview.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.keyvault.v2021_04_01_preview.operations.PrivateLinkResourcesOperations :ivar managed_hsms: ManagedHsmsOperations operations :vartype managed_hsms: azure.mgmt.keyvault.v2021_04_01_preview.operations.ManagedHsmsOperations :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations - :vartype mhsm_private_endpoint_connections: azure.mgmt.keyvault.v2021_04_01_preview.operations.MHSMPrivateEndpointConnectionsOperations + :vartype mhsm_private_endpoint_connections: + azure.mgmt.keyvault.v2021_04_01_preview.operations.MHSMPrivateEndpointConnectionsOperations :ivar mhsm_private_link_resources: MHSMPrivateLinkResourcesOperations operations - :vartype mhsm_private_link_resources: azure.mgmt.keyvault.v2021_04_01_preview.operations.MHSMPrivateLinkResourcesOperations + :vartype mhsm_private_link_resources: + azure.mgmt.keyvault.v2021_04_01_preview.operations.MHSMPrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2021_04_01_preview.operations.Operations :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_metadata.json index e50329726cd5..80aedde9ef58 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "KeyVaultManagementClient", "filename": "_key_vault_management_client", "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "vaults": "VaultsOperations", diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_vendor.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py index 726043aa858a..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.3.0" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/__init__.py index f54ed88d6ad2..8cff887e652d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._key_vault_management_client import KeyVaultManagementClient __all__ = ['KeyVaultManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_configuration.py index 295ccbb41b52..d7aee2539cc7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_key_vault_management_client.py index c4c1758ebf72..d00082613a58 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_key_vault_management_client.py @@ -6,100 +6,102 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import MHSMPrivateEndpointConnectionsOperations, MHSMPrivateLinkResourcesOperations, ManagedHsmsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import KeyVaultManagementClientConfiguration -from .operations import VaultsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ManagedHsmsOperations -from .operations import MHSMPrivateEndpointConnectionsOperations -from .operations import MHSMPrivateLinkResourcesOperations -from .operations import Operations -from .. import models - - -class KeyVaultManagementClient(object): +class KeyVaultManagementClient: """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.VaultsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.PrivateLinkResourcesOperations :ivar managed_hsms: ManagedHsmsOperations operations - :vartype managed_hsms: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.ManagedHsmsOperations + :vartype managed_hsms: + azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.ManagedHsmsOperations :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations - :vartype mhsm_private_endpoint_connections: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.MHSMPrivateEndpointConnectionsOperations + :vartype mhsm_private_endpoint_connections: + azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.MHSMPrivateEndpointConnectionsOperations :ivar mhsm_private_link_resources: MHSMPrivateLinkResourcesOperations operations - :vartype mhsm_private_link_resources: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.MHSMPrivateLinkResourcesOperations + :vartype mhsm_private_link_resources: + azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.MHSMPrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2021_04_01_preview.aio.operations.Operations :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. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py index a61e2fba8456..9fbf387a248e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._managed_hsms_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_deleted_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_deleted_request, build_purge_deleted_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,39 +60,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ManagedHsm') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedHsm') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) @@ -99,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -118,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -170,6 +166,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore async def _update_initial( @@ -184,39 +181,28 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ManagedHsm') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedHsm') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -247,15 +236,20 @@ async def begin_update( :type parameters: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -299,6 +287,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore async def _delete_initial( @@ -312,40 +301,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -360,15 +340,17 @@ async def begin_delete( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -382,21 +364,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -408,8 +383,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -432,33 +409,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -469,8 +436,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -485,8 +455,10 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmListResult] + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] @@ -494,37 +466,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -537,17 +505,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + @distributed_trace def list_by_subscription( self, top: Optional[int] = None, @@ -559,8 +529,10 @@ def list_by_subscription( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmListResult] + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] @@ -568,36 +540,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -610,17 +577,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + @distributed_trace def list_deleted( self, **kwargs: Any @@ -629,8 +598,10 @@ def list_deleted( subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsmListResult] + :return: An iterator like instance of either DeletedManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsmListResult"] @@ -638,34 +609,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("DeletedManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -678,17 +644,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs'} # type: ignore + @distributed_trace_async async def get_deleted( self, name: str, @@ -711,33 +679,23 @@ async def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + name=name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedManagedHsm', pipeline_response) @@ -746,8 +704,10 @@ async def get_deleted( return cls(pipeline_response, deserialized, {}) return deserialized + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}'} # type: ignore + async def _purge_deleted_initial( self, name: str, @@ -759,40 +719,31 @@ async def _purge_deleted_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._purge_deleted_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_deleted_request_initial( + name=name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + 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}/deletedManagedHSMs/{name}/purge'} # type: ignore + + @distributed_trace_async async def begin_purge_deleted( self, name: str, @@ -807,15 +758,17 @@ async def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -829,21 +782,14 @@ async def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -855,4 +801,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py index a84c039820b8..a0d98a9b2f37 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._mhsm_private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_by_resource_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list_by_resource( :param name: Name of the managed HSM Pool. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MHSMPrivateEndpointConnectionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnectionsListResult] + :return: An iterator like instance of either MHSMPrivateEndpointConnectionsListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnectionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnectionsListResult"] @@ -66,36 +74,33 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('MHSMPrivateEndpointConnectionsListResult', pipeline_response) + deserialized = self._deserialize("MHSMPrivateEndpointConnectionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +113,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -145,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) @@ -181,8 +178,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -212,33 +212,23 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') + + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -249,14 +239,17 @@ async def put( response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -269,28 +262,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -298,21 +281,25 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if response.status_code == 202: response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -331,15 +318,19 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MHSMPrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MHSMPrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -354,25 +345,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -384,4 +367,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_link_resources_operations.py index 2677eddf6853..9daa1ad31b7d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_link_resources_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._mhsm_private_link_resources_operations import build_list_by_mhsm_resource_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_mhsm_resource( self, resource_group_name: str, @@ -62,27 +67,17 @@ async def list_by_mhsm_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_mhsm_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_mhsm_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + template_url=self.list_by_mhsm_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -96,4 +91,6 @@ async def list_by_mhsm_resource( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_mhsm_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_operations.py index 35ec90d9c814..d6b329817e93 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py index 051490670aae..1c303cdf635e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_by_resource_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -106,8 +102,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -137,33 +136,23 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -174,14 +163,17 @@ async def put( 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, @@ -194,28 +186,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -223,21 +205,25 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} 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 + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -256,15 +242,19 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,25 +269,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,8 +291,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_by_resource( self, resource_group_name: str, @@ -325,8 +309,10 @@ def list_by_resource( :param vault_name: The name of the key vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -334,36 +320,33 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -381,6 +364,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_link_resources_operations.py index 5d70c3b7dc7c..47640dd16bee 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_list_by_vault_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_vault( self, resource_group_name: str, @@ -62,27 +67,17 @@ async def list_by_vault( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_vault.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_vault_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_vault.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -96,4 +91,6 @@ async def list_by_vault( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py index 74d526eb383b..ff8c4d6d1f21 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._vaults_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request, build_get_deleted_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_deleted_request, build_list_request, build_purge_deleted_request_initial, build_update_access_policy_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +139,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,8 +165,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -196,32 +194,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,8 +227,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -263,27 +254,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -296,6 +277,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -318,27 +301,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -352,8 +325,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def update_access_policy( self, resource_group_name: str, @@ -369,7 +345,8 @@ async def update_access_policy( :param vault_name: Name of the vault. :type vault_name: str :param operation_kind: Name of the operation. - :type operation_kind: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyUpdateKind + :type operation_kind: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyUpdateKind :param parameters: Access policy to merge into the vault. :type parameters: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultAccessPolicyParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -382,33 +359,23 @@ async def update_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -426,8 +393,11 @@ async def update_access_policy( 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 + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -443,7 +413,8 @@ def list_by_resource_group( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] @@ -451,37 +422,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,11 +466,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, top: Optional[int] = None, @@ -515,7 +484,8 @@ def list_by_subscription( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] @@ -523,36 +493,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -570,11 +535,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + @distributed_trace def list_deleted( self, **kwargs: Any @@ -582,8 +549,10 @@ def list_deleted( """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVaultListResult] + :return: An iterator like instance of either DeletedVaultListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] @@ -591,34 +560,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -636,11 +600,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + @distributed_trace_async async def get_deleted( self, vault_name: str, @@ -663,27 +629,17 @@ async def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -697,8 +653,10 @@ async def get_deleted( 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, @@ -710,27 +668,17 @@ async def _purge_deleted_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._purge_deleted_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -743,6 +691,8 @@ async def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + @distributed_trace_async async def begin_purge_deleted( self, vault_name: str, @@ -757,15 +707,17 @@ async def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -779,21 +731,14 @@ async def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -805,8 +750,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + @distributed_trace def list( self, top: Optional[int] = None, @@ -818,7 +765,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ResourceListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] @@ -826,38 +774,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - api_version = "2015-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceListResult', pipeline_response) + deserialized = self._deserialize("ResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -875,11 +816,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + @distributed_trace_async async def check_name_availability( self, vault_name: "_models.VaultCheckNameAvailabilityParameters", @@ -888,7 +831,8 @@ async def check_name_availability( """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. - :type vault_name: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultCheckNameAvailabilityParameters + :type vault_name: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.CheckNameAvailabilityResult @@ -899,30 +843,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -936,4 +870,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/__init__.py index 545de69a3202..880cf9b10ff8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/__init__.py @@ -6,122 +6,64 @@ # 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 DeletedManagedHsm - from ._models_py3 import DeletedManagedHsmListResult - from ._models_py3 import DeletedManagedHsmProperties - from ._models_py3 import DeletedVault - from ._models_py3 import DeletedVaultListResult - from ._models_py3 import DeletedVaultProperties - from ._models_py3 import DimensionProperties - from ._models_py3 import Error - from ._models_py3 import IPRule - from ._models_py3 import LogSpecification - from ._models_py3 import MHSMIPRule - from ._models_py3 import MHSMNetworkRuleSet - from ._models_py3 import MHSMPrivateEndpoint - from ._models_py3 import MHSMPrivateEndpointConnection - from ._models_py3 import MHSMPrivateEndpointConnectionItem - from ._models_py3 import MHSMPrivateEndpointConnectionsListResult - from ._models_py3 import MHSMPrivateLinkResource - from ._models_py3 import MHSMPrivateLinkResourceListResult - from ._models_py3 import MHSMPrivateLinkServiceConnectionState - from ._models_py3 import MHSMVirtualNetworkRule - from ._models_py3 import ManagedHsm - from ._models_py3 import ManagedHsmError - from ._models_py3 import ManagedHsmListResult - from ._models_py3 import ManagedHsmProperties - from ._models_py3 import ManagedHsmResource - from ._models_py3 import ManagedHsmSku - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkRuleSet - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Permissions - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionItem - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import Resource - from ._models_py3 import ResourceListResult - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import SystemData - from ._models_py3 import Vault - from ._models_py3 import VaultAccessPolicyParameters - from ._models_py3 import VaultAccessPolicyProperties - from ._models_py3 import VaultCheckNameAvailabilityParameters - from ._models_py3 import VaultCreateOrUpdateParameters - from ._models_py3 import VaultListResult - from ._models_py3 import VaultPatchParameters - from ._models_py3 import VaultPatchProperties - from ._models_py3 import VaultProperties - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccessPolicyEntry # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import DeletedManagedHsm # type: ignore - from ._models import DeletedManagedHsmListResult # type: ignore - from ._models import DeletedManagedHsmProperties # type: ignore - from ._models import DeletedVault # type: ignore - from ._models import DeletedVaultListResult # type: ignore - from ._models import DeletedVaultProperties # type: ignore - from ._models import DimensionProperties # type: ignore - from ._models import Error # type: ignore - from ._models import IPRule # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import MHSMIPRule # type: ignore - from ._models import MHSMNetworkRuleSet # type: ignore - from ._models import MHSMPrivateEndpoint # type: ignore - from ._models import MHSMPrivateEndpointConnection # type: ignore - from ._models import MHSMPrivateEndpointConnectionItem # type: ignore - from ._models import MHSMPrivateEndpointConnectionsListResult # type: ignore - from ._models import MHSMPrivateLinkResource # type: ignore - from ._models import MHSMPrivateLinkResourceListResult # type: ignore - from ._models import MHSMPrivateLinkServiceConnectionState # type: ignore - from ._models import MHSMVirtualNetworkRule # type: ignore - from ._models import ManagedHsm # type: ignore - from ._models import ManagedHsmError # type: ignore - from ._models import ManagedHsmListResult # type: ignore - from ._models import ManagedHsmProperties # type: ignore - from ._models import ManagedHsmResource # type: ignore - from ._models import ManagedHsmSku # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Permissions # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionItem # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceListResult # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SystemData # type: ignore - from ._models import Vault # type: ignore - from ._models import VaultAccessPolicyParameters # type: ignore - from ._models import VaultAccessPolicyProperties # type: ignore - from ._models import VaultCheckNameAvailabilityParameters # type: ignore - from ._models import VaultCreateOrUpdateParameters # type: ignore - from ._models import VaultListResult # type: ignore - from ._models import VaultPatchParameters # type: ignore - from ._models import VaultPatchProperties # type: ignore - from ._models import VaultProperties # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccessPolicyEntry +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import DeletedManagedHsm +from ._models_py3 import DeletedManagedHsmListResult +from ._models_py3 import DeletedManagedHsmProperties +from ._models_py3 import DeletedVault +from ._models_py3 import DeletedVaultListResult +from ._models_py3 import DeletedVaultProperties +from ._models_py3 import DimensionProperties +from ._models_py3 import Error +from ._models_py3 import IPRule +from ._models_py3 import LogSpecification +from ._models_py3 import MHSMIPRule +from ._models_py3 import MHSMNetworkRuleSet +from ._models_py3 import MHSMPrivateEndpoint +from ._models_py3 import MHSMPrivateEndpointConnection +from ._models_py3 import MHSMPrivateEndpointConnectionItem +from ._models_py3 import MHSMPrivateEndpointConnectionsListResult +from ._models_py3 import MHSMPrivateLinkResource +from ._models_py3 import MHSMPrivateLinkResourceListResult +from ._models_py3 import MHSMPrivateLinkServiceConnectionState +from ._models_py3 import MHSMVirtualNetworkRule +from ._models_py3 import ManagedHsm +from ._models_py3 import ManagedHsmError +from ._models_py3 import ManagedHsmListResult +from ._models_py3 import ManagedHsmProperties +from ._models_py3 import ManagedHsmResource +from ._models_py3 import ManagedHsmSku +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Permissions +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionItem +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import ResourceListResult +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SystemData +from ._models_py3 import Vault +from ._models_py3 import VaultAccessPolicyParameters +from ._models_py3 import VaultAccessPolicyProperties +from ._models_py3 import VaultCheckNameAvailabilityParameters +from ._models_py3 import VaultCreateOrUpdateParameters +from ._models_py3 import VaultListResult +from ._models_py3 import VaultPatchParameters +from ._models_py3 import VaultPatchProperties +from ._models_py3 import VaultProperties +from ._models_py3 import VirtualNetworkRule + from ._key_vault_management_client_enums import ( AccessPolicyUpdateKind, diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_key_vault_management_client_enums.py index 0464592a9d43..8d18d1a014f6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_key_vault_management_client_enums.py @@ -6,39 +6,24 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessPolicyUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class ActionsRequired(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """A message indicating if changes on the service provider require any updates on the consumer. """ NONE = "None" -class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "get" LIST = "list" @@ -57,14 +42,14 @@ class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) BACKUP = "backup" RESTORE = "restore" -class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity. """ @@ -73,7 +58,7 @@ class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -93,20 +78,20 @@ class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): PURGE = "purge" RELEASE = "release" -class ManagedHsmSkuFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU Family of the managed HSM Pool """ B = "B" -class ManagedHsmSkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU of the managed HSM Pool """ STANDARD_B1 = "Standard_B1" CUSTOM_B32 = "Custom_B32" -class NetworkRuleAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. """ @@ -114,7 +99,7 @@ class NetworkRuleAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" -class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. """ @@ -122,7 +107,7 @@ class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu AZURE_SERVICES = "AzureServices" NONE = "None" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -133,7 +118,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive FAILED = "Failed" DISCONNECTED = "Disconnected" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -142,7 +127,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state. """ @@ -163,7 +148,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The managed HSM pool is being restored from full HSM backup. RESTORING = "Restoring" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Control permission for data plane traffic coming from public networks while private endpoint is enabled. """ @@ -171,7 +156,7 @@ class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -179,7 +164,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "get" LIST = "list" @@ -190,20 +175,20 @@ class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU family name """ A = "A" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GET = "get" LIST = "list" @@ -220,7 +205,7 @@ class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GETSAS = "getsas" DELETESAS = "deletesas" -class VaultProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VaultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the vault. """ diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models.py deleted file mode 100644 index 0429c6377b26..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models.py +++ /dev/null @@ -1,2172 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AccessPolicyEntry(msrest.serialization.Model): - """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. - - All required parameters must be populated in order to send to Azure. - - :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for - authenticating requests to the key vault. - :type tenant_id: str - :param object_id: Required. The object ID of a user, service principal or security group in the - Azure Active Directory tenant for the vault. The object ID must be unique for the list of - access policies. - :type object_id: str - :param application_id: Application ID of the client making request on behalf of a principal. - :type application_id: str - :param permissions: Required. Permissions the identity has for keys, secrets and certificates. - :type permissions: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Permissions - """ - - _validation = { - 'tenant_id': {'required': True}, - 'object_id': {'required': True}, - 'permissions': {'required': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, - 'application_id': {'key': 'applicationId', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'Permissions'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessPolicyEntry, self).__init__(**kwargs) - self.tenant_id = kwargs['tenant_id'] - self.object_id = kwargs['object_id'] - self.application_id = kwargs.get('application_id', None) - self.permissions = kwargs['permissions'] - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: A boolean value that indicates whether the name is available for you to - use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.Reason - :ivar message: An error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from Key Vault resource provider. - - :param code: Error code. This is a mnemonic that can be consumed programmatically. - :type code: str - :param message: User friendly error message. The message is typically localized and may vary - with service version. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class DeletedManagedHsm(msrest.serialization.Model): - """DeletedManagedHsm. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Azure Resource Manager resource ID for the deleted managed HSM Pool. - :vartype id: str - :ivar name: The name of the managed HSM Pool. - :vartype name: str - :ivar type: The resource type of the managed HSM Pool. - :vartype type: str - :param properties: Properties of the deleted managed HSM. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsmProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'DeletedManagedHsmProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedManagedHsm, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = kwargs.get('properties', None) - - -class DeletedManagedHsmListResult(msrest.serialization.Model): - """List of deleted managed HSM Pools. - - :param value: The list of deleted managed HSM Pools. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsm] - :param next_link: The URL to get the next set of deleted managed HSM Pools. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedManagedHsm]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedManagedHsmListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class DeletedManagedHsmProperties(msrest.serialization.Model): - """Properties of the deleted managed HSM. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar mhsm_id: The resource id of the original managed HSM. - :vartype mhsm_id: str - :ivar location: The location of the original managed HSM. - :vartype location: str - :ivar deletion_date: The deleted date. - :vartype deletion_date: ~datetime.datetime - :ivar scheduled_purge_date: The scheduled purged date. - :vartype scheduled_purge_date: ~datetime.datetime - :ivar purge_protection_enabled: Purge protection status of the original managed HSM. - :vartype purge_protection_enabled: bool - :ivar tags: A set of tags. Tags of the original managed HSM. - :vartype tags: dict[str, str] - """ - - _validation = { - 'mhsm_id': {'readonly': True}, - 'location': {'readonly': True}, - 'deletion_date': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'purge_protection_enabled': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'mhsm_id': {'key': 'mhsmId', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, - 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedManagedHsmProperties, self).__init__(**kwargs) - self.mhsm_id = None - self.location = None - self.deletion_date = None - self.scheduled_purge_date = None - self.purge_protection_enabled = None - self.tags = None - - -class DeletedVault(msrest.serialization.Model): - """Deleted vault information with extended details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID for the deleted key vault. - :vartype id: str - :ivar name: The name of the key vault. - :vartype name: str - :ivar type: The resource type of the key vault. - :vartype type: str - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVaultProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedVault, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = kwargs.get('properties', None) - - -class DeletedVaultListResult(msrest.serialization.Model): - """List of vaults. - - :param value: The list of deleted vaults. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVault] - :param next_link: The URL to get the next set of deleted vaults. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedVault]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedVaultListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class DeletedVaultProperties(msrest.serialization.Model): - """Properties of the deleted vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vault_id: The resource id of the original vault. - :vartype vault_id: str - :ivar location: The location of the original vault. - :vartype location: str - :ivar deletion_date: The deleted date. - :vartype deletion_date: ~datetime.datetime - :ivar scheduled_purge_date: The scheduled purged date. - :vartype scheduled_purge_date: ~datetime.datetime - :ivar tags: A set of tags. Tags of the original vault. - :vartype tags: dict[str, str] - :ivar purge_protection_enabled: Purge protection status of the original vault. - :vartype purge_protection_enabled: bool - """ - - _validation = { - 'vault_id': {'readonly': True}, - 'location': {'readonly': True}, - 'deletion_date': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'tags': {'readonly': True}, - 'purge_protection_enabled': {'readonly': True}, - } - - _attribute_map = { - 'vault_id': {'key': 'vaultId', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedVaultProperties, self).__init__(**kwargs) - self.vault_id = None - self.location = None - self.deletion_date = None - self.scheduled_purge_date = None - self.tags = None - self.purge_protection_enabled = None - - -class DimensionProperties(msrest.serialization.Model): - """Type of operation: get, read, delete, etc. - - :param name: Name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported - for Shoebox. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DimensionProperties, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class Error(msrest.serialization.Model): - """The server error. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar inner_error: The inner error, contains a more specific error code. - :vartype inner_error: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Error - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'inner_error': {'key': 'innererror', 'type': 'Error'}, - } - - def __init__( - self, - **kwargs - ): - super(Error, self).__init__(**kwargs) - self.code = None - self.message = None - self.inner_error = None - - -class IPRule(msrest.serialization.Model): - """A rule governing the accessibility of a vault from a specific ip address or ip range. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple - IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). - :type value: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.value = kwargs['value'] - - -class LogSpecification(msrest.serialization.Model): - """Log specification of operation. - - :param name: Name of log specification. - :type name: str - :param display_name: Display name of log specification. - :type display_name: str - :param blob_duration: Blob duration of specification. - :type blob_duration: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class ManagedHsmResource(msrest.serialization.Model): - """Managed HSM resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. - :vartype id: str - :ivar name: The name of the managed HSM Pool. - :vartype name: str - :ivar type: The resource type of the managed HSM Pool. - :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the key vault - resource. - :vartype system_data: ~azure.mgmt.keyvault.v2021_04_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.system_data = None - - -class ManagedHsm(ManagedHsmResource): - """Resource information with extended details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. - :vartype id: str - :ivar name: The name of the managed HSM Pool. - :vartype name: str - :ivar type: The resource type of the managed HSM Pool. - :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the key vault - resource. - :vartype system_data: ~azure.mgmt.keyvault.v2021_04_01_preview.models.SystemData - :param properties: Properties of the managed HSM. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'ManagedHsmProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsm, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ManagedHsmError(msrest.serialization.Model): - """The error exception. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: The server error. - :vartype error: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Error - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmError, self).__init__(**kwargs) - self.error = None - - -class ManagedHsmListResult(msrest.serialization.Model): - """List of managed HSM Pools. - - :param value: The list of managed HSM Pools. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] - :param next_link: The URL to get the next set of managed HSM Pools. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedHsm]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ManagedHsmProperties(msrest.serialization.Model): - """Properties of the managed HSM Pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating - requests to the managed HSM pool. - :type tenant_id: str - :param initial_admin_object_ids: Array of initial administrators object ids for this managed - hsm pool. - :type initial_admin_object_ids: list[str] - :ivar hsm_uri: The URI of the managed hsm pool for performing operations on keys. - :vartype hsm_uri: str - :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is - enabled for this managed HSM pool. If it's not set to any value(true or false) when creating - new managed HSM pool, it will be set to true by default. Once set to true, it cannot be - reverted to false. - :type enable_soft_delete: bool - :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. - :type soft_delete_retention_in_days: int - :param enable_purge_protection: Property specifying whether protection against purge is enabled - for this managed HSM pool. Setting this property to true activates protection against purge for - this managed HSM pool and its content - only the Managed HSM service may initiate a hard, - irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling - this functionality is irreversible. - :type enable_purge_protection: bool - :param create_mode: The create mode to indicate whether the resource is being created or is - being recovered from a deleted resource. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode - :ivar status_message: Resource Status Message. - :vartype status_message: str - :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", - "Provisioning", "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", - "Restoring". - :vartype provisioning_state: str or - ~azure.mgmt.keyvault.v2021_04_01_preview.models.ProvisioningState - :param network_acls: Rules governing the accessibility of the key vault from specific network - locations. - :type network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMNetworkRuleSet - :ivar private_endpoint_connections: List of private endpoint connections associated with the - managed hsm pool. - :vartype private_endpoint_connections: - list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnectionItem] - :param public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~azure.mgmt.keyvault.v2021_04_01_preview.models.PublicNetworkAccess - :ivar scheduled_purge_date: The scheduled purge date in UTC. - :vartype scheduled_purge_date: ~datetime.datetime - """ - - _validation = { - 'hsm_uri': {'readonly': True}, - 'status_message': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'initial_admin_object_ids': {'key': 'initialAdminObjectIds', 'type': '[str]'}, - 'hsm_uri': {'key': 'hsmUri', 'type': 'str'}, - 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, - 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'status_message': {'key': 'statusMessage', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'network_acls': {'key': 'networkAcls', 'type': 'MHSMNetworkRuleSet'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[MHSMPrivateEndpointConnectionItem]'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmProperties, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.initial_admin_object_ids = kwargs.get('initial_admin_object_ids', None) - self.hsm_uri = None - self.enable_soft_delete = kwargs.get('enable_soft_delete', True) - self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', 90) - self.enable_purge_protection = kwargs.get('enable_purge_protection', True) - self.create_mode = kwargs.get('create_mode', None) - self.status_message = None - self.provisioning_state = None - self.network_acls = kwargs.get('network_acls', None) - self.private_endpoint_connections = None - self.public_network_access = kwargs.get('public_network_access', None) - self.scheduled_purge_date = None - - -class ManagedHsmSku(msrest.serialization.Model): - """SKU details. - - All required parameters must be populated in order to send to Azure. - - :param family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". - :type family: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSkuFamily - :param name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", - "Custom_B32". - :type name: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSkuName - """ - - _validation = { - 'family': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmSku, self).__init__(**kwargs) - self.family = kwargs.get('family', "B") - self.name = kwargs['name'] - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. - :type unit: str - :param aggregation_type: The metric aggregation type. Possible values include: 'Average', - 'Count', 'Total'. - :type aggregation_type: str - :param supported_aggregation_types: The supported aggregation types for the metrics. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: The supported time grain types for the metrics. - :type supported_time_grain_types: list[str] - :param lock_aggregation_type: The metric lock aggregation type. - :type lock_aggregation_type: str - :param dimensions: The dimensions of metric. - :type dimensions: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.DimensionProperties] - :param fill_gap_with_zero: Property to specify whether to fill gap with zero. - :type fill_gap_with_zero: bool - :param internal_metric_name: The internal metric name. - :type internal_metric_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.lock_aggregation_type = kwargs.get('lock_aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.internal_metric_name = kwargs.get('internal_metric_name', None) - - -class MHSMIPRule(msrest.serialization.Model): - """A rule governing the accessibility of a managed hsm pool from a specific ip address or ip range. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple - IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). - :type value: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMIPRule, self).__init__(**kwargs) - self.value = kwargs['value'] - - -class MHSMNetworkRuleSet(msrest.serialization.Model): - """A set of rules governing the network accessibility of a managed hsm pool. - - :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". - :type bypass: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and from - virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleAction - :param ip_rules: The list of IP address rules. - :type ip_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMIPRule] - :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMVirtualNetworkRule] - """ - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'ip_rules': {'key': 'ipRules', 'type': '[MHSMIPRule]'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[MHSMVirtualNetworkRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMNetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', None) - self.default_action = kwargs.get('default_action', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - - -class MHSMPrivateEndpoint(msrest.serialization.Model): - """Private endpoint object properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Full identifier of the private endpoint resource. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class MHSMPrivateEndpointConnection(ManagedHsmResource): - """Private endpoint connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. - :vartype id: str - :ivar name: The name of the managed HSM Pool. - :vartype name: str - :ivar type: The resource type of the managed HSM Pool. - :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the key vault - resource. - :vartype system_data: ~azure.mgmt.keyvault.v2021_04_01_preview.models.SystemData - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: - ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or - ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateEndpointConnection, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): - """Private endpoint connection item. - - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: - ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or - ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState - """ - - _attribute_map = { - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateEndpointConnectionItem, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class MHSMPrivateEndpointConnectionsListResult(msrest.serialization.Model): - """List of private endpoint connections associated with a managed HSM Pools. - - :param value: The private endpoint connection associated with a managed HSM Pools. - :type value: - list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection] - :param next_link: The URL to get the next set of managed HSM Pools. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MHSMPrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateEndpointConnectionsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class MHSMPrivateLinkResource(ManagedHsmResource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. - :vartype id: str - :ivar name: The name of the managed HSM Pool. - :vartype name: str - :ivar type: The resource type of the managed HSM Pool. - :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the key vault - resource. - :vartype system_data: ~azure.mgmt.keyvault.v2021_04_01_preview.models.SystemData - :ivar group_id: Group identifier of private link resource. - :vartype group_id: str - :ivar required_members: Required member names of private link resource. - :vartype required_members: list[str] - :param required_zone_names: Required DNS zone names of the the private link resource. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class MHSMPrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MHSMPrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): - """An object that represents the approval state of the private link connection. - - :param status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or - ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval or rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". - :type actions_required: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ActionsRequired - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class MHSMVirtualNetworkRule(msrest.serialization.Model): - """A rule governing the accessibility of a managed hsm pool from a specific virtual network. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMVirtualNetworkRule, self).__init__(**kwargs) - self.id = kwargs['id'] - - -class NetworkRuleSet(msrest.serialization.Model): - """A set of rules governing the network accessibility of a vault. - - :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". - :type bypass: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and from - virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleAction - :param ip_rules: The list of IP address rules. - :type ip_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.IPRule] - :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.keyvault.v2021_04_01_preview.models.VirtualNetworkRule] - """ - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', None) - self.default_action = kwargs.get('default_action', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - - -class Operation(msrest.serialization.Model): - """Key Vault REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.keyvault.v2021_04_01_preview.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param is_data_action: Property to specify whether the action is a data action. - :type is_data_action: bool - :param service_specification: One property of operation, include metric specifications. - :type service_specification: - ~azure.mgmt.keyvault.v2021_04_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Key Vault. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.Operation] - :param next_link: The URL to get the next set of operations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class Permissions(msrest.serialization.Model): - """Permissions the identity has for keys, secrets, certificates and storage. - - :param keys: Permissions to keys. - :type keys: list[str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.KeyPermissions] - :param secrets: Permissions to secrets. - :type secrets: list[str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SecretPermissions] - :param certificates: Permissions to certificates. - :type certificates: list[str or - ~azure.mgmt.keyvault.v2021_04_01_preview.models.CertificatePermissions] - :param storage: Permissions to storage accounts. - :type storage: list[str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.StoragePermissions] - """ - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[str]'}, - 'secrets': {'key': 'secrets', 'type': '[str]'}, - 'certificates': {'key': 'certificates', 'type': '[str]'}, - 'storage': {'key': 'storage', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Permissions, self).__init__(**kwargs) - self.keys = kwargs.get('keys', None) - self.secrets = kwargs.get('secrets', None) - self.certificates = kwargs.get('certificates', None) - self.storage = kwargs.get('storage', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """Private endpoint object properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Full identifier of the private endpoint resource. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class Resource(msrest.serialization.Model): - """Key Vault resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None - - -class PrivateEndpointConnection(Resource): - """Private endpoint connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: - ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or - ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class PrivateEndpointConnectionItem(msrest.serialization.Model): - """Private endpoint connection item. - - :param id: Id of private endpoint connection. - :type id: str - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: - ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or - ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.etag = kwargs.get('etag', None) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """List of private endpoint connections. - - :param value: The list of private endpoint connections. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection] - :param next_link: The URL to get the next set of private endpoint connections. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :ivar group_id: Group identifier of private link resource. - :vartype group_id: str - :ivar required_members: Required member names of private link resource. - :vartype required_members: list[str] - :param required_zone_names: Required DNS zone names of the the private link resource. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """An object that represents the approval state of the private link connection. - - :param status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or - ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval or rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". - :type actions_required: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ActionsRequired - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class ResourceListResult(msrest.serialization.Model): - """List of vault resources. - - :param value: The list of vault resources. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.Resource] - :param next_link: The URL to get the next set of vault resources. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Resource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include log specifications. - - :param log_specifications: Log specifications of operation. - :type log_specifications: - list[~azure.mgmt.keyvault.v2021_04_01_preview.models.LogSpecification] - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: - list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MetricSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """SKU details. - - All required parameters must be populated in order to send to Azure. - - :param family: Required. SKU family name. Possible values include: "A". - :type family: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SkuFamily - :param name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". - :type name: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SkuName - """ - - _validation = { - 'family': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.family = kwargs.get('family', "A") - self.name = kwargs['name'] - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the key vault resource. - - :param created_by: The identity that created the key vault resource. - :type created_by: str - :param created_by_type: The type of identity that created the key vault resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.IdentityType - :param created_at: The timestamp of the key vault resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the key vault resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the key vault resource. - Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.keyvault.v2021_04_01_preview.models.IdentityType - :param last_modified_at: The timestamp of the key vault resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Vault(msrest.serialization.Model): - """Resource information with extended details. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :param location: Azure location of the key vault resource. - :type location: str - :param tags: A set of tags. Tags assigned to the key vault resource. - :type tags: dict[str, str] - :ivar system_data: System metadata for the key vault. - :vartype system_data: ~azure.mgmt.keyvault.v2021_04_01_preview.models.SystemData - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'VaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Vault, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.system_data = None - self.properties = kwargs['properties'] - - -class VaultAccessPolicyParameters(msrest.serialization.Model): - """Parameters for updating the access policy in a vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource id of the access policy. - :vartype id: str - :ivar name: The resource name of the access policy. - :vartype name: str - :ivar type: The resource name of the access policy. - :vartype type: str - :ivar location: The resource type of the access policy. - :vartype location: str - :param properties: Required. Properties of the access policy. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultAccessPolicyProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultAccessPolicyParameters, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.properties = kwargs['properties'] - - -class VaultAccessPolicyProperties(msrest.serialization.Model): - """Properties of the vault access policy. - - All required parameters must be populated in order to send to Azure. - - :param access_policies: Required. An array of 0 to 16 identities that have access to the key - vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. - :type access_policies: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyEntry] - """ - - _validation = { - 'access_policies': {'required': True}, - } - - _attribute_map = { - 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultAccessPolicyProperties, self).__init__(**kwargs) - self.access_policies = kwargs['access_policies'] - - -class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the vault name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The vault name. - :type name: str - :ivar type: The type of resource, Microsoft.KeyVault/vaults. Has constant value: - "Microsoft.KeyVault/vaults". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.KeyVault/vaults" - - def __init__( - self, - **kwargs - ): - super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class VaultCreateOrUpdateParameters(msrest.serialization.Model): - """Parameters for creating or updating a vault. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. The supported Azure location where the key vault should be created. - :type location: str - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProperties - """ - - _validation = { - 'location': {'required': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'VaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.properties = kwargs['properties'] - - -class VaultListResult(msrest.serialization.Model): - """List of vaults. - - :param value: The list of vaults. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault] - :param next_link: The URL to get the next set of vaults. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Vault]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class VaultPatchParameters(msrest.serialization.Model): - """Parameters for creating or updating a vault. - - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultPatchProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultPatchParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) - - -class VaultPatchProperties(msrest.serialization.Model): - """Properties of the vault. - - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating - requests to the key vault. - :type tenant_id: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to the key vault. All - identities in the array must use the same tenant ID as the key vault's tenant ID. - :type access_policies: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyEntry] - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted - to retrieve certificates stored as secrets from the key vault. - :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is - permitted to retrieve secrets from the vault and unwrap keys. - :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is - permitted to retrieve secrets from the key vault. - :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is - enabled for this key vault. Once set to true, it cannot be reverted to false. - :type enable_soft_delete: bool - :param enable_rbac_authorization: Property that controls how data actions are authorized. When - true, the key vault will use Role Based Access Control (RBAC) for authorization of data - actions, and the access policies specified in vault properties will be ignored. When false, - the key vault will use the access policies specified in vault properties, and any policy stored - on Azure Resource Manager will be ignored. If null or not specified, the value of this property - will not change. - :type enable_rbac_authorization: bool - :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. - :type soft_delete_retention_in_days: int - :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode - :param enable_purge_protection: Property specifying whether protection against purge is enabled - for this vault. Setting this property to true activates protection against purge for this vault - and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this functionality is - irreversible - that is, the property does not accept false as its value. - :type enable_purge_protection: bool - :param network_acls: A collection of rules governing the accessibility of the vault from - specific network locations. - :type network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleSet - """ - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, - 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, - 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, - 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, - 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, - 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, - 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultPatchProperties, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.sku = kwargs.get('sku', None) - self.access_policies = kwargs.get('access_policies', None) - self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) - self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) - self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) - self.enable_soft_delete = kwargs.get('enable_soft_delete', None) - self.enable_rbac_authorization = kwargs.get('enable_rbac_authorization', None) - self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', None) - self.create_mode = kwargs.get('create_mode', None) - self.enable_purge_protection = kwargs.get('enable_purge_protection', None) - self.network_acls = kwargs.get('network_acls', None) - - -class VaultProperties(msrest.serialization.Model): - """Properties of the vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for - authenticating requests to the key vault. - :type tenant_id: str - :param sku: Required. SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Sku - :param access_policies: An array of 0 to 1024 identities that have access to the key vault. All - identities in the array must use the same tenant ID as the key vault's tenant ID. When - ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access - policies are required. - :type access_policies: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. - :type vault_uri: str - :ivar hsm_pool_resource_id: The resource id of HSM Pool. - :vartype hsm_pool_resource_id: str - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted - to retrieve certificates stored as secrets from the key vault. - :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is - permitted to retrieve secrets from the vault and unwrap keys. - :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is - permitted to retrieve secrets from the key vault. - :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is - enabled for this key vault. If it's not set to any value(true or false) when creating new key - vault, it will be set to true by default. Once set to true, it cannot be reverted to false. - :type enable_soft_delete: bool - :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. - :type soft_delete_retention_in_days: int - :param enable_rbac_authorization: Property that controls how data actions are authorized. When - true, the key vault will use Role Based Access Control (RBAC) for authorization of data - actions, and the access policies specified in vault properties will be ignored. When false, - the key vault will use the access policies specified in vault properties, and any policy stored - on Azure Resource Manager will be ignored. If null or not specified, the vault is created with - the default value of false. Note that management actions are always authorized with RBAC. - :type enable_rbac_authorization: bool - :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode - :param enable_purge_protection: Property specifying whether protection against purge is enabled - for this vault. Setting this property to true activates protection against purge for this vault - and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this functionality is - irreversible - that is, the property does not accept false as its value. - :type enable_purge_protection: bool - :param network_acls: Rules governing the accessibility of the key vault from specific network - locations. - :type network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleSet - :param provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". - :type provisioning_state: str or - ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProvisioningState - :ivar private_endpoint_connections: List of private endpoint connections associated with the - key vault. - :vartype private_endpoint_connections: - list[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionItem] - """ - - _validation = { - 'tenant_id': {'required': True}, - 'sku': {'required': True}, - 'hsm_pool_resource_id': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, - 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, - 'hsm_pool_resource_id': {'key': 'hsmPoolResourceId', 'type': 'str'}, - 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, - 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, - 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, - 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, - 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, - 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultProperties, self).__init__(**kwargs) - self.tenant_id = kwargs['tenant_id'] - self.sku = kwargs['sku'] - self.access_policies = kwargs.get('access_policies', None) - self.vault_uri = kwargs.get('vault_uri', None) - self.hsm_pool_resource_id = None - self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) - self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) - self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) - self.enable_soft_delete = kwargs.get('enable_soft_delete', True) - self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', 90) - self.enable_rbac_authorization = kwargs.get('enable_rbac_authorization', False) - self.create_mode = kwargs.get('create_mode', None) - self.enable_purge_protection = kwargs.get('enable_purge_protection', None) - self.network_acls = kwargs.get('network_acls', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.private_endpoint_connections = None - - -class VirtualNetworkRule(msrest.serialization.Model): - """A rule governing the accessibility of a vault from a specific virtual network. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - :type id: str - :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the - check if parent subnet has serviceEndpoints configured. - :type ignore_missing_vnet_service_endpoint: bool - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.id = kwargs['id'] - self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models_py3.py index 21aef4343116..38c115cdb291 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models_py3.py @@ -20,17 +20,17 @@ class AccessPolicyEntry(msrest.serialization.Model): 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 + :ivar 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 + :vartype tenant_id: str + :ivar object_id: Required. The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID must be unique for the list of access policies. - :type object_id: str - :param application_id: Application ID of the client making request on behalf of a principal. - :type application_id: str - :param permissions: Required. Permissions the identity has for keys, secrets and certificates. - :type permissions: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Permissions + :vartype object_id: str + :ivar application_id: Application ID of the client making request on behalf of a principal. + :vartype application_id: str + :ivar permissions: Required. Permissions the identity has for keys, secrets and certificates. + :vartype permissions: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Permissions """ _validation = { @@ -55,6 +55,20 @@ def __init__( application_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword 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. + :paramtype object_id: str + :keyword application_id: Application ID of the client making request on behalf of a principal. + :paramtype application_id: str + :keyword permissions: Required. Permissions the identity has for keys, secrets and + certificates. + :paramtype permissions: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Permissions + """ super(AccessPolicyEntry, self).__init__(**kwargs) self.tenant_id = tenant_id self.object_id = object_id @@ -95,6 +109,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -104,11 +120,11 @@ def __init__( 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 + :ivar code: Error code. This is a mnemonic that can be consumed programmatically. + :vartype code: str + :ivar message: User friendly error message. The message is typically localized and may vary with service version. - :type message: str + :vartype message: str """ _attribute_map = { @@ -123,6 +139,13 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Error code. This is a mnemonic that can be consumed programmatically. + :paramtype code: str + :keyword message: User friendly error message. The message is typically localized and may vary + with service version. + :paramtype message: str + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -139,8 +162,9 @@ class DeletedManagedHsm(msrest.serialization.Model): :vartype name: str :ivar type: The resource type of the managed HSM Pool. :vartype type: str - :param properties: Properties of the deleted managed HSM. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsmProperties + :ivar properties: Properties of the deleted managed HSM. + :vartype properties: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsmProperties """ _validation = { @@ -162,6 +186,11 @@ def __init__( properties: Optional["DeletedManagedHsmProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the deleted managed HSM. + :paramtype properties: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsmProperties + """ super(DeletedManagedHsm, self).__init__(**kwargs) self.id = None self.name = None @@ -172,10 +201,10 @@ def __init__( class DeletedManagedHsmListResult(msrest.serialization.Model): """List of deleted managed HSM Pools. - :param value: The list of deleted managed HSM Pools. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsm] - :param next_link: The URL to get the next set of deleted managed HSM Pools. - :type next_link: str + :ivar value: The list of deleted managed HSM Pools. + :vartype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsm] + :ivar next_link: The URL to get the next set of deleted managed HSM Pools. + :vartype next_link: str """ _attribute_map = { @@ -190,6 +219,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of deleted managed HSM Pools. + :paramtype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsm] + :keyword next_link: The URL to get the next set of deleted managed HSM Pools. + :paramtype next_link: str + """ super(DeletedManagedHsmListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -236,6 +271,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedManagedHsmProperties, self).__init__(**kwargs) self.mhsm_id = None self.location = None @@ -256,8 +293,8 @@ class DeletedVault(msrest.serialization.Model): :vartype name: str :ivar type: The resource type of the key vault. :vartype type: str - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVaultProperties + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVaultProperties """ _validation = { @@ -279,6 +316,10 @@ def __init__( properties: Optional["DeletedVaultProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVaultProperties + """ super(DeletedVault, self).__init__(**kwargs) self.id = None self.name = None @@ -289,10 +330,10 @@ def __init__( class DeletedVaultListResult(msrest.serialization.Model): """List of vaults. - :param value: The list of deleted vaults. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVault] - :param next_link: The URL to get the next set of deleted vaults. - :type next_link: str + :ivar value: The list of deleted vaults. + :vartype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVault] + :ivar next_link: The URL to get the next set of deleted vaults. + :vartype next_link: str """ _attribute_map = { @@ -307,6 +348,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of deleted vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVault] + :keyword next_link: The URL to get the next set of deleted vaults. + :paramtype next_link: str + """ super(DeletedVaultListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -353,6 +400,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -365,13 +414,13 @@ def __init__( class DimensionProperties(msrest.serialization.Model): """Type of operation: get, read, delete, etc. - :param name: Name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported + :ivar name: Name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Property to specify whether the dimension should be exported for Shoebox. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -388,6 +437,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Property to specify whether the dimension should be + exported for Shoebox. + :paramtype to_be_exported_for_shoebox: bool + """ super(DimensionProperties, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -423,6 +481,8 @@ def __init__( self, **kwargs ): + """ + """ super(Error, self).__init__(**kwargs) self.code = None self.message = None @@ -434,9 +494,9 @@ class IPRule(msrest.serialization.Model): 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 + :ivar 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 + :vartype value: str """ _validation = { @@ -453,6 +513,11 @@ def __init__( value: str, **kwargs ): + """ + :keyword 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). + :paramtype value: str + """ super(IPRule, self).__init__(**kwargs) self.value = value @@ -460,12 +525,12 @@ def __init__( 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 + :ivar name: Name of log specification. + :vartype name: str + :ivar display_name: Display name of log specification. + :vartype display_name: str + :ivar blob_duration: Blob duration of specification. + :vartype blob_duration: str """ _attribute_map = { @@ -482,6 +547,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of log specification. + :paramtype name: str + :keyword display_name: Display name of log specification. + :paramtype display_name: str + :keyword blob_duration: Blob duration of specification. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -499,12 +572,12 @@ class ManagedHsmResource(msrest.serialization.Model): :vartype name: str :ivar type: The resource type of the managed HSM Pool. :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the key vault resource. :vartype system_data: ~azure.mgmt.keyvault.v2021_04_01_preview.models.SystemData @@ -535,6 +608,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ManagedHsmResource, self).__init__(**kwargs) self.id = None self.name = None @@ -556,17 +637,17 @@ class ManagedHsm(ManagedHsmResource): :vartype name: str :ivar type: The resource type of the managed HSM Pool. :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the key vault resource. :vartype system_data: ~azure.mgmt.keyvault.v2021_04_01_preview.models.SystemData - :param properties: Properties of the managed HSM. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmProperties + :ivar properties: Properties of the managed HSM. + :vartype properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmProperties """ _validation = { @@ -596,6 +677,16 @@ def __init__( properties: Optional["ManagedHsmProperties"] = None, **kwargs ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the managed HSM. + :paramtype properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmProperties + """ super(ManagedHsm, self).__init__(location=location, sku=sku, tags=tags, **kwargs) self.properties = properties @@ -621,6 +712,8 @@ def __init__( self, **kwargs ): + """ + """ super(ManagedHsmError, self).__init__(**kwargs) self.error = None @@ -628,10 +721,10 @@ def __init__( class ManagedHsmListResult(msrest.serialization.Model): """List of managed HSM Pools. - :param value: The list of managed HSM Pools. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] - :param next_link: The URL to get the next set of managed HSM Pools. - :type next_link: str + :ivar value: The list of managed HSM Pools. + :vartype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] + :ivar next_link: The URL to get the next set of managed HSM Pools. + :vartype next_link: str """ _attribute_map = { @@ -646,6 +739,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of managed HSM Pools. + :paramtype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] + :keyword next_link: The URL to get the next set of managed HSM Pools. + :paramtype next_link: str + """ super(ManagedHsmListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -656,30 +755,30 @@ class ManagedHsmProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + :ivar tenant_id: The Azure Active Directory tenant ID that should be used for authenticating requests to the managed HSM pool. - :type tenant_id: str - :param initial_admin_object_ids: Array of initial administrators object ids for this managed - hsm pool. - :type initial_admin_object_ids: list[str] + :vartype tenant_id: str + :ivar initial_admin_object_ids: Array of initial administrators object ids for this managed hsm + pool. + :vartype initial_admin_object_ids: list[str] :ivar hsm_uri: The URI of the managed hsm pool for performing operations on keys. :vartype hsm_uri: str - :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + :ivar enable_soft_delete: Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. If it's not set to any value(true or false) when creating new managed HSM pool, it will be set to true by default. Once set to true, it cannot be reverted to false. - :type enable_soft_delete: bool - :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. - :type soft_delete_retention_in_days: int - :param enable_purge_protection: Property specifying whether protection against purge is enabled + :vartype enable_soft_delete: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this managed HSM pool. Setting this property to true activates protection against purge for this managed HSM pool and its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling this functionality is irreversible. - :type enable_purge_protection: bool - :param create_mode: The create mode to indicate whether the resource is being created or is + :vartype enable_purge_protection: bool + :ivar create_mode: The create mode to indicate whether the resource is being created or is being recovered from a deleted resource. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode + :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode :ivar status_message: Resource Status Message. :vartype status_message: str :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", @@ -687,16 +786,16 @@ class ManagedHsmProperties(msrest.serialization.Model): "Restoring". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ProvisioningState - :param network_acls: Rules governing the accessibility of the key vault from specific network + :ivar network_acls: Rules governing the accessibility of the key vault from specific network locations. - :type network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMNetworkRuleSet + :vartype network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMNetworkRuleSet :ivar private_endpoint_connections: List of private endpoint connections associated with the managed hsm pool. :vartype private_endpoint_connections: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnectionItem] - :param public_network_access: Control permission for data plane traffic coming from public + :ivar public_network_access: Control permission for data plane traffic coming from public networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or + :vartype public_network_access: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PublicNetworkAccess :ivar scheduled_purge_date: The scheduled purge date in UTC. :vartype scheduled_purge_date: ~datetime.datetime @@ -739,6 +838,38 @@ def __init__( public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, **kwargs ): + """ + :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the managed HSM pool. + :paramtype tenant_id: str + :keyword initial_admin_object_ids: Array of initial administrators object ids for this managed + hsm pool. + :paramtype initial_admin_object_ids: list[str] + :keyword enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this managed HSM pool. If it's not set to any value(true or false) when creating + new managed HSM pool, it will be set to true by default. Once set to true, it cannot be + reverted to false. + :paramtype enable_soft_delete: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword enable_purge_protection: Property specifying whether protection against purge is + enabled for this managed HSM pool. Setting this property to true activates protection against + purge for this managed HSM pool and its content - only the Managed HSM service may initiate a + hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. + Enabling this functionality is irreversible. + :paramtype enable_purge_protection: bool + :keyword create_mode: The create mode to indicate whether the resource is being created or is + being recovered from a deleted resource. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode + :keyword network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMNetworkRuleSet + :keyword public_network_access: Control permission for data plane traffic coming from public + networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.PublicNetworkAccess + """ super(ManagedHsmProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.initial_admin_object_ids = initial_admin_object_ids @@ -760,11 +891,11 @@ class ManagedHsmSku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". - :type family: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSkuFamily - :param name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + :ivar family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :vartype family: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSkuFamily + :ivar name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", "Custom_B32". - :type name: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSkuName + :vartype name: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSkuName """ _validation = { @@ -784,6 +915,13 @@ def __init__( name: Union[str, "ManagedHsmSkuName"], **kwargs ): + """ + :keyword family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :paramtype family: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSkuFamily + :keyword name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + "Custom_B32". + :paramtype name: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSkuName + """ super(ManagedHsmSku, self).__init__(**kwargs) self.family = family self.name = name @@ -792,29 +930,29 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. - :type unit: str - :param aggregation_type: The metric aggregation type. Possible values include: 'Average', + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :vartype unit: str + :ivar aggregation_type: The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'. - :type aggregation_type: str - :param supported_aggregation_types: The supported aggregation types for the metrics. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: The supported time grain types for the metrics. - :type supported_time_grain_types: list[str] - :param lock_aggregation_type: The metric lock aggregation type. - :type lock_aggregation_type: str - :param dimensions: The dimensions of metric. - :type dimensions: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.DimensionProperties] - :param fill_gap_with_zero: Property to specify whether to fill gap with zero. - :type fill_gap_with_zero: bool - :param internal_metric_name: The internal metric name. - :type internal_metric_name: str + :vartype aggregation_type: str + :ivar supported_aggregation_types: The supported aggregation types for the metrics. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: The supported time grain types for the metrics. + :vartype supported_time_grain_types: list[str] + :ivar lock_aggregation_type: The metric lock aggregation type. + :vartype lock_aggregation_type: str + :ivar dimensions: The dimensions of metric. + :vartype dimensions: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.DimensionProperties] + :ivar fill_gap_with_zero: Property to specify whether to fill gap with zero. + :vartype fill_gap_with_zero: bool + :ivar internal_metric_name: The internal metric name. + :vartype internal_metric_name: str """ _attribute_map = { @@ -847,6 +985,32 @@ def __init__( internal_metric_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :paramtype unit: str + :keyword aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: The supported aggregation types for the metrics. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: The supported time grain types for the metrics. + :paramtype supported_time_grain_types: list[str] + :keyword lock_aggregation_type: The metric lock aggregation type. + :paramtype lock_aggregation_type: str + :keyword dimensions: The dimensions of metric. + :paramtype dimensions: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.DimensionProperties] + :keyword fill_gap_with_zero: Property to specify whether to fill gap with zero. + :paramtype fill_gap_with_zero: bool + :keyword internal_metric_name: The internal metric name. + :paramtype internal_metric_name: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -866,9 +1030,9 @@ class MHSMIPRule(msrest.serialization.Model): 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 + :ivar 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 + :vartype value: str """ _validation = { @@ -885,6 +1049,11 @@ def __init__( value: str, **kwargs ): + """ + :keyword 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). + :paramtype value: str + """ super(MHSMIPRule, self).__init__(**kwargs) self.value = value @@ -892,18 +1061,20 @@ def __init__( class MHSMNetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a managed hsm pool. - :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: "AzureServices", "None". - :type bypass: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and from - virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleAction - :param ip_rules: The list of IP address rules. - :type ip_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMIPRule] - :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: + :vartype bypass: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleBypassOptions + :ivar 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". + :vartype default_action: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleAction + :ivar ip_rules: The list of IP address rules. + :vartype ip_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMIPRule] + :ivar virtual_network_rules: The list of virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMVirtualNetworkRule] """ @@ -923,6 +1094,23 @@ def __init__( virtual_network_rules: Optional[List["MHSMVirtualNetworkRule"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype bypass: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleBypassOptions + :keyword 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". + :paramtype default_action: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleAction + :keyword ip_rules: The list of IP address rules. + :paramtype ip_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMIPRule] + :keyword virtual_network_rules: The list of virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMVirtualNetworkRule] + """ super(MHSMNetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.default_action = default_action @@ -951,6 +1139,8 @@ def __init__( self, **kwargs ): + """ + """ super(MHSMPrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -966,25 +1156,25 @@ class MHSMPrivateEndpointConnection(ManagedHsmResource): :vartype name: str :ivar type: The resource type of the managed HSM Pool. :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the key vault resource. :vartype system_data: ~azure.mgmt.keyvault.v2021_04_01_preview.models.SystemData - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1021,6 +1211,26 @@ def __init__( provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkServiceConnectionState + :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState + """ super(MHSMPrivateEndpointConnection, self).__init__(location=location, sku=sku, tags=tags, **kwargs) self.etag = etag self.private_endpoint = private_endpoint @@ -1031,14 +1241,14 @@ def __init__( class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): """Private endpoint connection item. - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1056,6 +1266,18 @@ def __init__( provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): + """ + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkServiceConnectionState + :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState + """ super(MHSMPrivateEndpointConnectionItem, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -1065,11 +1287,11 @@ def __init__( class MHSMPrivateEndpointConnectionsListResult(msrest.serialization.Model): """List of private endpoint connections associated with a managed HSM Pools. - :param value: The private endpoint connection associated with a managed HSM Pools. - :type value: + :ivar value: The private endpoint connection associated with a managed HSM Pools. + :vartype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection] - :param next_link: The URL to get the next set of managed HSM Pools. - :type next_link: str + :ivar next_link: The URL to get the next set of managed HSM Pools. + :vartype next_link: str """ _attribute_map = { @@ -1084,6 +1306,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The private endpoint connection associated with a managed HSM Pools. + :paramtype value: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection] + :keyword next_link: The URL to get the next set of managed HSM Pools. + :paramtype next_link: str + """ super(MHSMPrivateEndpointConnectionsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1100,12 +1329,12 @@ class MHSMPrivateLinkResource(ManagedHsmResource): :vartype name: str :ivar type: The resource type of the managed HSM Pool. :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the key vault resource. :vartype system_data: ~azure.mgmt.keyvault.v2021_04_01_preview.models.SystemData @@ -1113,8 +1342,8 @@ class MHSMPrivateLinkResource(ManagedHsmResource): :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] + :ivar required_zone_names: Required DNS zone names of the the private link resource. + :vartype required_zone_names: list[str] """ _validation = { @@ -1148,6 +1377,16 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword required_zone_names: Required DNS zone names of the the private link resource. + :paramtype required_zone_names: list[str] + """ super(MHSMPrivateLinkResource, self).__init__(location=location, sku=sku, tags=tags, **kwargs) self.group_id = None self.required_members = None @@ -1157,8 +1396,8 @@ def __init__( class MHSMPrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkResource] """ _attribute_map = { @@ -1171,6 +1410,10 @@ def __init__( value: Optional[List["MHSMPrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkResource] + """ super(MHSMPrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -1178,15 +1421,16 @@ def __init__( class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. - :param status: Indicates whether the connection has been approved, rejected or removed by the + :ivar 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 + :vartype status: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval or rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval or rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. Possible values include: "None". - :type actions_required: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ActionsRequired + :vartype actions_required: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.ActionsRequired """ _attribute_map = { @@ -1203,6 +1447,18 @@ def __init__( actions_required: Optional[Union[str, "ActionsRequired"]] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval or rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None". + :paramtype actions_required: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.ActionsRequired + """ super(MHSMPrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -1214,9 +1470,9 @@ class MHSMVirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. Full resource id of a vnet subnet, such as + :ivar 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 + :vartype id: str """ _validation = { @@ -1233,6 +1489,11 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :paramtype id: str + """ super(MHSMVirtualNetworkRule, self).__init__(**kwargs) self.id = id @@ -1240,18 +1501,20 @@ def __init__( 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 + :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: "AzureServices", "None". - :type bypass: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and from - virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleAction - :param ip_rules: The list of IP address rules. - :type ip_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.IPRule] - :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: + :vartype bypass: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleBypassOptions + :ivar 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". + :vartype default_action: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleAction + :ivar ip_rules: The list of IP address rules. + :vartype ip_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.IPRule] + :ivar virtual_network_rules: The list of virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.VirtualNetworkRule] """ @@ -1271,6 +1534,23 @@ def __init__( virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype bypass: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleBypassOptions + :keyword 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". + :paramtype default_action: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleAction + :keyword ip_rules: The list of IP address rules. + :paramtype ip_rules: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.IPRule] + :keyword virtual_network_rules: The list of virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.VirtualNetworkRule] + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.default_action = default_action @@ -1281,16 +1561,16 @@ def __init__( class Operation(msrest.serialization.Model): """Key Vault REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.keyvault.v2021_04_01_preview.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param is_data_action: Property to specify whether the action is a data action. - :type is_data_action: bool - :param service_specification: One property of operation, include metric specifications. - :type service_specification: + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.keyvault.v2021_04_01_preview.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar is_data_action: Property to specify whether the action is a data action. + :vartype is_data_action: bool + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ServiceSpecification """ @@ -1312,6 +1592,19 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.keyvault.v2021_04_01_preview.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword is_data_action: Property to specify whether the action is a data action. + :paramtype is_data_action: bool + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1323,14 +1616,14 @@ def __init__( 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 + :ivar provider: Service provider: Microsoft Key Vault. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of operation. + :vartype description: str """ _attribute_map = { @@ -1349,6 +1642,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Key Vault. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1359,10 +1662,10 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.Operation] - :param next_link: The URL to get the next set of operations. - :type next_link: str + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.Operation] + :ivar next_link: The URL to get the next set of operations. + :vartype next_link: str """ _attribute_map = { @@ -1377,6 +1680,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.Operation] + :keyword next_link: The URL to get the next set of operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1385,15 +1694,17 @@ def __init__( class Permissions(msrest.serialization.Model): """Permissions the identity has for keys, secrets, certificates and storage. - :param keys: Permissions to keys. - :type keys: list[str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.KeyPermissions] - :param secrets: Permissions to secrets. - :type secrets: list[str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SecretPermissions] - :param certificates: Permissions to certificates. - :type certificates: list[str or + :ivar keys: Permissions to keys. + :vartype keys: list[str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.KeyPermissions] + :ivar secrets: Permissions to secrets. + :vartype secrets: list[str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.SecretPermissions] + :ivar certificates: Permissions to certificates. + :vartype certificates: list[str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CertificatePermissions] - :param storage: Permissions to storage accounts. - :type storage: list[str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.StoragePermissions] + :ivar storage: Permissions to storage accounts. + :vartype storage: list[str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.StoragePermissions] """ _attribute_map = { @@ -1412,6 +1723,19 @@ def __init__( storage: Optional[List[Union[str, "StoragePermissions"]]] = None, **kwargs ): + """ + :keyword keys: Permissions to keys. + :paramtype keys: list[str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.KeyPermissions] + :keyword secrets: Permissions to secrets. + :paramtype secrets: list[str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.SecretPermissions] + :keyword certificates: Permissions to certificates. + :paramtype certificates: list[str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.CertificatePermissions] + :keyword storage: Permissions to storage accounts. + :paramtype storage: list[str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.StoragePermissions] + """ super(Permissions, self).__init__(**kwargs) self.keys = keys self.secrets = secrets @@ -1440,6 +1764,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1481,6 +1807,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -1504,16 +1832,16 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1546,6 +1874,19 @@ def __init__( provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): + """ + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkServiceConnectionState + :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.etag = etag self.private_endpoint = private_endpoint @@ -1556,18 +1897,18 @@ def __init__( class PrivateEndpointConnectionItem(msrest.serialization.Model): """Private endpoint connection item. - :param id: Id of private endpoint connection. - :type id: str - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: + :ivar id: Id of private endpoint connection. + :vartype id: str + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1589,6 +1930,21 @@ def __init__( provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): + """ + :keyword id: Id of private endpoint connection. + :paramtype id: str + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkServiceConnectionState + :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState + """ super(PrivateEndpointConnectionItem, self).__init__(**kwargs) self.id = id self.etag = etag @@ -1600,10 +1956,10 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """List of private endpoint connections. - :param value: The list of private endpoint connections. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection] - :param next_link: The URL to get the next set of private endpoint connections. - :type next_link: str + :ivar value: The list of private endpoint connections. + :vartype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection] + :ivar next_link: The URL to get the next set of private endpoint connections. + :vartype next_link: str """ _attribute_map = { @@ -1618,6 +1974,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of private endpoint connections. + :paramtype value: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection] + :keyword next_link: The URL to get the next set of private endpoint connections. + :paramtype next_link: str + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1642,8 +2005,8 @@ class PrivateLinkResource(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] + :ivar required_zone_names: Required DNS zone names of the the private link resource. + :vartype required_zone_names: list[str] """ _validation = { @@ -1673,6 +2036,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: Required DNS zone names of the the private link resource. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -1682,8 +2049,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkResource] """ _attribute_map = { @@ -1696,6 +2063,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -1703,15 +2074,16 @@ def __init__( 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 + :ivar 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 + :vartype status: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval or rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval or rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. Possible values include: "None". - :type actions_required: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ActionsRequired + :vartype actions_required: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.ActionsRequired """ _attribute_map = { @@ -1728,6 +2100,18 @@ def __init__( actions_required: Optional[Union[str, "ActionsRequired"]] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval or rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None". + :paramtype actions_required: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.ActionsRequired + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -1737,10 +2121,10 @@ def __init__( class ResourceListResult(msrest.serialization.Model): """List of vault resources. - :param value: The list of vault resources. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.Resource] - :param next_link: The URL to get the next set of vault resources. - :type next_link: str + :ivar value: The list of vault resources. + :vartype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.Resource] + :ivar next_link: The URL to get the next set of vault resources. + :vartype next_link: str """ _attribute_map = { @@ -1755,6 +2139,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of vault resources. + :paramtype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.Resource] + :keyword next_link: The URL to get the next set of vault resources. + :paramtype next_link: str + """ super(ResourceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1763,11 +2153,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include log specifications. - :param log_specifications: Log specifications of operation. - :type log_specifications: + :ivar log_specifications: Log specifications of operation. + :vartype log_specifications: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.LogSpecification] - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MetricSpecification] """ @@ -1783,6 +2173,14 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Log specifications of operation. + :paramtype log_specifications: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.LogSpecification] + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -1793,11 +2191,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param family: Required. SKU family name. Possible values include: "A". - :type family: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SkuFamily - :param name: Required. SKU name to specify whether the key vault is a standard vault or a + :ivar family: Required. SKU family name. Possible values include: "A". + :vartype family: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SkuFamily + :ivar name: Required. SKU name to specify whether the key vault is a standard vault or a premium vault. Possible values include: "standard", "premium". - :type name: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SkuName + :vartype name: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SkuName """ _validation = { @@ -1817,6 +2215,13 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword family: Required. SKU family name. Possible values include: "A". + :paramtype family: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SkuFamily + :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: "standard", "premium". + :paramtype name: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.family = family self.name = name @@ -1825,21 +2230,21 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the key vault resource. - :param created_by: The identity that created the key vault resource. - :type created_by: str - :param created_by_type: The type of identity that created the key vault resource. Possible + :ivar created_by: The identity that created the key vault resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the key vault resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.IdentityType - :param created_at: The timestamp of the key vault resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the key vault resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the key vault resource. + :vartype created_by_type: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.IdentityType + :ivar created_at: The timestamp of the key vault resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the key vault resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the key vault resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.IdentityType - :param last_modified_at: The timestamp of the key vault resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of the key vault resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1862,6 +2267,23 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the key vault resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the key vault resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.IdentityType + :keyword created_at: The timestamp of the key vault resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the key vault resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the key vault resource. + Possible values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.IdentityType + :keyword last_modified_at: The timestamp of the key vault resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -1884,14 +2306,14 @@ class Vault(msrest.serialization.Model): :vartype name: str :ivar type: Resource type of the key vault resource. :vartype type: str - :param location: Azure location of the key vault resource. - :type location: str - :param tags: A set of tags. Tags assigned to the key vault resource. - :type tags: dict[str, str] + :ivar 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 system_data: System metadata for the key vault. :vartype system_data: ~azure.mgmt.keyvault.v2021_04_01_preview.models.SystemData - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProperties + :ivar properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProperties """ _validation = { @@ -1920,6 +2342,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Azure location of the key vault resource. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to the key vault resource. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProperties + """ super(Vault, self).__init__(**kwargs) self.id = None self.name = None @@ -1945,8 +2375,9 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): :vartype type: str :ivar location: The resource type of the access policy. :vartype location: str - :param properties: Required. Properties of the access policy. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultAccessPolicyProperties + :ivar properties: Required. Properties of the access policy. + :vartype properties: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultAccessPolicyProperties """ _validation = { @@ -1971,6 +2402,11 @@ def __init__( properties: "VaultAccessPolicyProperties", **kwargs ): + """ + :keyword properties: Required. Properties of the access policy. + :paramtype properties: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultAccessPolicyProperties + """ super(VaultAccessPolicyParameters, self).__init__(**kwargs) self.id = None self.name = None @@ -1984,9 +2420,10 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): 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 + :ivar access_policies: Required. An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. - :type access_policies: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyEntry] + :vartype access_policies: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyEntry] """ _validation = { @@ -2003,6 +2440,12 @@ def __init__( access_policies: List["AccessPolicyEntry"], **kwargs ): + """ + :keyword 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. + :paramtype access_policies: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyEntry] + """ super(VaultAccessPolicyProperties, self).__init__(**kwargs) self.access_policies = access_policies @@ -2014,8 +2457,8 @@ class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The vault name. - :type name: str + :ivar name: Required. The vault name. + :vartype name: str :ivar type: The type of resource, Microsoft.KeyVault/vaults. Has constant value: "Microsoft.KeyVault/vaults". :vartype type: str @@ -2039,6 +2482,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -2048,12 +2495,12 @@ class VaultCreateOrUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. The supported Azure location where the key vault should be created. - :type location: str - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProperties + :ivar location: Required. The supported Azure location where the key vault should be created. + :vartype location: str + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProperties """ _validation = { @@ -2075,6 +2522,15 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The supported Azure location where the key vault should be + created. + :paramtype location: str + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProperties + """ super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2084,10 +2540,10 @@ def __init__( class VaultListResult(msrest.serialization.Model): """List of vaults. - :param value: The list of vaults. - :type value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault] - :param next_link: The URL to get the next set of vaults. - :type next_link: str + :ivar value: The list of vaults. + :vartype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault] + :ivar next_link: The URL to get the next set of vaults. + :vartype next_link: str """ _attribute_map = { @@ -2102,6 +2558,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault] + :keyword next_link: The URL to get the next set of vaults. + :paramtype next_link: str + """ super(VaultListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2110,10 +2572,10 @@ def __init__( class VaultPatchParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultPatchProperties + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultPatchProperties """ _attribute_map = { @@ -2128,6 +2590,12 @@ def __init__( properties: Optional["VaultPatchProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultPatchProperties + """ super(VaultPatchParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -2136,47 +2604,48 @@ def __init__( class VaultPatchProperties(msrest.serialization.Model): """Properties of the vault. - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + :ivar tenant_id: The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - :type tenant_id: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to the key vault. All + :vartype tenant_id: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Sku + :ivar access_policies: An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. - :type access_policies: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyEntry] - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + :vartype access_policies: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyEntry] + :ivar 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 + :vartype enabled_for_deployment: bool + :ivar 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 + :vartype enabled_for_disk_encryption: bool + :ivar 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 + :vartype enabled_for_template_deployment: bool + :ivar 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 + :vartype enable_soft_delete: bool + :ivar 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. 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 + :vartype enable_rbac_authorization: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered or not. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode - :param enable_purge_protection: Property specifying whether protection against purge is enabled + :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode + :ivar 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 + :vartype enable_purge_protection: bool + :ivar network_acls: A collection of rules governing the accessibility of the vault from specific network locations. - :type network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleSet + :vartype network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleSet """ _attribute_map = { @@ -2211,6 +2680,51 @@ def __init__( network_acls: Optional["NetworkRuleSet"] = None, **kwargs ): + """ + :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. + :paramtype tenant_id: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Sku + :keyword 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. + :paramtype access_policies: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyEntry] + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword 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. + :paramtype enable_soft_delete: bool + :keyword 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. 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. + :paramtype enable_rbac_authorization: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode + :keyword 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. + :paramtype enable_purge_protection: bool + :keyword network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleSet + """ super(VaultPatchProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -2233,57 +2747,58 @@ class VaultProperties(msrest.serialization.Model): 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 + :ivar tenant_id: Required. The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - :type tenant_id: str - :param sku: Required. SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Sku - :param access_policies: An array of 0 to 1024 identities that have access to the key vault. All + :vartype tenant_id: str + :ivar sku: Required. SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Sku + :ivar access_policies: An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. When ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. - :type access_policies: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. - :type vault_uri: str + :vartype access_policies: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyEntry] + :ivar vault_uri: The URI of the vault for performing operations on keys and secrets. + :vartype vault_uri: str :ivar hsm_pool_resource_id: The resource id of HSM Pool. :vartype hsm_pool_resource_id: str - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + :ivar 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 + :vartype enabled_for_deployment: bool + :ivar 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 + :vartype enabled_for_disk_encryption: bool + :ivar 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 + :vartype enabled_for_template_deployment: bool + :ivar 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 + :vartype enable_soft_delete: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar 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. 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 + :vartype enable_rbac_authorization: bool + :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered or not. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode - :param enable_purge_protection: Property specifying whether protection against purge is enabled + :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode + :ivar 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 + :vartype enable_purge_protection: bool + :ivar network_acls: Rules governing the accessibility of the key vault from specific network locations. - :type network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleSet - :param provisioning_state: Provisioning state of the vault. Possible values include: + :vartype network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleSet + :ivar provisioning_state: Provisioning state of the vault. Possible values include: "Succeeded", "RegisteringDns". - :type provisioning_state: str or + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. @@ -2336,6 +2851,60 @@ def __init__( provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, **kwargs ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword sku: Required. SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Sku + :keyword access_policies: An array of 0 to 1024 identities that have access to the key vault. + All identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :paramtype access_policies: + list[~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyEntry] + :keyword vault_uri: The URI of the vault for performing operations on keys and secrets. + :paramtype vault_uri: str + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword 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. + :paramtype enable_soft_delete: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword 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. 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. + :paramtype enable_rbac_authorization: bool + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode + :keyword 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. + :paramtype enable_purge_protection: bool + :keyword network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleSet + :keyword provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProvisioningState + """ super(VaultProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -2360,12 +2929,12 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. Full resource id of a vnet subnet, such as + :ivar id: Required. Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - :type id: str - :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + :vartype id: str + :ivar ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. - :type ignore_missing_vnet_service_endpoint: bool + :vartype ignore_missing_vnet_service_endpoint: bool """ _validation = { @@ -2384,6 +2953,14 @@ def __init__( ignore_missing_vnet_service_endpoint: Optional[bool] = None, **kwargs ): + """ + :keyword id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :paramtype id: str + :keyword ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + check if parent subnet has serviceEndpoints configured. + :paramtype ignore_missing_vnet_service_endpoint: bool + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.id = id self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py index 35ae533ecb32..05b95ece5a0b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py @@ -5,25 +5,359 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_deleted_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_deleted_request( + name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}') + path_format_arguments = { + "name": _SERIALIZER.url("name", name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_purge_deleted_request_initial( + name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge') + path_format_arguments = { + "name": _SERIALIZER.url("name", name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ManagedHsmsOperations(object): """ManagedHsmsOperations operations. @@ -49,50 +383,38 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ManagedHsm" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedHsm" + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> "_models.ManagedHsm": cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ManagedHsm') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedHsm') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) @@ -104,16 +426,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ManagedHsm" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ManagedHsm"] + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> LROPoller["_models.ManagedHsm"]: """Create or update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -124,15 +448,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,27 +472,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -176,54 +498,43 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ManagedHsm" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedHsm" + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> "_models.ManagedHsm": cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ManagedHsm') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedHsm') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) @@ -235,16 +546,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ManagedHsm" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ManagedHsm"] + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> LROPoller["_models.ManagedHsm"]: """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -255,15 +568,19 @@ def begin_update( :type parameters: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', @@ -275,27 +592,21 @@ def begin_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -307,61 +618,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -370,15 +671,17 @@ def begin_delete( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -392,21 +695,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -418,15 +714,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ManagedHsm"] + resource_group_name: str, + name: str, + **kwargs: Any + ) -> Optional["_models.ManagedHsm"]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -443,33 +740,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -480,15 +767,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ManagedHsmListResult"] + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ManagedHsmListResult"]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -497,8 +786,10 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmListResult] + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] @@ -506,37 +797,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -549,31 +836,34 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + @distributed_trace def list_by_subscription( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ManagedHsmListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ManagedHsmListResult"]: """The List operation gets information about the managed HSM Pools associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmListResult] + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] @@ -581,36 +871,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -623,28 +908,31 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + @distributed_trace def list_deleted( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedManagedHsmListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedManagedHsmListResult"]: """The List operation gets information about the deleted managed HSMs associated with the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsmListResult] + :return: An iterator like instance of either DeletedManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsmListResult"] @@ -652,34 +940,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("DeletedManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -692,24 +975,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs'} # type: ignore + @distributed_trace def get_deleted( self, - name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedManagedHsm" + name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedManagedHsm": """Gets the specified deleted managed HSM. :param name: The name of the deleted managed HSM. @@ -726,33 +1010,23 @@ def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + name=name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedManagedHsm', pipeline_response) @@ -761,61 +1035,52 @@ def get_deleted( return cls(pipeline_response, deserialized, {}) return deserialized + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}'} # type: ignore + def _purge_deleted_initial( self, - name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + name: str, + location: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._purge_deleted_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_deleted_request_initial( + name=name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + 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}/deletedManagedHSMs/{name}/purge'} # type: ignore + + @distributed_trace def begin_purge_deleted( self, - name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + name: str, + location: str, + **kwargs: Any + ) -> LROPoller[None]: """Permanently deletes the specified managed HSM. :param name: The name of the soft-deleted managed HSM. @@ -824,15 +1089,17 @@ def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -846,21 +1113,14 @@ def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -872,4 +1132,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py index 91e7b70165df..2a0ba18cacb0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py @@ -5,25 +5,183 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_resource_request( + subscription_id: str, + resource_group_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_put_request( + subscription_id: str, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class MHSMPrivateEndpointConnectionsOperations(object): """MHSMPrivateEndpointConnectionsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MHSMPrivateEndpointConnectionsListResult"] + resource_group_name: str, + name: str, + **kwargs: Any + ) -> Iterable["_models.MHSMPrivateEndpointConnectionsListResult"]: """The List operation gets information about the private endpoint connections associated with the managed HSM Pool. @@ -62,8 +220,10 @@ def list_by_resource( :param name: Name of the managed HSM Pool. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MHSMPrivateEndpointConnectionsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnectionsListResult] + :return: An iterator like instance of either MHSMPrivateEndpointConnectionsListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnectionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnectionsListResult"] @@ -71,36 +231,33 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('MHSMPrivateEndpointConnectionsListResult', pipeline_response) + deserialized = self._deserialize("MHSMPrivateEndpointConnectionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,25 +270,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MHSMPrivateEndpointConnection" + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.MHSMPrivateEndpointConnection": """Gets the specified private endpoint connection associated with the managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -151,34 +309,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) @@ -187,17 +335,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.MHSMPrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.MHSMPrivateEndpointConnection" + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: "_models.MHSMPrivateEndpointConnection", + **kwargs: Any + ) -> "_models.MHSMPrivateEndpointConnection": """Updates the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -219,33 +369,23 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') + + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -256,49 +396,41 @@ def put( response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MHSMPrivateEndpointConnection"] + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.MHSMPrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MHSMPrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,29 +438,32 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if response.status_code == 202: response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MHSMPrivateEndpointConnection"] + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller["_models.MHSMPrivateEndpointConnection"]: """Deletes the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -340,15 +475,19 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MHSMPrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MHSMPrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -363,25 +502,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -393,4 +524,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_link_resources_operations.py index 3acb6ee63674..138b00c1f932 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_link_resources_operations.py @@ -5,22 +5,59 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_mhsm_resource_request( + subscription_id: str, + resource_group_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class MHSMPrivateLinkResourcesOperations(object): """MHSMPrivateLinkResourcesOperations operations. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_mhsm_resource( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MHSMPrivateLinkResourceListResult" + resource_group_name: str, + name: str, + **kwargs: Any + ) -> "_models.MHSMPrivateLinkResourceListResult": """Gets the private link resources supported for the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -67,27 +104,17 @@ def list_by_mhsm_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_mhsm_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_mhsm_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + template_url=self.list_by_mhsm_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +128,6 @@ def list_by_mhsm_resource( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_mhsm_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_operations.py index e51dd9b0e856..ce0b70ad9469 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KeyVault/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py index d2a6e50bd6a4..6654fdf3a7e0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py @@ -5,25 +5,183 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_put_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,14 +205,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -74,28 +232,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,17 +259,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -143,33 +293,23 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -180,49 +320,41 @@ def put( response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,29 +362,32 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} 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 + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -264,15 +399,19 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,25 +426,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,15 +448,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_by_resource( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """The List operation gets information about the private endpoint connections associated with the vault. @@ -334,8 +466,10 @@ def list_by_resource( :param vault_name: The name of the key vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -343,36 +477,33 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -390,6 +521,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_link_resources_operations.py index 8b7ef86be01c..c7ed3885ffba 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_link_resources_operations.py @@ -5,22 +5,59 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_vault_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_vault( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -67,27 +104,17 @@ def list_by_vault( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_vault.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_vault_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_vault.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +128,6 @@ def list_by_vault( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py index d77e87be3933..21d0fd06ee0d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py @@ -5,25 +5,482 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_access_policy_request( + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "operationKind": _SERIALIZER.url("operation_kind", operation_kind, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_deleted_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_deleted_request( + vault_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}') + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_purge_deleted_request_initial( + vault_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge') + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2015-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-04-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VaultsOperations(object): """VaultsOperations operations. @@ -49,43 +506,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.Vault": cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +549,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - vault_name, # type: str - parameters, # type: "_models.VaultCreateOrUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Vault"] + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Vault"]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -123,15 +571,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Vault or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +594,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,16 +620,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - vault_name, # type: str - parameters, # type: "_models.VaultPatchParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultPatchParameters", + **kwargs: Any + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -203,32 +649,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VaultPatchParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -246,15 +682,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> None: """Deletes the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -271,27 +709,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -304,13 +732,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -327,27 +756,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,17 +780,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def update_access_policy( self, - resource_group_name, # type: str - vault_name, # type: str - operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] - parameters, # type: "_models.VaultAccessPolicyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultAccessPolicyParameters" + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", + **kwargs: Any + ) -> "_models.VaultAccessPolicyParameters": """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -379,7 +800,8 @@ def update_access_policy( :param vault_name: Name of the vault. :type vault_name: str :param operation_kind: Name of the operation. - :type operation_kind: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyUpdateKind + :type operation_kind: str or + ~azure.mgmt.keyvault.v2021_04_01_preview.models.AccessPolicyUpdateKind :param parameters: Access policy to merge into the vault. :type parameters: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultAccessPolicyParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -392,33 +814,23 @@ def update_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -436,15 +848,17 @@ def update_access_policy( 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 + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultListResult"] + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -454,7 +868,8 @@ def list_by_resource_group( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] @@ -462,37 +877,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -510,24 +921,26 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] @@ -535,36 +948,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -582,21 +990,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + @distributed_trace def list_deleted( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedVaultListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVaultListResult] + :return: An iterator like instance of either DeletedVaultListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] @@ -604,34 +1015,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -649,18 +1055,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + @distributed_trace def get_deleted( self, - vault_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedVault" + vault_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -677,27 +1084,17 @@ def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,41 +1108,32 @@ def get_deleted( 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 + vault_name: str, + location: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - accept = "application/json" - - # Construct URL - url = self._purge_deleted_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,13 +1146,14 @@ def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + @distributed_trace def begin_purge_deleted( self, - vault_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + vault_name: str, + location: str, + **kwargs: Any + ) -> LROPoller[None]: """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. :param vault_name: The name of the soft-deleted vault. @@ -773,15 +1162,17 @@ def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -795,21 +1186,14 @@ def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -821,21 +1205,23 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + @distributed_trace def list( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ResourceListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] @@ -843,38 +1229,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - api_version = "2015-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceListResult', pipeline_response) + deserialized = self._deserialize("ResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -892,21 +1271,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + @distributed_trace def check_name_availability( self, - vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + vault_name: "_models.VaultCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. - :type vault_name: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultCheckNameAvailabilityParameters + :type vault_name: + ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.CheckNameAvailabilityResult @@ -917,30 +1298,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-04-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -954,4 +1325,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/__init__.py index 1283ff09177b..59fd240c9528 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['KeyVaultManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_configuration.py index 1111dd6fa3f4..2215a426530f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,16 +33,15 @@ class KeyVaultManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -68,4 +65,4 @@ def _configure( 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) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_key_vault_management_client.py index 9dce69cc8cbc..514ad3c68d0a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_key_vault_management_client.py @@ -6,32 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import KeysOperations, MHSMPrivateEndpointConnectionsOperations, MHSMPrivateLinkResourcesOperations, ManagedHsmsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, SecretsOperations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import KeyVaultManagementClientConfiguration -from .operations import KeysOperations -from .operations import VaultsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ManagedHsmsOperations -from .operations import MHSMPrivateEndpointConnectionsOperations -from .operations import MHSMPrivateLinkResourcesOperations -from .operations import Operations -from .operations import SecretsOperations -from . import models - -class KeyVaultManagementClient(object): +class KeyVaultManagementClient: """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. :ivar keys: KeysOperations operations @@ -39,81 +29,84 @@ class KeyVaultManagementClient(object): :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.keyvault.v2021_06_01_preview.operations.VaultsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.keyvault.v2021_06_01_preview.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.keyvault.v2021_06_01_preview.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.keyvault.v2021_06_01_preview.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.keyvault.v2021_06_01_preview.operations.PrivateLinkResourcesOperations :ivar managed_hsms: ManagedHsmsOperations operations :vartype managed_hsms: azure.mgmt.keyvault.v2021_06_01_preview.operations.ManagedHsmsOperations :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations - :vartype mhsm_private_endpoint_connections: azure.mgmt.keyvault.v2021_06_01_preview.operations.MHSMPrivateEndpointConnectionsOperations + :vartype mhsm_private_endpoint_connections: + azure.mgmt.keyvault.v2021_06_01_preview.operations.MHSMPrivateEndpointConnectionsOperations :ivar mhsm_private_link_resources: MHSMPrivateLinkResourcesOperations operations - :vartype mhsm_private_link_resources: azure.mgmt.keyvault.v2021_06_01_preview.operations.MHSMPrivateLinkResourcesOperations + :vartype mhsm_private_link_resources: + azure.mgmt.keyvault.v2021_06_01_preview.operations.MHSMPrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2021_06_01_preview.operations.Operations :ivar secrets: SecretsOperations operations :vartype secrets: azure.mgmt.keyvault.v2021_06_01_preview.operations.SecretsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.keys = KeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.secrets = SecretsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_metadata.json index 9791ad668ce7..282f6b4bceb1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_metadata.json +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "KeyVaultManagementClient", "filename": "_key_vault_management_client", "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "keys": "KeysOperations", diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_vendor.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py index 726043aa858a..e5754a47ce68 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.3.0" +VERSION = "1.0.0b1" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/__init__.py index f54ed88d6ad2..8cff887e652d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._key_vault_management_client import KeyVaultManagementClient __all__ = ['KeyVaultManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_configuration.py index da6ab06618be..93fe68441817 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_configuration.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) 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 @@ -64,4 +64,4 @@ def _configure( 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) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_key_vault_management_client.py index d104a7fe4fe0..54946ac279dd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_key_vault_management_client.py @@ -6,30 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import KeysOperations, MHSMPrivateEndpointConnectionsOperations, MHSMPrivateLinkResourcesOperations, ManagedHsmsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, SecretsOperations, VaultsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import KeyVaultManagementClientConfiguration -from .operations import KeysOperations -from .operations import VaultsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import ManagedHsmsOperations -from .operations import MHSMPrivateEndpointConnectionsOperations -from .operations import MHSMPrivateLinkResourcesOperations -from .operations import Operations -from .operations import SecretsOperations -from .. import models - - -class KeyVaultManagementClient(object): +class KeyVaultManagementClient: """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. :ivar keys: KeysOperations operations @@ -37,79 +29,85 @@ class KeyVaultManagementClient(object): :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.VaultsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.PrivateLinkResourcesOperations :ivar managed_hsms: ManagedHsmsOperations operations - :vartype managed_hsms: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.ManagedHsmsOperations + :vartype managed_hsms: + azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.ManagedHsmsOperations :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations - :vartype mhsm_private_endpoint_connections: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.MHSMPrivateEndpointConnectionsOperations + :vartype mhsm_private_endpoint_connections: + azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.MHSMPrivateEndpointConnectionsOperations :ivar mhsm_private_link_resources: MHSMPrivateLinkResourcesOperations operations - :vartype mhsm_private_link_resources: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.MHSMPrivateLinkResourcesOperations + :vartype mhsm_private_link_resources: + azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.MHSMPrivateLinkResourcesOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.Operations :ivar secrets: SecretsOperations operations :vartype secrets: azure.mgmt.keyvault.v2021_06_01_preview.aio.operations.SecretsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :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. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :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, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = KeyVaultManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.keys = KeysOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.secrets = SecretsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_keys_operations.py index a445eefaa21d..c59d3ba43691 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_keys_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._keys_operations import build_create_if_not_exist_request, build_get_request, build_get_version_request, build_list_request, build_list_versions_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_if_not_exist( self, resource_group_name: str, @@ -72,33 +78,23 @@ async def create_if_not_exist( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_if_not_exist.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'KeyCreateParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_if_not_exist_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + content_type=content_type, + json=_json, + template_url=self.create_if_not_exist.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'KeyCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -112,8 +108,11 @@ async def create_if_not_exist( return cls(pipeline_response, deserialized, {}) return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -140,28 +139,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -175,8 +164,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -192,7 +184,8 @@ def list( :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either KeyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] @@ -200,36 +193,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('KeyListResult', pipeline_response) + deserialized = self._deserialize("KeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -247,11 +237,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} # type: ignore + @distributed_trace_async async def get_version( self, resource_group_name: str, @@ -281,29 +273,19 @@ async def get_version( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_version.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'keyVersion': self._serialize.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_version_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + key_version=key_version, + template_url=self.get_version.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -317,8 +299,11 @@ async def get_version( return cls(pipeline_response, deserialized, {}) return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} # type: ignore + + @distributed_trace def list_versions( self, resource_group_name: str, @@ -337,7 +322,8 @@ def list_versions( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either KeyListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] @@ -345,37 +331,35 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_versions.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('KeyListResult', pipeline_response) + deserialized = self._deserialize("KeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -393,6 +377,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py index 641a2f941560..e6375c5834ed 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._managed_hsms_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_deleted_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_deleted_request, build_purge_deleted_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,39 +60,28 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ManagedHsm') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedHsm') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) @@ -99,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -118,15 +115,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', @@ -138,27 +140,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -170,6 +166,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore async def _update_initial( @@ -184,39 +181,28 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ManagedHsm') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedHsm') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) @@ -228,8 +214,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -247,15 +236,20 @@ async def begin_update( :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', @@ -267,27 +261,21 @@ async def begin_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -299,6 +287,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore async def _delete_initial( @@ -312,40 +301,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -360,15 +340,17 @@ async def begin_delete( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -382,21 +364,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -408,8 +383,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -432,33 +409,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -469,8 +436,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -485,8 +455,10 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] @@ -494,37 +466,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -537,17 +505,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + @distributed_trace def list_by_subscription( self, top: Optional[int] = None, @@ -559,8 +529,10 @@ def list_by_subscription( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] @@ -568,36 +540,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -610,17 +577,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + @distributed_trace def list_deleted( self, **kwargs: Any @@ -629,8 +598,10 @@ def list_deleted( subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmListResult] + :return: An iterator like instance of either DeletedManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsmListResult"] @@ -638,34 +609,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("DeletedManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -678,17 +644,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs'} # type: ignore + @distributed_trace_async async def get_deleted( self, name: str, @@ -711,33 +679,23 @@ async def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + name=name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedManagedHsm', pipeline_response) @@ -746,8 +704,10 @@ async def get_deleted( return cls(pipeline_response, deserialized, {}) return deserialized + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}'} # type: ignore + async def _purge_deleted_initial( self, name: str, @@ -759,40 +719,31 @@ async def _purge_deleted_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._purge_deleted_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_deleted_request_initial( + name=name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + 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}/deletedManagedHSMs/{name}/purge'} # type: ignore + + @distributed_trace_async async def begin_purge_deleted( self, name: str, @@ -807,15 +758,17 @@ async def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -829,21 +782,14 @@ async def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -855,4 +801,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py index 17458b7c0a48..d1c862c09e80 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._mhsm_private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_by_resource_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource( self, resource_group_name: str, @@ -57,8 +63,10 @@ def list_by_resource( :param name: Name of the managed HSM Pool. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MHSMPrivateEndpointConnectionsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionsListResult] + :return: An iterator like instance of either MHSMPrivateEndpointConnectionsListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnectionsListResult"] @@ -66,36 +74,33 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('MHSMPrivateEndpointConnectionsListResult', pipeline_response) + deserialized = self._deserialize("MHSMPrivateEndpointConnectionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,17 +113,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -145,34 +152,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) @@ -181,8 +178,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -212,33 +212,23 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') + + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -249,14 +239,17 @@ async def put( response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -269,28 +262,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -298,21 +281,25 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if response.status_code == 202: response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -331,15 +318,19 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either MHSMPrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MHSMPrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -354,25 +345,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -384,4 +367,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_link_resources_operations.py index 04d230f58783..132eb602a63a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_link_resources_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._mhsm_private_link_resources_operations import build_list_by_mhsm_resource_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_mhsm_resource( self, resource_group_name: str, @@ -62,27 +67,17 @@ async def list_by_mhsm_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_mhsm_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_mhsm_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + template_url=self.list_by_mhsm_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -96,4 +91,6 @@ async def list_by_mhsm_resource( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_mhsm_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_operations.py index 79cd2937801c..55ba51155815 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -49,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py index c614bcaf6530..aaffc695af10 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_by_resource_request, build_put_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -69,28 +75,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -106,8 +102,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def put( self, resource_group_name: str, @@ -137,33 +136,23 @@ async def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -174,14 +163,17 @@ async def put( 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, @@ -194,28 +186,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -223,21 +205,25 @@ async def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} 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 + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -256,15 +242,19 @@ async def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,25 +269,17 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -309,8 +291,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_by_resource( self, resource_group_name: str, @@ -325,8 +309,10 @@ def list_by_resource( :param vault_name: The name of the key vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -334,36 +320,33 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -381,6 +364,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py index 95d13af7f369..204f6d63fd3c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_list_by_vault_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list_by_vault( self, resource_group_name: str, @@ -62,27 +67,17 @@ async def list_by_vault( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_vault.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_vault_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_vault.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -96,4 +91,6 @@ async def list_by_vault( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py index 252c5d2d17d7..843f39f2f682 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._secrets_operations import build_create_or_update_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -60,7 +66,8 @@ async def create_or_update( :param secret_name: Name of the secret. :type secret_name: str :param parameters: Parameters to create or update the secret. - :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretCreateOrUpdateParameters + :type parameters: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: Secret, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret @@ -71,33 +78,23 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,8 +112,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -147,33 +147,23 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SecretPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SecretPatchParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -191,8 +181,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -219,28 +212,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -254,8 +237,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -275,7 +261,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SecretListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] @@ -283,38 +270,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SecretListResult', pipeline_response) + deserialized = self._deserialize("SecretListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -332,6 +316,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py index 42138478bb6a..cbaf21c3ab2a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._vaults_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request, build_get_deleted_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_deleted_request, build_list_request, build_purge_deleted_request_initial, build_update_access_policy_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,32 +60,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -98,8 +93,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -117,15 +115,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -137,27 +139,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -169,8 +165,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -196,32 +194,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -239,8 +227,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -263,27 +254,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -296,6 +277,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -318,27 +301,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -352,8 +325,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace_async async def update_access_policy( self, resource_group_name: str, @@ -369,7 +345,8 @@ async def update_access_policy( :param vault_name: Name of the vault. :type vault_name: str :param operation_kind: Name of the operation. - :type operation_kind: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyUpdateKind + :type operation_kind: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyUpdateKind :param parameters: Access policy to merge into the vault. :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -382,33 +359,23 @@ async def update_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -426,8 +393,11 @@ async def update_access_policy( 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 + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -443,7 +413,8 @@ def list_by_resource_group( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] @@ -451,37 +422,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -499,11 +466,13 @@ async def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, top: Optional[int] = None, @@ -515,7 +484,8 @@ def list_by_subscription( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] @@ -523,36 +493,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -570,11 +535,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + @distributed_trace def list_deleted( self, **kwargs: Any @@ -582,8 +549,10 @@ def list_deleted( """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultListResult] + :return: An iterator like instance of either DeletedVaultListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] @@ -591,34 +560,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -636,11 +600,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + @distributed_trace_async async def get_deleted( self, vault_name: str, @@ -663,27 +629,17 @@ async def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -697,8 +653,10 @@ async def get_deleted( 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, @@ -710,27 +668,17 @@ async def _purge_deleted_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._purge_deleted_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -743,6 +691,8 @@ async def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + @distributed_trace_async async def begin_purge_deleted( self, vault_name: str, @@ -757,15 +707,17 @@ async def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -779,21 +731,14 @@ async def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -805,8 +750,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + @distributed_trace def list( self, top: Optional[int] = None, @@ -818,7 +765,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ResourceListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] @@ -826,38 +774,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - api_version = "2015-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceListResult', pipeline_response) + deserialized = self._deserialize("ResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -875,11 +816,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + @distributed_trace_async async def check_name_availability( self, vault_name: "_models.VaultCheckNameAvailabilityParameters", @@ -888,7 +831,8 @@ async def check_name_availability( """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. - :type vault_name: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultCheckNameAvailabilityParameters + :type vault_name: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.CheckNameAvailabilityResult @@ -899,30 +843,20 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -936,4 +870,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/__init__.py index 74d3e28d0abf..6ef36695c13d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/__init__.py @@ -6,160 +6,83 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccessPolicyEntry - from ._models_py3 import Action - from ._models_py3 import Attributes - from ._models_py3 import CheckNameAvailabilityResult - from ._models_py3 import CloudErrorBody - from ._models_py3 import DeletedManagedHsm - from ._models_py3 import DeletedManagedHsmListResult - from ._models_py3 import DeletedManagedHsmProperties - from ._models_py3 import DeletedVault - from ._models_py3 import DeletedVaultListResult - from ._models_py3 import DeletedVaultProperties - from ._models_py3 import DimensionProperties - from ._models_py3 import Error - from ._models_py3 import IPRule - from ._models_py3 import Key - from ._models_py3 import KeyAttributes - from ._models_py3 import KeyCreateParameters - from ._models_py3 import KeyListResult - from ._models_py3 import KeyProperties - from ._models_py3 import KeyReleasePolicy - from ._models_py3 import KeyRotationPolicyAttributes - from ._models_py3 import LifetimeAction - from ._models_py3 import LogSpecification - from ._models_py3 import MHSMIPRule - from ._models_py3 import MHSMNetworkRuleSet - from ._models_py3 import MHSMPrivateEndpoint - from ._models_py3 import MHSMPrivateEndpointConnection - from ._models_py3 import MHSMPrivateEndpointConnectionItem - from ._models_py3 import MHSMPrivateEndpointConnectionsListResult - from ._models_py3 import MHSMPrivateLinkResource - from ._models_py3 import MHSMPrivateLinkResourceListResult - from ._models_py3 import MHSMPrivateLinkServiceConnectionState - from ._models_py3 import MHSMVirtualNetworkRule - from ._models_py3 import ManagedHsm - from ._models_py3 import ManagedHsmError - from ._models_py3 import ManagedHsmListResult - from ._models_py3 import ManagedHsmProperties - from ._models_py3 import ManagedHsmResource - from ._models_py3 import ManagedHsmSku - from ._models_py3 import MetricSpecification - from ._models_py3 import NetworkRuleSet - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Permissions - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionItem - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import Resource - from ._models_py3 import ResourceListResult - from ._models_py3 import RotationPolicy - from ._models_py3 import Secret - from ._models_py3 import SecretAttributes - from ._models_py3 import SecretCreateOrUpdateParameters - from ._models_py3 import SecretListResult - from ._models_py3 import SecretPatchParameters - from ._models_py3 import SecretPatchProperties - from ._models_py3 import SecretProperties - from ._models_py3 import ServiceSpecification - from ._models_py3 import Sku - from ._models_py3 import SystemData - from ._models_py3 import Trigger - from ._models_py3 import Vault - from ._models_py3 import VaultAccessPolicyParameters - from ._models_py3 import VaultAccessPolicyProperties - from ._models_py3 import VaultCheckNameAvailabilityParameters - from ._models_py3 import VaultCreateOrUpdateParameters - from ._models_py3 import VaultListResult - from ._models_py3 import VaultPatchParameters - from ._models_py3 import VaultPatchProperties - from ._models_py3 import VaultProperties - from ._models_py3 import VirtualNetworkRule -except (SyntaxError, ImportError): - from ._models import AccessPolicyEntry # type: ignore - from ._models import Action # type: ignore - from ._models import Attributes # type: ignore - from ._models import CheckNameAvailabilityResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import DeletedManagedHsm # type: ignore - from ._models import DeletedManagedHsmListResult # type: ignore - from ._models import DeletedManagedHsmProperties # type: ignore - from ._models import DeletedVault # type: ignore - from ._models import DeletedVaultListResult # type: ignore - from ._models import DeletedVaultProperties # type: ignore - from ._models import DimensionProperties # type: ignore - from ._models import Error # type: ignore - from ._models import IPRule # type: ignore - from ._models import Key # type: ignore - from ._models import KeyAttributes # type: ignore - from ._models import KeyCreateParameters # type: ignore - from ._models import KeyListResult # type: ignore - from ._models import KeyProperties # type: ignore - from ._models import KeyReleasePolicy # type: ignore - from ._models import KeyRotationPolicyAttributes # type: ignore - from ._models import LifetimeAction # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import MHSMIPRule # type: ignore - from ._models import MHSMNetworkRuleSet # type: ignore - from ._models import MHSMPrivateEndpoint # type: ignore - from ._models import MHSMPrivateEndpointConnection # type: ignore - from ._models import MHSMPrivateEndpointConnectionItem # type: ignore - from ._models import MHSMPrivateEndpointConnectionsListResult # type: ignore - from ._models import MHSMPrivateLinkResource # type: ignore - from ._models import MHSMPrivateLinkResourceListResult # type: ignore - from ._models import MHSMPrivateLinkServiceConnectionState # type: ignore - from ._models import MHSMVirtualNetworkRule # type: ignore - from ._models import ManagedHsm # type: ignore - from ._models import ManagedHsmError # type: ignore - from ._models import ManagedHsmListResult # type: ignore - from ._models import ManagedHsmProperties # type: ignore - from ._models import ManagedHsmResource # type: ignore - from ._models import ManagedHsmSku # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import NetworkRuleSet # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Permissions # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionItem # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceListResult # type: ignore - from ._models import RotationPolicy # type: ignore - from ._models import Secret # type: ignore - from ._models import SecretAttributes # type: ignore - from ._models import SecretCreateOrUpdateParameters # type: ignore - from ._models import SecretListResult # type: ignore - from ._models import SecretPatchParameters # type: ignore - from ._models import SecretPatchProperties # type: ignore - from ._models import SecretProperties # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Sku # type: ignore - from ._models import SystemData # type: ignore - from ._models import Trigger # type: ignore - from ._models import Vault # type: ignore - from ._models import VaultAccessPolicyParameters # type: ignore - from ._models import VaultAccessPolicyProperties # type: ignore - from ._models import VaultCheckNameAvailabilityParameters # type: ignore - from ._models import VaultCreateOrUpdateParameters # type: ignore - from ._models import VaultListResult # type: ignore - from ._models import VaultPatchParameters # type: ignore - from ._models import VaultPatchProperties # type: ignore - from ._models import VaultProperties # type: ignore - from ._models import VirtualNetworkRule # type: ignore +from ._models_py3 import AccessPolicyEntry +from ._models_py3 import Action +from ._models_py3 import Attributes +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import DeletedManagedHsm +from ._models_py3 import DeletedManagedHsmListResult +from ._models_py3 import DeletedManagedHsmProperties +from ._models_py3 import DeletedVault +from ._models_py3 import DeletedVaultListResult +from ._models_py3 import DeletedVaultProperties +from ._models_py3 import DimensionProperties +from ._models_py3 import Error +from ._models_py3 import IPRule +from ._models_py3 import Key +from ._models_py3 import KeyAttributes +from ._models_py3 import KeyCreateParameters +from ._models_py3 import KeyListResult +from ._models_py3 import KeyProperties +from ._models_py3 import KeyReleasePolicy +from ._models_py3 import KeyRotationPolicyAttributes +from ._models_py3 import LifetimeAction +from ._models_py3 import LogSpecification +from ._models_py3 import MHSMIPRule +from ._models_py3 import MHSMNetworkRuleSet +from ._models_py3 import MHSMPrivateEndpoint +from ._models_py3 import MHSMPrivateEndpointConnection +from ._models_py3 import MHSMPrivateEndpointConnectionItem +from ._models_py3 import MHSMPrivateEndpointConnectionsListResult +from ._models_py3 import MHSMPrivateLinkResource +from ._models_py3 import MHSMPrivateLinkResourceListResult +from ._models_py3 import MHSMPrivateLinkServiceConnectionState +from ._models_py3 import MHSMVirtualNetworkRule +from ._models_py3 import ManagedHsm +from ._models_py3 import ManagedHsmError +from ._models_py3 import ManagedHsmListResult +from ._models_py3 import ManagedHsmProperties +from ._models_py3 import ManagedHsmResource +from ._models_py3 import ManagedHsmSku +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Permissions +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionItem +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import ResourceListResult +from ._models_py3 import RotationPolicy +from ._models_py3 import Secret +from ._models_py3 import SecretAttributes +from ._models_py3 import SecretCreateOrUpdateParameters +from ._models_py3 import SecretListResult +from ._models_py3 import SecretPatchParameters +from ._models_py3 import SecretPatchProperties +from ._models_py3 import SecretProperties +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SystemData +from ._models_py3 import Trigger +from ._models_py3 import Vault +from ._models_py3 import VaultAccessPolicyParameters +from ._models_py3 import VaultAccessPolicyProperties +from ._models_py3 import VaultCheckNameAvailabilityParameters +from ._models_py3 import VaultCreateOrUpdateParameters +from ._models_py3 import VaultListResult +from ._models_py3 import VaultPatchParameters +from ._models_py3 import VaultPatchProperties +from ._models_py3 import VaultProperties +from ._models_py3 import VirtualNetworkRule + from ._key_vault_management_client_enums import ( AccessPolicyUpdateKind, diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_key_vault_management_client_enums.py index afc294a5a4fe..a3b2078d010b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_key_vault_management_client_enums.py @@ -6,39 +6,24 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AccessPolicyUpdateKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class ActionsRequired(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """A message indicating if changes on the service provider require any updates on the consumer. """ NONE = "None" -class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALL = "all" GET = "get" @@ -58,14 +43,14 @@ class CertificatePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) BACKUP = "backup" RESTORE = "restore" -class CreateMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval. @@ -76,7 +61,7 @@ class DeletionRecoveryLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) RECOVERABLE = "Recoverable" RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity. """ @@ -85,7 +70,7 @@ class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class JsonWebKeyCurveName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The elliptic curve name. For valid values, see JsonWebKeyCurveName. """ @@ -94,7 +79,7 @@ class JsonWebKeyCurveName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): P521 = "P-521" P256_K = "P-256K" -class JsonWebKeyOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The permitted JSON web key operations of the key. For more information, see JsonWebKeyOperation. """ @@ -108,7 +93,7 @@ class JsonWebKeyOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): IMPORT_ENUM = "import" RELEASE = "release" -class JsonWebKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the key. For valid values, see JsonWebKeyType. """ @@ -117,7 +102,7 @@ class JsonWebKeyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RSA = "RSA" RSA_HSM = "RSA-HSM" -class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALL = "all" ENCRYPT = "encrypt" @@ -141,27 +126,27 @@ class KeyPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SETROTATIONPOLICY = "setrotationpolicy" RELEASE = "release" -class KeyRotationPolicyActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KeyRotationPolicyActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of action. """ ROTATE = "rotate" NOTIFY = "notify" -class ManagedHsmSkuFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU Family of the managed HSM Pool """ B = "B" -class ManagedHsmSkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU of the managed HSM Pool """ STANDARD_B1 = "Standard_B1" CUSTOM_B32 = "Custom_B32" -class NetworkRuleAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. """ @@ -169,7 +154,7 @@ class NetworkRuleAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" -class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. """ @@ -177,7 +162,7 @@ class NetworkRuleBypassOptions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu AZURE_SERVICES = "AzureServices" NONE = "None" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -188,7 +173,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive FAILED = "Failed" DISCONNECTED = "Disconnected" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -197,7 +182,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state. """ @@ -218,7 +203,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The managed HSM pool is being restored from full HSM backup. RESTORING = "Restoring" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Control permission for data plane traffic coming from public networks while private endpoint is enabled. """ @@ -226,7 +211,7 @@ class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -234,7 +219,7 @@ class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALL = "all" GET = "get" @@ -246,20 +231,20 @@ class SecretPermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU family name """ A = "A" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALL = "all" GET = "get" @@ -277,7 +262,7 @@ class StoragePermissions(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GETSAS = "getsas" DELETESAS = "deletesas" -class VaultProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VaultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provisioning state of the vault. """ diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models.py deleted file mode 100644 index e45a2139da24..000000000000 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models.py +++ /dev/null @@ -1,2859 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class AccessPolicyEntry(msrest.serialization.Model): - """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. - - All required parameters must be populated in order to send to Azure. - - :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for - authenticating requests to the key vault. - :type tenant_id: str - :param object_id: Required. The object ID of a user, service principal or security group in the - Azure Active Directory tenant for the vault. The object ID must be unique for the list of - access policies. - :type object_id: str - :param application_id: Application ID of the client making request on behalf of a principal. - :type application_id: str - :param permissions: Required. Permissions the identity has for keys, secrets and certificates. - :type permissions: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Permissions - """ - - _validation = { - 'tenant_id': {'required': True}, - 'object_id': {'required': True}, - 'permissions': {'required': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'object_id': {'key': 'objectId', 'type': 'str'}, - 'application_id': {'key': 'applicationId', 'type': 'str'}, - 'permissions': {'key': 'permissions', 'type': 'Permissions'}, - } - - def __init__( - self, - **kwargs - ): - super(AccessPolicyEntry, self).__init__(**kwargs) - self.tenant_id = kwargs['tenant_id'] - self.object_id = kwargs['object_id'] - self.application_id = kwargs.get('application_id', None) - self.permissions = kwargs['permissions'] - - -class Action(msrest.serialization.Model): - """Action. - - :param type: The type of action. Possible values include: "rotate", "notify". - :type type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyActionType - """ - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Action, self).__init__(**kwargs) - self.type = kwargs.get('type', None) - - -class Attributes(msrest.serialization.Model): - """The object attributes managed by the KeyVault service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: Determines whether the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: ~datetime.datetime - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: ~datetime.datetime - :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. - :vartype created: ~datetime.datetime - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: ~datetime.datetime - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - } - - def __init__( - self, - **kwargs - ): - super(Attributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.not_before = kwargs.get('not_before', None) - self.expires = kwargs.get('expires', None) - self.created = None - self.updated = None - - -class CheckNameAvailabilityResult(msrest.serialization.Model): - """The CheckNameAvailability operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: A boolean value that indicates whether the name is available for you to - use. If true, the name is available. If false, the name has already been taken or is invalid - and cannot be used. - :vartype name_available: bool - :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". - :vartype reason: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.Reason - :ivar message: An error message explaining the Reason value in more detail. - :vartype message: str - """ - - _validation = { - 'name_available': {'readonly': True}, - 'reason': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameAvailabilityResult, self).__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from Key Vault resource provider. - - :param code: Error code. This is a mnemonic that can be consumed programmatically. - :type code: str - :param message: User friendly error message. The message is typically localized and may vary - with service version. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class DeletedManagedHsm(msrest.serialization.Model): - """DeletedManagedHsm. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Azure Resource Manager resource ID for the deleted managed HSM Pool. - :vartype id: str - :ivar name: The name of the managed HSM Pool. - :vartype name: str - :ivar type: The resource type of the managed HSM Pool. - :vartype type: str - :param properties: Properties of the deleted managed HSM. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'DeletedManagedHsmProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedManagedHsm, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = kwargs.get('properties', None) - - -class DeletedManagedHsmListResult(msrest.serialization.Model): - """List of deleted managed HSM Pools. - - :param value: The list of deleted managed HSM Pools. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsm] - :param next_link: The URL to get the next set of deleted managed HSM Pools. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedManagedHsm]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedManagedHsmListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class DeletedManagedHsmProperties(msrest.serialization.Model): - """Properties of the deleted managed HSM. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar mhsm_id: The resource id of the original managed HSM. - :vartype mhsm_id: str - :ivar location: The location of the original managed HSM. - :vartype location: str - :ivar deletion_date: The deleted date. - :vartype deletion_date: ~datetime.datetime - :ivar scheduled_purge_date: The scheduled purged date. - :vartype scheduled_purge_date: ~datetime.datetime - :ivar purge_protection_enabled: Purge protection status of the original managed HSM. - :vartype purge_protection_enabled: bool - :ivar tags: A set of tags. Tags of the original managed HSM. - :vartype tags: dict[str, str] - """ - - _validation = { - 'mhsm_id': {'readonly': True}, - 'location': {'readonly': True}, - 'deletion_date': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'purge_protection_enabled': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'mhsm_id': {'key': 'mhsmId', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, - 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedManagedHsmProperties, self).__init__(**kwargs) - self.mhsm_id = None - self.location = None - self.deletion_date = None - self.scheduled_purge_date = None - self.purge_protection_enabled = None - self.tags = None - - -class DeletedVault(msrest.serialization.Model): - """Deleted vault information with extended details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID for the deleted key vault. - :vartype id: str - :ivar name: The name of the key vault. - :vartype name: str - :ivar type: The resource type of the key vault. - :vartype type: str - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedVault, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.properties = kwargs.get('properties', None) - - -class DeletedVaultListResult(msrest.serialization.Model): - """List of vaults. - - :param value: The list of deleted vaults. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVault] - :param next_link: The URL to get the next set of deleted vaults. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DeletedVault]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedVaultListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class DeletedVaultProperties(msrest.serialization.Model): - """Properties of the deleted vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar vault_id: The resource id of the original vault. - :vartype vault_id: str - :ivar location: The location of the original vault. - :vartype location: str - :ivar deletion_date: The deleted date. - :vartype deletion_date: ~datetime.datetime - :ivar scheduled_purge_date: The scheduled purged date. - :vartype scheduled_purge_date: ~datetime.datetime - :ivar tags: A set of tags. Tags of the original vault. - :vartype tags: dict[str, str] - :ivar purge_protection_enabled: Purge protection status of the original vault. - :vartype purge_protection_enabled: bool - """ - - _validation = { - 'vault_id': {'readonly': True}, - 'location': {'readonly': True}, - 'deletion_date': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - 'tags': {'readonly': True}, - 'purge_protection_enabled': {'readonly': True}, - } - - _attribute_map = { - 'vault_id': {'key': 'vaultId', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DeletedVaultProperties, self).__init__(**kwargs) - self.vault_id = None - self.location = None - self.deletion_date = None - self.scheduled_purge_date = None - self.tags = None - self.purge_protection_enabled = None - - -class DimensionProperties(msrest.serialization.Model): - """Type of operation: get, read, delete, etc. - - :param name: Name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported - for Shoebox. - :type to_be_exported_for_shoebox: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(DimensionProperties, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.to_be_exported_for_shoebox = kwargs.get('to_be_exported_for_shoebox', None) - - -class Error(msrest.serialization.Model): - """The server error. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar inner_error: The inner error, contains a more specific error code. - :vartype inner_error: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Error - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'inner_error': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'inner_error': {'key': 'innererror', 'type': 'Error'}, - } - - def __init__( - self, - **kwargs - ): - super(Error, self).__init__(**kwargs) - self.code = None - self.message = None - self.inner_error = None - - -class IPRule(msrest.serialization.Model): - """A rule governing the accessibility of a vault from a specific ip address or ip range. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple - IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). - :type value: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IPRule, self).__init__(**kwargs) - self.value = kwargs['value'] - - -class Resource(msrest.serialization.Model): - """Key Vault resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.tags = None - - -class Key(Resource): - """The key resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :param attributes: The attributes of the key. - :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes - :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". - :type kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :type key_size: int - :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". - :type curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName - :ivar key_uri: The URI to retrieve the current version of the key. - :vartype key_uri: str - :ivar key_uri_with_version: The URI to retrieve the specific version of the key. - :vartype key_uri_with_version: str - :param rotation_policy: Key rotation policy in response. It will be used for both output and - input. Omitted if empty. - :type rotation_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.RotationPolicy - :param release_policy: Key release policy in response. It will be used for both output and - input. Omitted if empty. - :type release_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyReleasePolicy - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - 'key_uri': {'readonly': True}, - 'key_uri_with_version': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'attributes': {'key': 'properties.attributes', 'type': 'KeyAttributes'}, - 'kty': {'key': 'properties.kty', 'type': 'str'}, - 'key_ops': {'key': 'properties.keyOps', 'type': '[str]'}, - 'key_size': {'key': 'properties.keySize', 'type': 'int'}, - 'curve_name': {'key': 'properties.curveName', 'type': 'str'}, - 'key_uri': {'key': 'properties.keyUri', 'type': 'str'}, - 'key_uri_with_version': {'key': 'properties.keyUriWithVersion', 'type': 'str'}, - 'rotation_policy': {'key': 'properties.rotationPolicy', 'type': 'RotationPolicy'}, - 'release_policy': {'key': 'properties.release_policy', 'type': 'KeyReleasePolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(Key, self).__init__(**kwargs) - self.attributes = kwargs.get('attributes', None) - self.kty = kwargs.get('kty', None) - self.key_ops = kwargs.get('key_ops', None) - self.key_size = kwargs.get('key_size', None) - self.curve_name = kwargs.get('curve_name', None) - self.key_uri = None - self.key_uri_with_version = None - self.rotation_policy = kwargs.get('rotation_policy', None) - self.release_policy = kwargs.get('release_policy', None) - - -class KeyAttributes(msrest.serialization.Model): - """The object attributes managed by the Azure Key Vault service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: Determines whether or not the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: long - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: long - :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. - :vartype created: long - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: long - :ivar recovery_level: The deletion recovery level currently in effect for the object. If it - contains 'Purgeable', then the object can be permanently deleted by a privileged user; - otherwise, only the system can purge the object at the end of the retention interval. Possible - values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", - "Recoverable+ProtectedSubscription". - :vartype recovery_level: str or - ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletionRecoveryLevel - :param exportable: Indicates if the private key can be exported. - :type exportable: bool - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - 'recovery_level': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'long'}, - 'expires': {'key': 'exp', 'type': 'long'}, - 'created': {'key': 'created', 'type': 'long'}, - 'updated': {'key': 'updated', 'type': 'long'}, - 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, - 'exportable': {'key': 'exportable', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyAttributes, self).__init__(**kwargs) - self.enabled = kwargs.get('enabled', None) - self.not_before = kwargs.get('not_before', None) - self.expires = kwargs.get('expires', None) - self.created = None - self.updated = None - self.recovery_level = None - self.exportable = kwargs.get('exportable', None) - - -class KeyCreateParameters(msrest.serialization.Model): - """The parameters used to create a key. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. The tags that will be assigned to the key. - :type tags: dict[str, str] - :param properties: Required. The properties of the key to be created. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'KeyProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyCreateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.properties = kwargs['properties'] - - -class KeyListResult(msrest.serialization.Model): - """The page of keys. - - :param value: The key resources. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Key] - :param next_link: The URL to get the next page of keys. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Key]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class KeyProperties(msrest.serialization.Model): - """The properties of the key. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param attributes: The attributes of the key. - :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes - :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". - :type kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :type key_size: int - :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". - :type curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName - :ivar key_uri: The URI to retrieve the current version of the key. - :vartype key_uri: str - :ivar key_uri_with_version: The URI to retrieve the specific version of the key. - :vartype key_uri_with_version: str - :param rotation_policy: Key rotation policy in response. It will be used for both output and - input. Omitted if empty. - :type rotation_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.RotationPolicy - :param release_policy: Key release policy in response. It will be used for both output and - input. Omitted if empty. - :type release_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyReleasePolicy - """ - - _validation = { - 'key_uri': {'readonly': True}, - 'key_uri_with_version': {'readonly': True}, - } - - _attribute_map = { - 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, - 'kty': {'key': 'kty', 'type': 'str'}, - 'key_ops': {'key': 'keyOps', 'type': '[str]'}, - 'key_size': {'key': 'keySize', 'type': 'int'}, - 'curve_name': {'key': 'curveName', 'type': 'str'}, - 'key_uri': {'key': 'keyUri', 'type': 'str'}, - 'key_uri_with_version': {'key': 'keyUriWithVersion', 'type': 'str'}, - 'rotation_policy': {'key': 'rotationPolicy', 'type': 'RotationPolicy'}, - 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyProperties, self).__init__(**kwargs) - self.attributes = kwargs.get('attributes', None) - self.kty = kwargs.get('kty', None) - self.key_ops = kwargs.get('key_ops', None) - self.key_size = kwargs.get('key_size', None) - self.curve_name = kwargs.get('curve_name', None) - self.key_uri = None - self.key_uri_with_version = None - self.rotation_policy = kwargs.get('rotation_policy', None) - self.release_policy = kwargs.get('release_policy', None) - - -class KeyReleasePolicy(msrest.serialization.Model): - """KeyReleasePolicy. - - :param content_type: Content type and version of key release policy. - :type content_type: str - :param data: Blob encoding the policy rules under which the key can be released. - :type data: bytes - """ - - _attribute_map = { - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'data': {'key': 'data', 'type': 'base64'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyReleasePolicy, self).__init__(**kwargs) - self.content_type = kwargs.get('content_type', "application/json; charset=utf-8") - self.data = kwargs.get('data', None) - - -class KeyRotationPolicyAttributes(msrest.serialization.Model): - """KeyRotationPolicyAttributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. - :vartype created: long - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: long - :param expiry_time: The expiration time for the new key version. It should be in ISO8601 - format. Eg: 'P90D', 'P1Y'. - :type expiry_time: str - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - } - - _attribute_map = { - 'created': {'key': 'created', 'type': 'long'}, - 'updated': {'key': 'updated', 'type': 'long'}, - 'expiry_time': {'key': 'expiryTime', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyRotationPolicyAttributes, self).__init__(**kwargs) - self.created = None - self.updated = None - self.expiry_time = kwargs.get('expiry_time', None) - - -class LifetimeAction(msrest.serialization.Model): - """LifetimeAction. - - :param trigger: The trigger of key rotation policy lifetimeAction. - :type trigger: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Trigger - :param action: The action of key rotation policy lifetimeAction. - :type action: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Action - """ - - _attribute_map = { - 'trigger': {'key': 'trigger', 'type': 'Trigger'}, - 'action': {'key': 'action', 'type': 'Action'}, - } - - def __init__( - self, - **kwargs - ): - super(LifetimeAction, self).__init__(**kwargs) - self.trigger = kwargs.get('trigger', None) - self.action = kwargs.get('action', None) - - -class LogSpecification(msrest.serialization.Model): - """Log specification of operation. - - :param name: Name of log specification. - :type name: str - :param display_name: Display name of log specification. - :type display_name: str - :param blob_duration: Blob duration of specification. - :type blob_duration: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class ManagedHsmResource(msrest.serialization.Model): - """Managed HSM resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. - :vartype id: str - :ivar name: The name of the managed HSM Pool. - :vartype name: str - :ivar type: The resource type of the managed HSM Pool. - :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the key vault - resource. - :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.sku = kwargs.get('sku', None) - self.tags = kwargs.get('tags', None) - self.system_data = None - - -class ManagedHsm(ManagedHsmResource): - """Resource information with extended details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. - :vartype id: str - :ivar name: The name of the managed HSM Pool. - :vartype name: str - :ivar type: The resource type of the managed HSM Pool. - :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the key vault - resource. - :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData - :param properties: Properties of the managed HSM. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'ManagedHsmProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsm, self).__init__(**kwargs) - self.properties = kwargs.get('properties', None) - - -class ManagedHsmError(msrest.serialization.Model): - """The error exception. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: The server error. - :vartype error: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Error - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'Error'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmError, self).__init__(**kwargs) - self.error = None - - -class ManagedHsmListResult(msrest.serialization.Model): - """List of managed HSM Pools. - - :param value: The list of managed HSM Pools. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] - :param next_link: The URL to get the next set of managed HSM Pools. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedHsm]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ManagedHsmProperties(msrest.serialization.Model): - """Properties of the managed HSM Pool. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating - requests to the managed HSM pool. - :type tenant_id: str - :param initial_admin_object_ids: Array of initial administrators object ids for this managed - hsm pool. - :type initial_admin_object_ids: list[str] - :ivar hsm_uri: The URI of the managed hsm pool for performing operations on keys. - :vartype hsm_uri: str - :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is - enabled for this managed HSM pool. If it's not set to any value(true or false) when creating - new managed HSM pool, it will be set to true by default. Once set to true, it cannot be - reverted to false. - :type enable_soft_delete: bool - :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. - :type soft_delete_retention_in_days: int - :param enable_purge_protection: Property specifying whether protection against purge is enabled - for this managed HSM pool. Setting this property to true activates protection against purge for - this managed HSM pool and its content - only the Managed HSM service may initiate a hard, - irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling - this functionality is irreversible. - :type enable_purge_protection: bool - :param create_mode: The create mode to indicate whether the resource is being created or is - being recovered from a deleted resource. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode - :ivar status_message: Resource Status Message. - :vartype status_message: str - :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", - "Provisioning", "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", - "Restoring". - :vartype provisioning_state: str or - ~azure.mgmt.keyvault.v2021_06_01_preview.models.ProvisioningState - :param network_acls: Rules governing the accessibility of the key vault from specific network - locations. - :type network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMNetworkRuleSet - :ivar private_endpoint_connections: List of private endpoint connections associated with the - managed hsm pool. - :vartype private_endpoint_connections: - list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionItem] - :param public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~azure.mgmt.keyvault.v2021_06_01_preview.models.PublicNetworkAccess - :ivar scheduled_purge_date: The scheduled purge date in UTC. - :vartype scheduled_purge_date: ~datetime.datetime - """ - - _validation = { - 'hsm_uri': {'readonly': True}, - 'status_message': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - 'scheduled_purge_date': {'readonly': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'initial_admin_object_ids': {'key': 'initialAdminObjectIds', 'type': '[str]'}, - 'hsm_uri': {'key': 'hsmUri', 'type': 'str'}, - 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, - 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'status_message': {'key': 'statusMessage', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'network_acls': {'key': 'networkAcls', 'type': 'MHSMNetworkRuleSet'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[MHSMPrivateEndpointConnectionItem]'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmProperties, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.initial_admin_object_ids = kwargs.get('initial_admin_object_ids', None) - self.hsm_uri = None - self.enable_soft_delete = kwargs.get('enable_soft_delete', True) - self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', 90) - self.enable_purge_protection = kwargs.get('enable_purge_protection', True) - self.create_mode = kwargs.get('create_mode', None) - self.status_message = None - self.provisioning_state = None - self.network_acls = kwargs.get('network_acls', None) - self.private_endpoint_connections = None - self.public_network_access = kwargs.get('public_network_access', None) - self.scheduled_purge_date = None - - -class ManagedHsmSku(msrest.serialization.Model): - """SKU details. - - All required parameters must be populated in order to send to Azure. - - :param family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". - :type family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuFamily - :param name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", - "Custom_B32". - :type name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuName - """ - - _validation = { - 'family': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedHsmSku, self).__init__(**kwargs) - self.family = kwargs.get('family', "B") - self.name = kwargs['name'] - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. - :type unit: str - :param aggregation_type: The metric aggregation type. Possible values include: 'Average', - 'Count', 'Total'. - :type aggregation_type: str - :param supported_aggregation_types: The supported aggregation types for the metrics. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: The supported time grain types for the metrics. - :type supported_time_grain_types: list[str] - :param lock_aggregation_type: The metric lock aggregation type. - :type lock_aggregation_type: str - :param dimensions: The dimensions of metric. - :type dimensions: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DimensionProperties] - :param fill_gap_with_zero: Property to specify whether to fill gap with zero. - :type fill_gap_with_zero: bool - :param internal_metric_name: The internal metric name. - :type internal_metric_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.lock_aggregation_type = kwargs.get('lock_aggregation_type', None) - self.dimensions = kwargs.get('dimensions', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.internal_metric_name = kwargs.get('internal_metric_name', None) - - -class MHSMIPRule(msrest.serialization.Model): - """A rule governing the accessibility of a managed hsm pool from a specific ip address or ip range. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple - IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). - :type value: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMIPRule, self).__init__(**kwargs) - self.value = kwargs['value'] - - -class MHSMNetworkRuleSet(msrest.serialization.Model): - """A set of rules governing the network accessibility of a managed hsm pool. - - :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". - :type bypass: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and from - virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction - :param ip_rules: The list of IP address rules. - :type ip_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMIPRule] - :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMVirtualNetworkRule] - """ - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'ip_rules': {'key': 'ipRules', 'type': '[MHSMIPRule]'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[MHSMVirtualNetworkRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMNetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', None) - self.default_action = kwargs.get('default_action', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - - -class MHSMPrivateEndpoint(msrest.serialization.Model): - """Private endpoint object properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Full identifier of the private endpoint resource. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class MHSMPrivateEndpointConnection(ManagedHsmResource): - """Private endpoint connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. - :vartype id: str - :ivar name: The name of the managed HSM Pool. - :vartype name: str - :ivar type: The resource type of the managed HSM Pool. - :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the key vault - resource. - :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: - ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or - ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateEndpointConnection, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): - """Private endpoint connection item. - - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: - ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or - ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState - """ - - _attribute_map = { - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateEndpointConnectionItem, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class MHSMPrivateEndpointConnectionsListResult(msrest.serialization.Model): - """List of private endpoint connections associated with a managed HSM Pools. - - :param value: The private endpoint connection associated with a managed HSM Pools. - :type value: - list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] - :param next_link: The URL to get the next set of managed HSM Pools. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MHSMPrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateEndpointConnectionsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class MHSMPrivateLinkResource(ManagedHsmResource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. - :vartype id: str - :ivar name: The name of the managed HSM Pool. - :vartype name: str - :ivar type: The resource type of the managed HSM Pool. - :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the key vault - resource. - :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData - :ivar group_id: Group identifier of private link resource. - :vartype group_id: str - :ivar required_members: Required member names of private link resource. - :vartype required_members: list[str] - :param required_zone_names: Required DNS zone names of the the private link resource. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class MHSMPrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MHSMPrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): - """An object that represents the approval state of the private link connection. - - :param status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or - ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval or rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". - :type actions_required: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMPrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class MHSMVirtualNetworkRule(msrest.serialization.Model): - """A rule governing the accessibility of a managed hsm pool from a specific virtual network. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MHSMVirtualNetworkRule, self).__init__(**kwargs) - self.id = kwargs['id'] - - -class NetworkRuleSet(msrest.serialization.Model): - """A set of rules governing the network accessibility of a vault. - - :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". - :type bypass: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and from - virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction - :param ip_rules: The list of IP address rules. - :type ip_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.IPRule] - :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: - list[~azure.mgmt.keyvault.v2021_06_01_preview.models.VirtualNetworkRule] - """ - - _attribute_map = { - 'bypass': {'key': 'bypass', 'type': 'str'}, - 'default_action': {'key': 'defaultAction', 'type': 'str'}, - 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, - 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(NetworkRuleSet, self).__init__(**kwargs) - self.bypass = kwargs.get('bypass', None) - self.default_action = kwargs.get('default_action', None) - self.ip_rules = kwargs.get('ip_rules', None) - self.virtual_network_rules = kwargs.get('virtual_network_rules', None) - - -class Operation(msrest.serialization.Model): - """Key Vault REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param is_data_action: Property to specify whether the action is a data action. - :type is_data_action: bool - :param service_specification: One property of operation, include metric specifications. - :type service_specification: - ~azure.mgmt.keyvault.v2021_06_01_preview.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft Key Vault. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Operation] - :param next_link: The URL to get the next set of operations. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class Permissions(msrest.serialization.Model): - """Permissions the identity has for keys, secrets, certificates and storage. - - :param keys: Permissions to keys. - :type keys: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyPermissions] - :param secrets: Permissions to secrets. - :type secrets: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPermissions] - :param certificates: Permissions to certificates. - :type certificates: list[str or - ~azure.mgmt.keyvault.v2021_06_01_preview.models.CertificatePermissions] - :param storage: Permissions to storage accounts. - :type storage: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.StoragePermissions] - """ - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[str]'}, - 'secrets': {'key': 'secrets', 'type': '[str]'}, - 'certificates': {'key': 'certificates', 'type': '[str]'}, - 'storage': {'key': 'storage', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Permissions, self).__init__(**kwargs) - self.keys = kwargs.get('keys', None) - self.secrets = kwargs.get('secrets', None) - self.certificates = kwargs.get('certificates', None) - self.storage = kwargs.get('storage', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """Private endpoint object properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Full identifier of the private endpoint resource. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(Resource): - """Private endpoint connection resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: - ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or - ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.etag = kwargs.get('etag', None) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class PrivateEndpointConnectionItem(msrest.serialization.Model): - """Private endpoint connection item. - - :param id: Id of private endpoint connection. - :type id: str - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: - ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or - ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionItem, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.etag = kwargs.get('etag', None) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """List of private endpoint connections. - - :param value: The list of private endpoint connections. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] - :param next_link: The URL to get the next set of private endpoint connections. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :ivar group_id: Group identifier of private link resource. - :vartype group_id: str - :ivar required_members: Required member names of private link resource. - :vartype required_members: list[str] - :param required_zone_names: Required DNS zone names of the the private link resource. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """An object that represents the approval state of the private link connection. - - :param status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". - :type status: str or - ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval or rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". - :type actions_required: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class ResourceListResult(msrest.serialization.Model): - """List of vault resources. - - :param value: The list of vault resources. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Resource] - :param next_link: The URL to get the next set of vault resources. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Resource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class RotationPolicy(msrest.serialization.Model): - """RotationPolicy. - - :param attributes: The attributes of key rotation policy. - :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyAttributes - :param lifetime_actions: The lifetimeActions for key rotation action. - :type lifetime_actions: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.LifetimeAction] - """ - - _attribute_map = { - 'attributes': {'key': 'attributes', 'type': 'KeyRotationPolicyAttributes'}, - 'lifetime_actions': {'key': 'lifetimeActions', 'type': '[LifetimeAction]'}, - } - - def __init__( - self, - **kwargs - ): - super(RotationPolicy, self).__init__(**kwargs) - self.attributes = kwargs.get('attributes', None) - self.lifetime_actions = kwargs.get('lifetime_actions', None) - - -class Secret(Resource): - """Resource information with extended details. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :ivar location: Azure location of the key vault resource. - :vartype location: str - :ivar tags: A set of tags. Tags assigned to the key vault resource. - :vartype tags: dict[str, str] - :param properties: Required. Properties of the secret. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'tags': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'SecretProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Secret, self).__init__(**kwargs) - self.properties = kwargs['properties'] - - -class SecretAttributes(Attributes): - """The secret management attributes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param enabled: Determines whether the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: ~datetime.datetime - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: ~datetime.datetime - :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. - :vartype created: ~datetime.datetime - :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. - :vartype updated: ~datetime.datetime - """ - - _validation = { - 'created': {'readonly': True}, - 'updated': {'readonly': True}, - } - - _attribute_map = { - 'enabled': {'key': 'enabled', 'type': 'bool'}, - 'not_before': {'key': 'nbf', 'type': 'unix-time'}, - 'expires': {'key': 'exp', 'type': 'unix-time'}, - 'created': {'key': 'created', 'type': 'unix-time'}, - 'updated': {'key': 'updated', 'type': 'unix-time'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretAttributes, self).__init__(**kwargs) - - -class SecretCreateOrUpdateParameters(msrest.serialization.Model): - """Parameters for creating or updating a secret. - - All required parameters must be populated in order to send to Azure. - - :param tags: A set of tags. The tags that will be assigned to the secret. - :type tags: dict[str, str] - :param properties: Required. Properties of the secret. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretProperties - """ - - _validation = { - 'properties': {'required': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'SecretProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretCreateOrUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.properties = kwargs['properties'] - - -class SecretListResult(msrest.serialization.Model): - """List of secrets. - - :param value: The list of secrets. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret] - :param next_link: The URL to get the next set of secrets. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Secret]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class SecretPatchParameters(msrest.serialization.Model): - """Parameters for patching a secret. - - :param tags: A set of tags. The tags that will be assigned to the secret. - :type tags: dict[str, str] - :param properties: Properties of the secret. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPatchProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'SecretPatchProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretPatchParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) - - -class SecretPatchProperties(msrest.serialization.Model): - """Properties of the secret. - - :param value: The value of the secret. - :type value: str - :param content_type: The content type of the secret. - :type content_type: str - :param attributes: The attributes of the secret. - :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretAttributes - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretPatchProperties, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.content_type = kwargs.get('content_type', None) - self.attributes = kwargs.get('attributes', None) - - -class SecretProperties(msrest.serialization.Model): - """Properties of the secret. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: The value of the secret. NOTE: 'value' will never be returned from the service, - as APIs using this model are is intended for internal use in ARM deployments. Users should use - the data-plane REST service for interaction with vault secrets. - :type value: str - :param content_type: The content type of the secret. - :type content_type: str - :param attributes: The attributes of the secret. - :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretAttributes - :ivar secret_uri: The URI to retrieve the current version of the secret. - :vartype secret_uri: str - :ivar secret_uri_with_version: The URI to retrieve the specific version of the secret. - :vartype secret_uri_with_version: str - """ - - _validation = { - 'secret_uri': {'readonly': True}, - 'secret_uri_with_version': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - 'content_type': {'key': 'contentType', 'type': 'str'}, - 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, - 'secret_uri': {'key': 'secretUri', 'type': 'str'}, - 'secret_uri_with_version': {'key': 'secretUriWithVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SecretProperties, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.content_type = kwargs.get('content_type', None) - self.attributes = kwargs.get('attributes', None) - self.secret_uri = None - self.secret_uri_with_version = None - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include log specifications. - - :param log_specifications: Log specifications of operation. - :type log_specifications: - list[~azure.mgmt.keyvault.v2021_06_01_preview.models.LogSpecification] - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: - list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MetricSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - self.metric_specifications = kwargs.get('metric_specifications', None) - - -class Sku(msrest.serialization.Model): - """SKU details. - - All required parameters must be populated in order to send to Azure. - - :param family: Required. SKU family name. Possible values include: "A". - :type family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuFamily - :param name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". - :type name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuName - """ - - _validation = { - 'family': {'required': True}, - 'name': {'required': True}, - } - - _attribute_map = { - 'family': {'key': 'family', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.family = kwargs.get('family', "A") - self.name = kwargs['name'] - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the key vault resource. - - :param created_by: The identity that created the key vault resource. - :type created_by: str - :param created_by_type: The type of identity that created the key vault resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType - :param created_at: The timestamp of the key vault resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the key vault resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the key vault resource. - Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or - ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType - :param last_modified_at: The timestamp of the key vault resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Trigger(msrest.serialization.Model): - """Trigger. - - :param time_after_create: The time duration after key creation to rotate the key. It only - applies to rotate. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. - :type time_after_create: str - :param time_before_expiry: The time duration before key expiring to rotate or notify. It will - be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. - :type time_before_expiry: str - """ - - _attribute_map = { - 'time_after_create': {'key': 'timeAfterCreate', 'type': 'str'}, - 'time_before_expiry': {'key': 'timeBeforeExpiry', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Trigger, self).__init__(**kwargs) - self.time_after_create = kwargs.get('time_after_create', None) - self.time_before_expiry = kwargs.get('time_before_expiry', None) - - -class Vault(msrest.serialization.Model): - """Resource information with extended details. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified identifier of the key vault resource. - :vartype id: str - :ivar name: Name of the key vault resource. - :vartype name: str - :ivar type: Resource type of the key vault resource. - :vartype type: str - :param location: Azure location of the key vault resource. - :type location: str - :param tags: A set of tags. Tags assigned to the key vault resource. - :type tags: dict[str, str] - :ivar system_data: System metadata for the key vault. - :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'properties': {'key': 'properties', 'type': 'VaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(Vault, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.system_data = None - self.properties = kwargs['properties'] - - -class VaultAccessPolicyParameters(msrest.serialization.Model): - """Parameters for updating the access policy in a vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: The resource id of the access policy. - :vartype id: str - :ivar name: The resource name of the access policy. - :vartype name: str - :ivar type: The resource name of the access policy. - :vartype type: str - :ivar location: The resource type of the access policy. - :vartype location: str - :param properties: Required. Properties of the access policy. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'VaultAccessPolicyProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultAccessPolicyParameters, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = None - self.properties = kwargs['properties'] - - -class VaultAccessPolicyProperties(msrest.serialization.Model): - """Properties of the vault access policy. - - All required parameters must be populated in order to send to Azure. - - :param access_policies: Required. An array of 0 to 16 identities that have access to the key - vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. - :type access_policies: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] - """ - - _validation = { - 'access_policies': {'required': True}, - } - - _attribute_map = { - 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultAccessPolicyProperties, self).__init__(**kwargs) - self.access_policies = kwargs['access_policies'] - - -class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): - """The parameters used to check the availability of the vault name. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The vault name. - :type name: str - :ivar type: The type of resource, Microsoft.KeyVault/vaults. Has constant value: - "Microsoft.KeyVault/vaults". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.KeyVault/vaults" - - def __init__( - self, - **kwargs - ): - super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class VaultCreateOrUpdateParameters(msrest.serialization.Model): - """Parameters for creating or updating a vault. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. The supported Azure location where the key vault should be created. - :type location: str - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProperties - """ - - _validation = { - 'location': {'required': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'VaultProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.properties = kwargs['properties'] - - -class VaultListResult(msrest.serialization.Model): - """List of vaults. - - :param value: The list of vaults. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] - :param next_link: The URL to get the next set of vaults. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Vault]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class VaultPatchParameters(msrest.serialization.Model): - """Parameters for creating or updating a vault. - - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultPatchProperties - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultPatchParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.properties = kwargs.get('properties', None) - - -class VaultPatchProperties(msrest.serialization.Model): - """Properties of the vault. - - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating - requests to the key vault. - :type tenant_id: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to the key vault. All - identities in the array must use the same tenant ID as the key vault's tenant ID. - :type access_policies: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted - to retrieve certificates stored as secrets from the key vault. - :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is - permitted to retrieve secrets from the vault and unwrap keys. - :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is - permitted to retrieve secrets from the key vault. - :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is - enabled for this key vault. Once set to true, it cannot be reverted to false. - :type enable_soft_delete: bool - :param enable_rbac_authorization: Property that controls how data actions are authorized. When - true, the key vault will use Role Based Access Control (RBAC) for authorization of data - actions, and the access policies specified in vault properties will be ignored (warning: this - is a preview feature). When false, the key vault will use the access policies specified in - vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or - not specified, the value of this property will not change. - :type enable_rbac_authorization: bool - :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. - :type soft_delete_retention_in_days: int - :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode - :param enable_purge_protection: Property specifying whether protection against purge is enabled - for this vault. Setting this property to true activates protection against purge for this vault - and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this functionality is - irreversible - that is, the property does not accept false as its value. - :type enable_purge_protection: bool - :param network_acls: A collection of rules governing the accessibility of the vault from - specific network locations. - :type network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet - :param public_network_access: Property to specify whether the vault will accept traffic from - public internet. If set to 'disabled' all traffic except private endpoint traffic and that that - originates from trusted services will be blocked. This will override the set firewall rules, - meaning that even if the firewall rules are present we will not honor the rules. - :type public_network_access: str - """ - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, - 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, - 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, - 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, - 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, - 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, - 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultPatchProperties, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.sku = kwargs.get('sku', None) - self.access_policies = kwargs.get('access_policies', None) - self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) - self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) - self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) - self.enable_soft_delete = kwargs.get('enable_soft_delete', None) - self.enable_rbac_authorization = kwargs.get('enable_rbac_authorization', None) - self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', None) - self.create_mode = kwargs.get('create_mode', None) - self.enable_purge_protection = kwargs.get('enable_purge_protection', None) - self.network_acls = kwargs.get('network_acls', None) - self.public_network_access = kwargs.get('public_network_access', None) - - -class VaultProperties(msrest.serialization.Model): - """Properties of the vault. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param tenant_id: Required. The Azure Active Directory tenant ID that should be used for - authenticating requests to the key vault. - :type tenant_id: str - :param sku: Required. SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Sku - :param access_policies: An array of 0 to 1024 identities that have access to the key vault. All - identities in the array must use the same tenant ID as the key vault's tenant ID. When - ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access - policies are required. - :type access_policies: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. - :type vault_uri: str - :ivar hsm_pool_resource_id: The resource id of HSM Pool. - :vartype hsm_pool_resource_id: str - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted - to retrieve certificates stored as secrets from the key vault. - :type enabled_for_deployment: bool - :param enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is - permitted to retrieve secrets from the vault and unwrap keys. - :type enabled_for_disk_encryption: bool - :param enabled_for_template_deployment: Property to specify whether Azure Resource Manager is - permitted to retrieve secrets from the key vault. - :type enabled_for_template_deployment: bool - :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is - enabled for this key vault. If it's not set to any value(true or false) when creating new key - vault, it will be set to true by default. Once set to true, it cannot be reverted to false. - :type enable_soft_delete: bool - :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. - :type soft_delete_retention_in_days: int - :param enable_rbac_authorization: Property that controls how data actions are authorized. When - true, the key vault will use Role Based Access Control (RBAC) for authorization of data - actions, and the access policies specified in vault properties will be ignored (warning: this - is a preview feature). When false, the key vault will use the access policies specified in - vault properties, and any policy stored on Azure Resource Manager will be ignored. If null or - not specified, the vault is created with the default value of false. Note that management - actions are always authorized with RBAC. - :type enable_rbac_authorization: bool - :param create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode - :param enable_purge_protection: Property specifying whether protection against purge is enabled - for this vault. Setting this property to true activates protection against purge for this vault - and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The - setting is effective only if soft delete is also enabled. Enabling this functionality is - irreversible - that is, the property does not accept false as its value. - :type enable_purge_protection: bool - :param network_acls: Rules governing the accessibility of the key vault from specific network - locations. - :type network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet - :param provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". - :type provisioning_state: str or - ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProvisioningState - :ivar private_endpoint_connections: List of private endpoint connections associated with the - key vault. - :vartype private_endpoint_connections: - list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionItem] - :param public_network_access: Property to specify whether the vault will accept traffic from - public internet. If set to 'disabled' all traffic except private endpoint traffic and that that - originates from trusted services will be blocked. This will override the set firewall rules, - meaning that even if the firewall rules are present we will not honor the rules. - :type public_network_access: str - """ - - _validation = { - 'tenant_id': {'required': True}, - 'sku': {'required': True}, - 'hsm_pool_resource_id': {'readonly': True}, - 'private_endpoint_connections': {'readonly': True}, - } - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'Sku'}, - 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, - 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, - 'hsm_pool_resource_id': {'key': 'hsmPoolResourceId', 'type': 'str'}, - 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, - 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, - 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, - 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, - 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, - 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, - 'create_mode': {'key': 'createMode', 'type': 'str'}, - 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, - 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, - 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultProperties, self).__init__(**kwargs) - self.tenant_id = kwargs['tenant_id'] - self.sku = kwargs['sku'] - self.access_policies = kwargs.get('access_policies', None) - self.vault_uri = kwargs.get('vault_uri', None) - self.hsm_pool_resource_id = None - self.enabled_for_deployment = kwargs.get('enabled_for_deployment', None) - self.enabled_for_disk_encryption = kwargs.get('enabled_for_disk_encryption', None) - self.enabled_for_template_deployment = kwargs.get('enabled_for_template_deployment', None) - self.enable_soft_delete = kwargs.get('enable_soft_delete', True) - self.soft_delete_retention_in_days = kwargs.get('soft_delete_retention_in_days', 90) - self.enable_rbac_authorization = kwargs.get('enable_rbac_authorization', False) - self.create_mode = kwargs.get('create_mode', None) - self.enable_purge_protection = kwargs.get('enable_purge_protection', None) - self.network_acls = kwargs.get('network_acls', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - self.private_endpoint_connections = None - self.public_network_access = kwargs.get('public_network_access', "enabled") - - -class VirtualNetworkRule(msrest.serialization.Model): - """A rule governing the accessibility of a vault from a specific virtual network. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - :type id: str - :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the - check if parent subnet has serviceEndpoints configured. - :type ignore_missing_vnet_service_endpoint: bool - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkRule, self).__init__(**kwargs) - self.id = kwargs['id'] - self.ignore_missing_vnet_service_endpoint = kwargs.get('ignore_missing_vnet_service_endpoint', None) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models_py3.py index 4817f3781450..a0f5c3e21330 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models_py3.py @@ -20,17 +20,17 @@ class AccessPolicyEntry(msrest.serialization.Model): 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 + :ivar 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 + :vartype tenant_id: str + :ivar object_id: Required. The object ID of a user, service principal or security group in the Azure Active Directory tenant for the vault. The object ID must be unique for the list of access policies. - :type object_id: str - :param application_id: Application ID of the client making request on behalf of a principal. - :type application_id: str - :param permissions: Required. Permissions the identity has for keys, secrets and certificates. - :type permissions: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Permissions + :vartype object_id: str + :ivar application_id: Application ID of the client making request on behalf of a principal. + :vartype application_id: str + :ivar permissions: Required. Permissions the identity has for keys, secrets and certificates. + :vartype permissions: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Permissions """ _validation = { @@ -55,6 +55,20 @@ def __init__( application_id: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword 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. + :paramtype object_id: str + :keyword application_id: Application ID of the client making request on behalf of a principal. + :paramtype application_id: str + :keyword permissions: Required. Permissions the identity has for keys, secrets and + certificates. + :paramtype permissions: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Permissions + """ super(AccessPolicyEntry, self).__init__(**kwargs) self.tenant_id = tenant_id self.object_id = object_id @@ -65,8 +79,9 @@ def __init__( class Action(msrest.serialization.Model): """Action. - :param type: The type of action. Possible values include: "rotate", "notify". - :type type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyActionType + :ivar type: The type of action. Possible values include: "rotate", "notify". + :vartype type: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyActionType """ _attribute_map = { @@ -79,6 +94,11 @@ def __init__( type: Optional[Union[str, "KeyRotationPolicyActionType"]] = None, **kwargs ): + """ + :keyword type: The type of action. Possible values include: "rotate", "notify". + :paramtype type: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyActionType + """ super(Action, self).__init__(**kwargs) self.type = type @@ -88,12 +108,12 @@ class Attributes(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: Determines whether the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: ~datetime.datetime - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: ~datetime.datetime + :ivar enabled: Determines whether the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :vartype not_before: ~datetime.datetime + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: ~datetime.datetime :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. :vartype created: ~datetime.datetime :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. @@ -121,6 +141,14 @@ def __init__( expires: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword enabled: Determines whether the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :paramtype not_before: ~datetime.datetime + :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :paramtype expires: ~datetime.datetime + """ super(Attributes, self).__init__(**kwargs) self.enabled = enabled self.not_before = not_before @@ -162,6 +190,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -171,11 +201,11 @@ def __init__( 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 + :ivar code: Error code. This is a mnemonic that can be consumed programmatically. + :vartype code: str + :ivar message: User friendly error message. The message is typically localized and may vary with service version. - :type message: str + :vartype message: str """ _attribute_map = { @@ -190,6 +220,13 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Error code. This is a mnemonic that can be consumed programmatically. + :paramtype code: str + :keyword message: User friendly error message. The message is typically localized and may vary + with service version. + :paramtype message: str + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -206,8 +243,9 @@ class DeletedManagedHsm(msrest.serialization.Model): :vartype name: str :ivar type: The resource type of the managed HSM Pool. :vartype type: str - :param properties: Properties of the deleted managed HSM. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmProperties + :ivar properties: Properties of the deleted managed HSM. + :vartype properties: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmProperties """ _validation = { @@ -229,6 +267,11 @@ def __init__( properties: Optional["DeletedManagedHsmProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the deleted managed HSM. + :paramtype properties: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmProperties + """ super(DeletedManagedHsm, self).__init__(**kwargs) self.id = None self.name = None @@ -239,10 +282,10 @@ def __init__( class DeletedManagedHsmListResult(msrest.serialization.Model): """List of deleted managed HSM Pools. - :param value: The list of deleted managed HSM Pools. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsm] - :param next_link: The URL to get the next set of deleted managed HSM Pools. - :type next_link: str + :ivar value: The list of deleted managed HSM Pools. + :vartype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsm] + :ivar next_link: The URL to get the next set of deleted managed HSM Pools. + :vartype next_link: str """ _attribute_map = { @@ -257,6 +300,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of deleted managed HSM Pools. + :paramtype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsm] + :keyword next_link: The URL to get the next set of deleted managed HSM Pools. + :paramtype next_link: str + """ super(DeletedManagedHsmListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -303,6 +352,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedManagedHsmProperties, self).__init__(**kwargs) self.mhsm_id = None self.location = None @@ -323,8 +374,8 @@ class DeletedVault(msrest.serialization.Model): :vartype name: str :ivar type: The resource type of the key vault. :vartype type: str - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultProperties + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultProperties """ _validation = { @@ -346,6 +397,10 @@ def __init__( properties: Optional["DeletedVaultProperties"] = None, **kwargs ): + """ + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultProperties + """ super(DeletedVault, self).__init__(**kwargs) self.id = None self.name = None @@ -356,10 +411,10 @@ def __init__( class DeletedVaultListResult(msrest.serialization.Model): """List of vaults. - :param value: The list of deleted vaults. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVault] - :param next_link: The URL to get the next set of deleted vaults. - :type next_link: str + :ivar value: The list of deleted vaults. + :vartype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVault] + :ivar next_link: The URL to get the next set of deleted vaults. + :vartype next_link: str """ _attribute_map = { @@ -374,6 +429,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of deleted vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVault] + :keyword next_link: The URL to get the next set of deleted vaults. + :paramtype next_link: str + """ super(DeletedVaultListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -420,6 +481,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -432,13 +495,13 @@ def __init__( class DimensionProperties(msrest.serialization.Model): """Type of operation: get, read, delete, etc. - :param name: Name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - :param to_be_exported_for_shoebox: Property to specify whether the dimension should be exported + :ivar name: Name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Property to specify whether the dimension should be exported for Shoebox. - :type to_be_exported_for_shoebox: bool + :vartype to_be_exported_for_shoebox: bool """ _attribute_map = { @@ -455,6 +518,15 @@ def __init__( to_be_exported_for_shoebox: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Property to specify whether the dimension should be + exported for Shoebox. + :paramtype to_be_exported_for_shoebox: bool + """ super(DimensionProperties, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -490,6 +562,8 @@ def __init__( self, **kwargs ): + """ + """ super(Error, self).__init__(**kwargs) self.code = None self.message = None @@ -501,9 +575,9 @@ class IPRule(msrest.serialization.Model): 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 + :ivar 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 + :vartype value: str """ _validation = { @@ -520,6 +594,11 @@ def __init__( value: str, **kwargs ): + """ + :keyword 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). + :paramtype value: str + """ super(IPRule, self).__init__(**kwargs) self.value = value @@ -561,6 +640,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -584,28 +665,29 @@ class Key(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] - :param attributes: The attributes of the key. - :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes - :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + :ivar attributes: The attributes of the key. + :vartype attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM". - :type kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :type key_size: int - :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + :vartype kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType + :ivar key_ops: + :vartype key_ops: list[str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :vartype key_size: int + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: "P-256", "P-384", "P-521", "P-256K". - :type curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName + :vartype curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str :ivar key_uri_with_version: The URI to retrieve the specific version of the key. :vartype key_uri_with_version: str - :param rotation_policy: Key rotation policy in response. It will be used for both output and + :ivar rotation_policy: Key rotation policy in response. It will be used for both output and input. Omitted if empty. - :type rotation_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.RotationPolicy - :param release_policy: Key release policy in response. It will be used for both output and + :vartype rotation_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.RotationPolicy + :ivar release_policy: Key release policy in response. It will be used for both output and input. Omitted if empty. - :type release_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyReleasePolicy + :vartype release_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyReleasePolicy """ _validation = { @@ -647,6 +729,28 @@ def __init__( release_policy: Optional["KeyReleasePolicy"] = None, **kwargs ): + """ + :keyword attributes: The attributes of the key. + :paramtype attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values + include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :paramtype kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType + :keyword key_ops: + :paramtype key_ops: list[str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] + :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :paramtype key_size: int + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. + Possible values include: "P-256", "P-384", "P-521", "P-256K". + :paramtype curve_name: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName + :keyword rotation_policy: Key rotation policy in response. It will be used for both output and + input. Omitted if empty. + :paramtype rotation_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.RotationPolicy + :keyword release_policy: Key release policy in response. It will be used for both output and + input. Omitted if empty. + :paramtype release_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyReleasePolicy + """ super(Key, self).__init__(**kwargs) self.attributes = attributes self.kty = kty @@ -664,12 +768,12 @@ class KeyAttributes(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: Determines whether or not the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: long - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: long + :ivar enabled: Determines whether or not the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :vartype not_before: long + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: long :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. :vartype created: long :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. @@ -681,8 +785,8 @@ class KeyAttributes(msrest.serialization.Model): "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletionRecoveryLevel - :param exportable: Indicates if the private key can be exported. - :type exportable: bool + :ivar exportable: Indicates if the private key can be exported. + :vartype exportable: bool """ _validation = { @@ -710,6 +814,16 @@ def __init__( exportable: Optional[bool] = None, **kwargs ): + """ + :keyword enabled: Determines whether or not the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :paramtype not_before: long + :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :paramtype expires: long + :keyword exportable: Indicates if the private key can be exported. + :paramtype exportable: bool + """ super(KeyAttributes, self).__init__(**kwargs) self.enabled = enabled self.not_before = not_before @@ -725,10 +839,10 @@ class KeyCreateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. The tags that will be assigned to the key. - :type tags: dict[str, str] - :param properties: Required. The properties of the key to be created. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyProperties + :ivar tags: A set of tags. The tags that will be assigned to the key. + :vartype tags: dict[str, str] + :ivar properties: Required. The properties of the key to be created. + :vartype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyProperties """ _validation = { @@ -747,6 +861,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the key. + :paramtype tags: dict[str, str] + :keyword properties: Required. The properties of the key to be created. + :paramtype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyProperties + """ super(KeyCreateParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -755,10 +875,10 @@ def __init__( class KeyListResult(msrest.serialization.Model): """The page of keys. - :param value: The key resources. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Key] - :param next_link: The URL to get the next page of keys. - :type next_link: str + :ivar value: The key resources. + :vartype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Key] + :ivar next_link: The URL to get the next page of keys. + :vartype next_link: str """ _attribute_map = { @@ -773,6 +893,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The key resources. + :paramtype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Key] + :keyword next_link: The URL to get the next page of keys. + :paramtype next_link: str + """ super(KeyListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -783,28 +909,29 @@ class KeyProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param attributes: The attributes of the key. - :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes - :param kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: + :ivar attributes: The attributes of the key. + :vartype attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: "EC", "EC-HSM", "RSA", "RSA-HSM". - :type kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType - :param key_ops: - :type key_ops: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] - :param key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. - :type key_size: int - :param curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible + :vartype kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType + :ivar key_ops: + :vartype key_ops: list[str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :vartype key_size: int + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible values include: "P-256", "P-384", "P-521", "P-256K". - :type curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName + :vartype curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str :ivar key_uri_with_version: The URI to retrieve the specific version of the key. :vartype key_uri_with_version: str - :param rotation_policy: Key rotation policy in response. It will be used for both output and + :ivar rotation_policy: Key rotation policy in response. It will be used for both output and input. Omitted if empty. - :type rotation_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.RotationPolicy - :param release_policy: Key release policy in response. It will be used for both output and + :vartype rotation_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.RotationPolicy + :ivar release_policy: Key release policy in response. It will be used for both output and input. Omitted if empty. - :type release_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyReleasePolicy + :vartype release_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyReleasePolicy """ _validation = { @@ -836,6 +963,28 @@ def __init__( release_policy: Optional["KeyReleasePolicy"] = None, **kwargs ): + """ + :keyword attributes: The attributes of the key. + :paramtype attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values + include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :paramtype kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType + :keyword key_ops: + :paramtype key_ops: list[str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] + :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :paramtype key_size: int + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. + Possible values include: "P-256", "P-384", "P-521", "P-256K". + :paramtype curve_name: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName + :keyword rotation_policy: Key rotation policy in response. It will be used for both output and + input. Omitted if empty. + :paramtype rotation_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.RotationPolicy + :keyword release_policy: Key release policy in response. It will be used for both output and + input. Omitted if empty. + :paramtype release_policy: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyReleasePolicy + """ super(KeyProperties, self).__init__(**kwargs) self.attributes = attributes self.kty = kty @@ -851,10 +1000,10 @@ def __init__( class KeyReleasePolicy(msrest.serialization.Model): """KeyReleasePolicy. - :param content_type: Content type and version of key release policy. - :type content_type: str - :param data: Blob encoding the policy rules under which the key can be released. - :type data: bytes + :ivar content_type: Content type and version of key release policy. + :vartype content_type: str + :ivar data: Blob encoding the policy rules under which the key can be released. + :vartype data: bytes """ _attribute_map = { @@ -869,6 +1018,12 @@ def __init__( data: Optional[bytes] = None, **kwargs ): + """ + :keyword content_type: Content type and version of key release policy. + :paramtype content_type: str + :keyword data: Blob encoding the policy rules under which the key can be released. + :paramtype data: bytes + """ super(KeyReleasePolicy, self).__init__(**kwargs) self.content_type = content_type self.data = data @@ -883,9 +1038,9 @@ class KeyRotationPolicyAttributes(msrest.serialization.Model): :vartype created: long :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. :vartype updated: long - :param expiry_time: The expiration time for the new key version. It should be in ISO8601 - format. Eg: 'P90D', 'P1Y'. - :type expiry_time: str + :ivar expiry_time: The expiration time for the new key version. It should be in ISO8601 format. + Eg: 'P90D', 'P1Y'. + :vartype expiry_time: str """ _validation = { @@ -905,6 +1060,11 @@ def __init__( expiry_time: Optional[str] = None, **kwargs ): + """ + :keyword expiry_time: The expiration time for the new key version. It should be in ISO8601 + format. Eg: 'P90D', 'P1Y'. + :paramtype expiry_time: str + """ super(KeyRotationPolicyAttributes, self).__init__(**kwargs) self.created = None self.updated = None @@ -914,10 +1074,10 @@ def __init__( class LifetimeAction(msrest.serialization.Model): """LifetimeAction. - :param trigger: The trigger of key rotation policy lifetimeAction. - :type trigger: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Trigger - :param action: The action of key rotation policy lifetimeAction. - :type action: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Action + :ivar trigger: The trigger of key rotation policy lifetimeAction. + :vartype trigger: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Trigger + :ivar action: The action of key rotation policy lifetimeAction. + :vartype action: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Action """ _attribute_map = { @@ -932,6 +1092,12 @@ def __init__( action: Optional["Action"] = None, **kwargs ): + """ + :keyword trigger: The trigger of key rotation policy lifetimeAction. + :paramtype trigger: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Trigger + :keyword action: The action of key rotation policy lifetimeAction. + :paramtype action: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Action + """ super(LifetimeAction, self).__init__(**kwargs) self.trigger = trigger self.action = action @@ -940,12 +1106,12 @@ def __init__( 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 + :ivar name: Name of log specification. + :vartype name: str + :ivar display_name: Display name of log specification. + :vartype display_name: str + :ivar blob_duration: Blob duration of specification. + :vartype blob_duration: str """ _attribute_map = { @@ -962,6 +1128,14 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of log specification. + :paramtype name: str + :keyword display_name: Display name of log specification. + :paramtype display_name: str + :keyword blob_duration: Blob duration of specification. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -979,12 +1153,12 @@ class ManagedHsmResource(msrest.serialization.Model): :vartype name: str :ivar type: The resource type of the managed HSM Pool. :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the key vault resource. :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData @@ -1015,6 +1189,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ super(ManagedHsmResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1036,17 +1218,17 @@ class ManagedHsm(ManagedHsmResource): :vartype name: str :ivar type: The resource type of the managed HSM Pool. :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the key vault resource. :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData - :param properties: Properties of the managed HSM. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmProperties + :ivar properties: Properties of the managed HSM. + :vartype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmProperties """ _validation = { @@ -1076,6 +1258,16 @@ def __init__( properties: Optional["ManagedHsmProperties"] = None, **kwargs ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the managed HSM. + :paramtype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmProperties + """ super(ManagedHsm, self).__init__(location=location, sku=sku, tags=tags, **kwargs) self.properties = properties @@ -1101,6 +1293,8 @@ def __init__( self, **kwargs ): + """ + """ super(ManagedHsmError, self).__init__(**kwargs) self.error = None @@ -1108,10 +1302,10 @@ def __init__( class ManagedHsmListResult(msrest.serialization.Model): """List of managed HSM Pools. - :param value: The list of managed HSM Pools. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] - :param next_link: The URL to get the next set of managed HSM Pools. - :type next_link: str + :ivar value: The list of managed HSM Pools. + :vartype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] + :ivar next_link: The URL to get the next set of managed HSM Pools. + :vartype next_link: str """ _attribute_map = { @@ -1126,6 +1320,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of managed HSM Pools. + :paramtype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] + :keyword next_link: The URL to get the next set of managed HSM Pools. + :paramtype next_link: str + """ super(ManagedHsmListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1136,30 +1336,30 @@ class ManagedHsmProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + :ivar tenant_id: The Azure Active Directory tenant ID that should be used for authenticating requests to the managed HSM pool. - :type tenant_id: str - :param initial_admin_object_ids: Array of initial administrators object ids for this managed - hsm pool. - :type initial_admin_object_ids: list[str] + :vartype tenant_id: str + :ivar initial_admin_object_ids: Array of initial administrators object ids for this managed hsm + pool. + :vartype initial_admin_object_ids: list[str] :ivar hsm_uri: The URI of the managed hsm pool for performing operations on keys. :vartype hsm_uri: str - :param enable_soft_delete: Property to specify whether the 'soft delete' functionality is + :ivar enable_soft_delete: Property to specify whether the 'soft delete' functionality is enabled for this managed HSM pool. If it's not set to any value(true or false) when creating new managed HSM pool, it will be set to true by default. Once set to true, it cannot be reverted to false. - :type enable_soft_delete: bool - :param soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. - :type soft_delete_retention_in_days: int - :param enable_purge_protection: Property specifying whether protection against purge is enabled + :vartype enable_soft_delete: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this managed HSM pool. Setting this property to true activates protection against purge for this managed HSM pool and its content - only the Managed HSM service may initiate a hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling this functionality is irreversible. - :type enable_purge_protection: bool - :param create_mode: The create mode to indicate whether the resource is being created or is + :vartype enable_purge_protection: bool + :ivar create_mode: The create mode to indicate whether the resource is being created or is being recovered from a deleted resource. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode + :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode :ivar status_message: Resource Status Message. :vartype status_message: str :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", @@ -1167,16 +1367,16 @@ class ManagedHsmProperties(msrest.serialization.Model): "Restoring". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ProvisioningState - :param network_acls: Rules governing the accessibility of the key vault from specific network + :ivar network_acls: Rules governing the accessibility of the key vault from specific network locations. - :type network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMNetworkRuleSet + :vartype network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMNetworkRuleSet :ivar private_endpoint_connections: List of private endpoint connections associated with the managed hsm pool. :vartype private_endpoint_connections: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionItem] - :param public_network_access: Control permission for data plane traffic coming from public + :ivar public_network_access: Control permission for data plane traffic coming from public networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or + :vartype public_network_access: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PublicNetworkAccess :ivar scheduled_purge_date: The scheduled purge date in UTC. :vartype scheduled_purge_date: ~datetime.datetime @@ -1219,6 +1419,38 @@ def __init__( public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, **kwargs ): + """ + :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the managed HSM pool. + :paramtype tenant_id: str + :keyword initial_admin_object_ids: Array of initial administrators object ids for this managed + hsm pool. + :paramtype initial_admin_object_ids: list[str] + :keyword enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this managed HSM pool. If it's not set to any value(true or false) when creating + new managed HSM pool, it will be set to true by default. Once set to true, it cannot be + reverted to false. + :paramtype enable_soft_delete: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword enable_purge_protection: Property specifying whether protection against purge is + enabled for this managed HSM pool. Setting this property to true activates protection against + purge for this managed HSM pool and its content - only the Managed HSM service may initiate a + hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. + Enabling this functionality is irreversible. + :paramtype enable_purge_protection: bool + :keyword create_mode: The create mode to indicate whether the resource is being created or is + being recovered from a deleted resource. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode + :keyword network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMNetworkRuleSet + :keyword public_network_access: Control permission for data plane traffic coming from public + networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PublicNetworkAccess + """ super(ManagedHsmProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.initial_admin_object_ids = initial_admin_object_ids @@ -1240,11 +1472,11 @@ class ManagedHsmSku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". - :type family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuFamily - :param name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + :ivar family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :vartype family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuFamily + :ivar name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", "Custom_B32". - :type name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuName + :vartype name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuName """ _validation = { @@ -1264,6 +1496,13 @@ def __init__( name: Union[str, "ManagedHsmSkuName"], **kwargs ): + """ + :keyword family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :paramtype family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuFamily + :keyword name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + "Custom_B32". + :paramtype name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuName + """ super(ManagedHsmSku, self).__init__(**kwargs) self.family = family self.name = name @@ -1272,29 +1511,29 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. - :type unit: str - :param aggregation_type: The metric aggregation type. Possible values include: 'Average', + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :vartype unit: str + :ivar aggregation_type: The metric aggregation type. Possible values include: 'Average', 'Count', 'Total'. - :type aggregation_type: str - :param supported_aggregation_types: The supported aggregation types for the metrics. - :type supported_aggregation_types: list[str] - :param supported_time_grain_types: The supported time grain types for the metrics. - :type supported_time_grain_types: list[str] - :param lock_aggregation_type: The metric lock aggregation type. - :type lock_aggregation_type: str - :param dimensions: The dimensions of metric. - :type dimensions: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DimensionProperties] - :param fill_gap_with_zero: Property to specify whether to fill gap with zero. - :type fill_gap_with_zero: bool - :param internal_metric_name: The internal metric name. - :type internal_metric_name: str + :vartype aggregation_type: str + :ivar supported_aggregation_types: The supported aggregation types for the metrics. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: The supported time grain types for the metrics. + :vartype supported_time_grain_types: list[str] + :ivar lock_aggregation_type: The metric lock aggregation type. + :vartype lock_aggregation_type: str + :ivar dimensions: The dimensions of metric. + :vartype dimensions: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DimensionProperties] + :ivar fill_gap_with_zero: Property to specify whether to fill gap with zero. + :vartype fill_gap_with_zero: bool + :ivar internal_metric_name: The internal metric name. + :vartype internal_metric_name: str """ _attribute_map = { @@ -1327,6 +1566,32 @@ def __init__( internal_metric_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :paramtype unit: str + :keyword aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: The supported aggregation types for the metrics. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: The supported time grain types for the metrics. + :paramtype supported_time_grain_types: list[str] + :keyword lock_aggregation_type: The metric lock aggregation type. + :paramtype lock_aggregation_type: str + :keyword dimensions: The dimensions of metric. + :paramtype dimensions: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.DimensionProperties] + :keyword fill_gap_with_zero: Property to specify whether to fill gap with zero. + :paramtype fill_gap_with_zero: bool + :keyword internal_metric_name: The internal metric name. + :paramtype internal_metric_name: str + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1346,9 +1611,9 @@ class MHSMIPRule(msrest.serialization.Model): 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 + :ivar 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 + :vartype value: str """ _validation = { @@ -1365,6 +1630,11 @@ def __init__( value: str, **kwargs ): + """ + :keyword 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). + :paramtype value: str + """ super(MHSMIPRule, self).__init__(**kwargs) self.value = value @@ -1372,18 +1642,20 @@ def __init__( class MHSMNetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a managed hsm pool. - :param bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: "AzureServices", "None". - :type bypass: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and from - virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction - :param ip_rules: The list of IP address rules. - :type ip_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMIPRule] - :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: + :vartype bypass: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions + :ivar 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". + :vartype default_action: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction + :ivar ip_rules: The list of IP address rules. + :vartype ip_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMIPRule] + :ivar virtual_network_rules: The list of virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMVirtualNetworkRule] """ @@ -1403,6 +1675,23 @@ def __init__( virtual_network_rules: Optional[List["MHSMVirtualNetworkRule"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype bypass: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions + :keyword 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". + :paramtype default_action: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction + :keyword ip_rules: The list of IP address rules. + :paramtype ip_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMIPRule] + :keyword virtual_network_rules: The list of virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMVirtualNetworkRule] + """ super(MHSMNetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.default_action = default_action @@ -1431,6 +1720,8 @@ def __init__( self, **kwargs ): + """ + """ super(MHSMPrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1446,25 +1737,25 @@ class MHSMPrivateEndpointConnection(ManagedHsmResource): :vartype name: str :ivar type: The resource type of the managed HSM Pool. :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the key vault resource. :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1501,6 +1792,26 @@ def __init__( provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState + :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState + """ super(MHSMPrivateEndpointConnection, self).__init__(location=location, sku=sku, tags=tags, **kwargs) self.etag = etag self.private_endpoint = private_endpoint @@ -1511,14 +1822,14 @@ def __init__( class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): """Private endpoint connection item. - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1536,6 +1847,18 @@ def __init__( provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): + """ + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState + :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState + """ super(MHSMPrivateEndpointConnectionItem, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -1545,11 +1868,11 @@ def __init__( class MHSMPrivateEndpointConnectionsListResult(msrest.serialization.Model): """List of private endpoint connections associated with a managed HSM Pools. - :param value: The private endpoint connection associated with a managed HSM Pools. - :type value: + :ivar value: The private endpoint connection associated with a managed HSM Pools. + :vartype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] - :param next_link: The URL to get the next set of managed HSM Pools. - :type next_link: str + :ivar next_link: The URL to get the next set of managed HSM Pools. + :vartype next_link: str """ _attribute_map = { @@ -1564,6 +1887,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The private endpoint connection associated with a managed HSM Pools. + :paramtype value: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] + :keyword next_link: The URL to get the next set of managed HSM Pools. + :paramtype next_link: str + """ super(MHSMPrivateEndpointConnectionsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1580,12 +1910,12 @@ class MHSMPrivateLinkResource(ManagedHsmResource): :vartype name: str :ivar type: The resource type of the managed HSM Pool. :vartype type: str - :param location: The supported Azure location where the managed HSM Pool should be created. - :type location: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the key vault resource. :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData @@ -1593,8 +1923,8 @@ class MHSMPrivateLinkResource(ManagedHsmResource): :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] + :ivar required_zone_names: Required DNS zone names of the the private link resource. + :vartype required_zone_names: list[str] """ _validation = { @@ -1628,6 +1958,16 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword required_zone_names: Required DNS zone names of the the private link resource. + :paramtype required_zone_names: list[str] + """ super(MHSMPrivateLinkResource, self).__init__(location=location, sku=sku, tags=tags, **kwargs) self.group_id = None self.required_members = None @@ -1637,8 +1977,8 @@ def __init__( class MHSMPrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkResource] """ _attribute_map = { @@ -1651,6 +1991,10 @@ def __init__( value: Optional[List["MHSMPrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkResource] + """ super(MHSMPrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -1658,15 +2002,16 @@ def __init__( class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. - :param status: Indicates whether the connection has been approved, rejected or removed by the + :ivar 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 + :vartype status: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval or rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval or rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. Possible values include: "None". - :type actions_required: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired + :vartype actions_required: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired """ _attribute_map = { @@ -1683,6 +2028,18 @@ def __init__( actions_required: Optional[Union[str, "ActionsRequired"]] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval or rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None". + :paramtype actions_required: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired + """ super(MHSMPrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -1694,9 +2051,9 @@ class MHSMVirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. Full resource id of a vnet subnet, such as + :ivar 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 + :vartype id: str """ _validation = { @@ -1713,6 +2070,11 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :paramtype id: str + """ super(MHSMVirtualNetworkRule, self).__init__(**kwargs) self.id = id @@ -1720,18 +2082,20 @@ def __init__( 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 + :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. Possible values include: "AzureServices", "None". - :type bypass: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions - :param default_action: The default action when no rule from ipRules and from - virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". - :type default_action: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction - :param ip_rules: The list of IP address rules. - :type ip_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.IPRule] - :param virtual_network_rules: The list of virtual network rules. - :type virtual_network_rules: + :vartype bypass: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions + :ivar 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". + :vartype default_action: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction + :ivar ip_rules: The list of IP address rules. + :vartype ip_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.IPRule] + :ivar virtual_network_rules: The list of virtual network rules. + :vartype virtual_network_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.VirtualNetworkRule] """ @@ -1751,6 +2115,23 @@ def __init__( virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, **kwargs ): + """ + :keyword 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". + :paramtype bypass: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions + :keyword 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". + :paramtype default_action: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction + :keyword ip_rules: The list of IP address rules. + :paramtype ip_rules: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.IPRule] + :keyword virtual_network_rules: The list of virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.VirtualNetworkRule] + """ super(NetworkRuleSet, self).__init__(**kwargs) self.bypass = bypass self.default_action = default_action @@ -1761,16 +2142,16 @@ def __init__( class Operation(msrest.serialization.Model): """Key Vault REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param is_data_action: Property to specify whether the action is a data action. - :type is_data_action: bool - :param service_specification: One property of operation, include metric specifications. - :type service_specification: + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar is_data_action: Property to specify whether the action is a data action. + :vartype is_data_action: bool + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ServiceSpecification """ @@ -1792,6 +2173,19 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword is_data_action: Property to specify whether the action is a data action. + :paramtype is_data_action: bool + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1803,14 +2197,14 @@ def __init__( 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 + :ivar provider: Service provider: Microsoft Key Vault. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of operation. + :vartype description: str """ _attribute_map = { @@ -1829,6 +2223,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft Key Vault. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1839,10 +2243,10 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. - :param value: List of Storage operations supported by the Storage resource provider. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Operation] - :param next_link: The URL to get the next set of operations. - :type next_link: str + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Operation] + :ivar next_link: The URL to get the next set of operations. + :vartype next_link: str """ _attribute_map = { @@ -1857,6 +2261,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Operation] + :keyword next_link: The URL to get the next set of operations. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1865,15 +2275,17 @@ def __init__( class Permissions(msrest.serialization.Model): """Permissions the identity has for keys, secrets, certificates and storage. - :param keys: Permissions to keys. - :type keys: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyPermissions] - :param secrets: Permissions to secrets. - :type secrets: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPermissions] - :param certificates: Permissions to certificates. - :type certificates: list[str or + :ivar keys: Permissions to keys. + :vartype keys: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyPermissions] + :ivar secrets: Permissions to secrets. + :vartype secrets: list[str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPermissions] + :ivar certificates: Permissions to certificates. + :vartype certificates: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CertificatePermissions] - :param storage: Permissions to storage accounts. - :type storage: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.StoragePermissions] + :ivar storage: Permissions to storage accounts. + :vartype storage: list[str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.StoragePermissions] """ _attribute_map = { @@ -1892,6 +2304,19 @@ def __init__( storage: Optional[List[Union[str, "StoragePermissions"]]] = None, **kwargs ): + """ + :keyword keys: Permissions to keys. + :paramtype keys: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyPermissions] + :keyword secrets: Permissions to secrets. + :paramtype secrets: list[str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPermissions] + :keyword certificates: Permissions to certificates. + :paramtype certificates: list[str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.CertificatePermissions] + :keyword storage: Permissions to storage accounts. + :paramtype storage: list[str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.StoragePermissions] + """ super(Permissions, self).__init__(**kwargs) self.keys = keys self.secrets = secrets @@ -1920,6 +2345,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1939,16 +2366,16 @@ class PrivateEndpointConnection(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1981,6 +2408,19 @@ def __init__( provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): + """ + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState + :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.etag = etag self.private_endpoint = private_endpoint @@ -1991,18 +2431,18 @@ def __init__( class PrivateEndpointConnectionItem(msrest.serialization.Model): """Private endpoint connection item. - :param id: Id of private endpoint connection. - :type id: str - :param etag: Modified whenever there is a change in the state of private endpoint connection. - :type etag: str - :param private_endpoint: Properties of the private endpoint object. - :type private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpoint - :param private_link_service_connection_state: Approval state of the private link connection. - :type private_link_service_connection_state: + :ivar id: Id of private endpoint connection. + :vartype id: str + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState - :param provisioning_state: Provisioning state of the private endpoint connection. Possible + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". - :type provisioning_state: str or + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -2024,6 +2464,21 @@ def __init__( provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): + """ + :keyword id: Id of private endpoint connection. + :paramtype id: str + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState + :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState + """ super(PrivateEndpointConnectionItem, self).__init__(**kwargs) self.id = id self.etag = etag @@ -2035,10 +2490,10 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """List of private endpoint connections. - :param value: The list of private endpoint connections. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] - :param next_link: The URL to get the next set of private endpoint connections. - :type next_link: str + :ivar value: The list of private endpoint connections. + :vartype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] + :ivar next_link: The URL to get the next set of private endpoint connections. + :vartype next_link: str """ _attribute_map = { @@ -2053,6 +2508,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of private endpoint connections. + :paramtype value: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] + :keyword next_link: The URL to get the next set of private endpoint connections. + :paramtype next_link: str + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2077,8 +2539,8 @@ class PrivateLinkResource(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] + :ivar required_zone_names: Required DNS zone names of the the private link resource. + :vartype required_zone_names: list[str] """ _validation = { @@ -2108,6 +2570,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: Required DNS zone names of the the private link resource. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -2117,8 +2583,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkResource] """ _attribute_map = { @@ -2131,6 +2597,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -2138,15 +2608,16 @@ def __init__( 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 + :ivar 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 + :vartype status: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval or rejection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :ivar description: The reason for approval or rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. Possible values include: "None". - :type actions_required: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired + :vartype actions_required: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired """ _attribute_map = { @@ -2163,6 +2634,18 @@ def __init__( actions_required: Optional[Union[str, "ActionsRequired"]] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval or rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Possible values include: "None". + :paramtype actions_required: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -2172,10 +2655,10 @@ def __init__( class ResourceListResult(msrest.serialization.Model): """List of vault resources. - :param value: The list of vault resources. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Resource] - :param next_link: The URL to get the next set of vault resources. - :type next_link: str + :ivar value: The list of vault resources. + :vartype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Resource] + :ivar next_link: The URL to get the next set of vault resources. + :vartype next_link: str """ _attribute_map = { @@ -2190,6 +2673,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of vault resources. + :paramtype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Resource] + :keyword next_link: The URL to get the next set of vault resources. + :paramtype next_link: str + """ super(ResourceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2198,10 +2687,11 @@ def __init__( class RotationPolicy(msrest.serialization.Model): """RotationPolicy. - :param attributes: The attributes of key rotation policy. - :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyAttributes - :param lifetime_actions: The lifetimeActions for key rotation action. - :type lifetime_actions: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.LifetimeAction] + :ivar attributes: The attributes of key rotation policy. + :vartype attributes: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyAttributes + :ivar lifetime_actions: The lifetimeActions for key rotation action. + :vartype lifetime_actions: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.LifetimeAction] """ _attribute_map = { @@ -2216,6 +2706,14 @@ def __init__( lifetime_actions: Optional[List["LifetimeAction"]] = None, **kwargs ): + """ + :keyword attributes: The attributes of key rotation policy. + :paramtype attributes: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyAttributes + :keyword lifetime_actions: The lifetimeActions for key rotation action. + :paramtype lifetime_actions: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.LifetimeAction] + """ super(RotationPolicy, self).__init__(**kwargs) self.attributes = attributes self.lifetime_actions = lifetime_actions @@ -2238,8 +2736,8 @@ class Secret(Resource): :vartype location: str :ivar tags: A set of tags. Tags assigned to the key vault resource. :vartype tags: dict[str, str] - :param properties: Required. Properties of the secret. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretProperties + :ivar properties: Required. Properties of the secret. + :vartype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretProperties """ _validation = { @@ -2266,6 +2764,10 @@ def __init__( properties: "SecretProperties", **kwargs ): + """ + :keyword properties: Required. Properties of the secret. + :paramtype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretProperties + """ super(Secret, self).__init__(**kwargs) self.properties = properties @@ -2275,12 +2777,12 @@ class SecretAttributes(Attributes): Variables are only populated by the server, and will be ignored when sending a request. - :param enabled: Determines whether the object is enabled. - :type enabled: bool - :param not_before: Not before date in seconds since 1970-01-01T00:00:00Z. - :type not_before: ~datetime.datetime - :param expires: Expiry date in seconds since 1970-01-01T00:00:00Z. - :type expires: ~datetime.datetime + :ivar enabled: Determines whether the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :vartype not_before: ~datetime.datetime + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: ~datetime.datetime :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. :vartype created: ~datetime.datetime :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. @@ -2308,6 +2810,14 @@ def __init__( expires: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword enabled: Determines whether the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :paramtype not_before: ~datetime.datetime + :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :paramtype expires: ~datetime.datetime + """ super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) @@ -2316,10 +2826,10 @@ class SecretCreateOrUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param tags: A set of tags. The tags that will be assigned to the secret. - :type tags: dict[str, str] - :param properties: Required. Properties of the secret. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretProperties + :ivar tags: A set of tags. The tags that will be assigned to the secret. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the secret. + :vartype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretProperties """ _validation = { @@ -2338,6 +2848,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the secret. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the secret. + :paramtype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretProperties + """ super(SecretCreateOrUpdateParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -2346,10 +2862,10 @@ def __init__( class SecretListResult(msrest.serialization.Model): """List of secrets. - :param value: The list of secrets. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret] - :param next_link: The URL to get the next set of secrets. - :type next_link: str + :ivar value: The list of secrets. + :vartype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret] + :ivar next_link: The URL to get the next set of secrets. + :vartype next_link: str """ _attribute_map = { @@ -2364,6 +2880,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of secrets. + :paramtype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret] + :keyword next_link: The URL to get the next set of secrets. + :paramtype next_link: str + """ super(SecretListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2372,10 +2894,10 @@ def __init__( class SecretPatchParameters(msrest.serialization.Model): """Parameters for patching a secret. - :param tags: A set of tags. The tags that will be assigned to the secret. - :type tags: dict[str, str] - :param properties: Properties of the secret. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPatchProperties + :ivar tags: A set of tags. The tags that will be assigned to the secret. + :vartype tags: dict[str, str] + :ivar properties: Properties of the secret. + :vartype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPatchProperties """ _attribute_map = { @@ -2390,6 +2912,12 @@ def __init__( properties: Optional["SecretPatchProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the secret. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the secret. + :paramtype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretPatchProperties + """ super(SecretPatchParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -2398,12 +2926,12 @@ def __init__( class SecretPatchProperties(msrest.serialization.Model): """Properties of the secret. - :param value: The value of the secret. - :type value: str - :param content_type: The content type of the secret. - :type content_type: str - :param attributes: The attributes of the secret. - :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretAttributes + :ivar value: The value of the secret. + :vartype value: str + :ivar content_type: The content type of the secret. + :vartype content_type: str + :ivar attributes: The attributes of the secret. + :vartype attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretAttributes """ _attribute_map = { @@ -2420,6 +2948,14 @@ def __init__( attributes: Optional["SecretAttributes"] = None, **kwargs ): + """ + :keyword value: The value of the secret. + :paramtype value: str + :keyword content_type: The content type of the secret. + :paramtype content_type: str + :keyword attributes: The attributes of the secret. + :paramtype attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretAttributes + """ super(SecretPatchProperties, self).__init__(**kwargs) self.value = value self.content_type = content_type @@ -2431,14 +2967,14 @@ class SecretProperties(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: The value of the secret. NOTE: 'value' will never be returned from the service, - as APIs using this model are is intended for internal use in ARM deployments. Users should use - the data-plane REST service for interaction with vault secrets. - :type value: str - :param content_type: The content type of the secret. - :type content_type: str - :param attributes: The attributes of the secret. - :type attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretAttributes + :ivar value: The value of the secret. NOTE: 'value' will never be returned from the service, as + APIs using this model are is intended for internal use in ARM deployments. Users should use the + data-plane REST service for interaction with vault secrets. + :vartype value: str + :ivar content_type: The content type of the secret. + :vartype content_type: str + :ivar attributes: The attributes of the secret. + :vartype attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretAttributes :ivar secret_uri: The URI to retrieve the current version of the secret. :vartype secret_uri: str :ivar secret_uri_with_version: The URI to retrieve the specific version of the secret. @@ -2466,6 +3002,16 @@ def __init__( attributes: Optional["SecretAttributes"] = None, **kwargs ): + """ + :keyword value: The value of the secret. NOTE: 'value' will never be returned from the service, + as APIs using this model are is intended for internal use in ARM deployments. Users should use + the data-plane REST service for interaction with vault secrets. + :paramtype value: str + :keyword content_type: The content type of the secret. + :paramtype content_type: str + :keyword attributes: The attributes of the secret. + :paramtype attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretAttributes + """ super(SecretProperties, self).__init__(**kwargs) self.value = value self.content_type = content_type @@ -2477,11 +3023,11 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include log specifications. - :param log_specifications: Log specifications of operation. - :type log_specifications: + :ivar log_specifications: Log specifications of operation. + :vartype log_specifications: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.LogSpecification] - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MetricSpecification] """ @@ -2497,6 +3043,14 @@ def __init__( metric_specifications: Optional[List["MetricSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Log specifications of operation. + :paramtype log_specifications: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.LogSpecification] + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MetricSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications self.metric_specifications = metric_specifications @@ -2507,11 +3061,11 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param family: Required. SKU family name. Possible values include: "A". - :type family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuFamily - :param name: Required. SKU name to specify whether the key vault is a standard vault or a + :ivar family: Required. SKU family name. Possible values include: "A". + :vartype family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuFamily + :ivar name: Required. SKU name to specify whether the key vault is a standard vault or a premium vault. Possible values include: "standard", "premium". - :type name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuName + :vartype name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuName """ _validation = { @@ -2531,6 +3085,13 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword family: Required. SKU family name. Possible values include: "A". + :paramtype family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuFamily + :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Possible values include: "standard", "premium". + :paramtype name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.family = family self.name = name @@ -2539,21 +3100,21 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the key vault resource. - :param created_by: The identity that created the key vault resource. - :type created_by: str - :param created_by_type: The type of identity that created the key vault resource. Possible + :ivar created_by: The identity that created the key vault resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the key vault resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType - :param created_at: The timestamp of the key vault resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the key vault resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the key vault resource. + :vartype created_by_type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType + :ivar created_at: The timestamp of the key vault resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the key vault resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the key vault resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or + :vartype last_modified_by_type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType - :param last_modified_at: The timestamp of the key vault resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of the key vault resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -2576,6 +3137,23 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the key vault resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the key vault resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType + :keyword created_at: The timestamp of the key vault resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the key vault resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the key vault resource. + Possible values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType + :keyword last_modified_at: The timestamp of the key vault resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -2588,12 +3166,12 @@ def __init__( class Trigger(msrest.serialization.Model): """Trigger. - :param time_after_create: The time duration after key creation to rotate the key. It only + :ivar time_after_create: The time duration after key creation to rotate the key. It only applies to rotate. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. - :type time_after_create: str - :param time_before_expiry: The time duration before key expiring to rotate or notify. It will - be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. - :type time_before_expiry: str + :vartype time_after_create: str + :ivar time_before_expiry: The time duration before key expiring to rotate or notify. It will be + in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + :vartype time_before_expiry: str """ _attribute_map = { @@ -2608,6 +3186,14 @@ def __init__( time_before_expiry: Optional[str] = None, **kwargs ): + """ + :keyword time_after_create: The time duration after key creation to rotate the key. It only + applies to rotate. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + :paramtype time_after_create: str + :keyword time_before_expiry: The time duration before key expiring to rotate or notify. It will + be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + :paramtype time_before_expiry: str + """ super(Trigger, self).__init__(**kwargs) self.time_after_create = time_after_create self.time_before_expiry = time_before_expiry @@ -2626,14 +3212,14 @@ class Vault(msrest.serialization.Model): :vartype name: str :ivar type: Resource type of the key vault resource. :vartype type: str - :param location: Azure location of the key vault resource. - :type location: str - :param tags: A set of tags. Tags assigned to the key vault resource. - :type tags: dict[str, str] + :ivar 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 system_data: System metadata for the key vault. :vartype system_data: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SystemData - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProperties + :ivar properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProperties """ _validation = { @@ -2662,6 +3248,14 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Azure location of the key vault resource. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to the key vault resource. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProperties + """ super(Vault, self).__init__(**kwargs) self.id = None self.name = None @@ -2687,8 +3281,9 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): :vartype type: str :ivar location: The resource type of the access policy. :vartype location: str - :param properties: Required. Properties of the access policy. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyProperties + :ivar properties: Required. Properties of the access policy. + :vartype properties: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyProperties """ _validation = { @@ -2713,6 +3308,11 @@ def __init__( properties: "VaultAccessPolicyProperties", **kwargs ): + """ + :keyword properties: Required. Properties of the access policy. + :paramtype properties: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyProperties + """ super(VaultAccessPolicyParameters, self).__init__(**kwargs) self.id = None self.name = None @@ -2726,9 +3326,10 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): 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 + :ivar access_policies: Required. An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. - :type access_policies: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] + :vartype access_policies: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] """ _validation = { @@ -2745,6 +3346,12 @@ def __init__( access_policies: List["AccessPolicyEntry"], **kwargs ): + """ + :keyword 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. + :paramtype access_policies: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] + """ super(VaultAccessPolicyProperties, self).__init__(**kwargs) self.access_policies = access_policies @@ -2756,8 +3363,8 @@ class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The vault name. - :type name: str + :ivar name: Required. The vault name. + :vartype name: str :ivar type: The type of resource, Microsoft.KeyVault/vaults. Has constant value: "Microsoft.KeyVault/vaults". :vartype type: str @@ -2781,6 +3388,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = name @@ -2790,12 +3401,12 @@ class VaultCreateOrUpdateParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. The supported Azure location where the key vault should be created. - :type location: str - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Required. Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProperties + :ivar location: Required. The supported Azure location where the key vault should be created. + :vartype location: str + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProperties """ _validation = { @@ -2817,6 +3428,15 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The supported Azure location where the key vault should be + created. + :paramtype location: str + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProperties + """ super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) self.location = location self.tags = tags @@ -2826,10 +3446,10 @@ def __init__( class VaultListResult(msrest.serialization.Model): """List of vaults. - :param value: The list of vaults. - :type value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] - :param next_link: The URL to get the next set of vaults. - :type next_link: str + :ivar value: The list of vaults. + :vartype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] + :ivar next_link: The URL to get the next set of vaults. + :vartype next_link: str """ _attribute_map = { @@ -2844,6 +3464,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] + :keyword next_link: The URL to get the next set of vaults. + :paramtype next_link: str + """ super(VaultListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2852,10 +3478,10 @@ def __init__( class VaultPatchParameters(msrest.serialization.Model): """Parameters for creating or updating a vault. - :param tags: A set of tags. The tags that will be assigned to the key vault. - :type tags: dict[str, str] - :param properties: Properties of the vault. - :type properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultPatchProperties + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultPatchProperties """ _attribute_map = { @@ -2870,6 +3496,12 @@ def __init__( properties: Optional["VaultPatchProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultPatchProperties + """ super(VaultPatchParameters, self).__init__(**kwargs) self.tags = tags self.properties = properties @@ -2878,52 +3510,53 @@ def __init__( class VaultPatchProperties(msrest.serialization.Model): """Properties of the vault. - :param tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + :ivar tenant_id: The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - :type tenant_id: str - :param sku: SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Sku - :param access_policies: An array of 0 to 16 identities that have access to the key vault. All + :vartype tenant_id: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Sku + :ivar access_policies: An array of 0 to 16 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. - :type access_policies: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + :vartype access_policies: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] + :ivar 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 + :vartype enabled_for_deployment: bool + :ivar 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 + :vartype enabled_for_disk_encryption: bool + :ivar 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 + :vartype enabled_for_template_deployment: bool + :ivar 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 + :vartype enable_soft_delete: bool + :ivar 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 + :vartype enable_rbac_authorization: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered or not. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode - :param enable_purge_protection: Property specifying whether protection against purge is enabled + :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode + :ivar 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 + :vartype enable_purge_protection: bool + :ivar network_acls: A collection of rules governing the accessibility of the vault from specific network locations. - :type network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet - :param public_network_access: Property to specify whether the vault will accept traffic from + :vartype network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet + :ivar public_network_access: Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are present we will not honor the rules. - :type public_network_access: str + :vartype public_network_access: str """ _attribute_map = { @@ -2960,6 +3593,56 @@ def __init__( public_network_access: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. + :paramtype tenant_id: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Sku + :keyword 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. + :paramtype access_policies: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword 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. + :paramtype enable_soft_delete: bool + :keyword 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. + :paramtype enable_rbac_authorization: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode + :keyword 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. + :paramtype enable_purge_protection: bool + :keyword network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet + :keyword public_network_access: Property to specify whether the vault will accept traffic from + public internet. If set to 'disabled' all traffic except private endpoint traffic and that that + originates from trusted services will be blocked. This will override the set firewall rules, + meaning that even if the firewall rules are present we will not honor the rules. + :paramtype public_network_access: str + """ super(VaultPatchProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -2983,68 +3666,69 @@ class VaultProperties(msrest.serialization.Model): 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 + :ivar tenant_id: Required. The Azure Active Directory tenant ID that should be used for authenticating requests to the key vault. - :type tenant_id: str - :param sku: Required. SKU details. - :type sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Sku - :param access_policies: An array of 0 to 1024 identities that have access to the key vault. All + :vartype tenant_id: str + :ivar sku: Required. SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Sku + :ivar access_policies: An array of 0 to 1024 identities that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. When ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access policies are required. - :type access_policies: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] - :param vault_uri: The URI of the vault for performing operations on keys and secrets. - :type vault_uri: str + :vartype access_policies: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] + :ivar vault_uri: The URI of the vault for performing operations on keys and secrets. + :vartype vault_uri: str :ivar hsm_pool_resource_id: The resource id of HSM Pool. :vartype hsm_pool_resource_id: str - :param enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + :ivar 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 + :vartype enabled_for_deployment: bool + :ivar 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 + :vartype enabled_for_disk_encryption: bool + :ivar 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 + :vartype enabled_for_template_deployment: bool + :ivar 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 + :vartype enable_soft_delete: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar 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 + :vartype enable_rbac_authorization: bool + :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered or not. Possible values include: "recover", "default". - :type create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode - :param enable_purge_protection: Property specifying whether protection against purge is enabled + :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode + :ivar 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 + :vartype enable_purge_protection: bool + :ivar network_acls: Rules governing the accessibility of the key vault from specific network locations. - :type network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet - :param provisioning_state: Provisioning state of the vault. Possible values include: + :vartype network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet + :ivar provisioning_state: Provisioning state of the vault. Possible values include: "Succeeded", "RegisteringDns". - :type provisioning_state: str or + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the key vault. :vartype private_endpoint_connections: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionItem] - :param public_network_access: Property to specify whether the vault will accept traffic from + :ivar public_network_access: Property to specify whether the vault will accept traffic from public internet. If set to 'disabled' all traffic except private endpoint traffic and that that originates from trusted services will be blocked. This will override the set firewall rules, meaning that even if the firewall rules are present we will not honor the rules. - :type public_network_access: str + :vartype public_network_access: str """ _validation = { @@ -3094,6 +3778,66 @@ def __init__( public_network_access: Optional[str] = "enabled", **kwargs ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword sku: Required. SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Sku + :keyword access_policies: An array of 0 to 1024 identities that have access to the key vault. + All identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :paramtype access_policies: + list[~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyEntry] + :keyword vault_uri: The URI of the vault for performing operations on keys and secrets. + :paramtype vault_uri: str + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword 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. + :paramtype enable_soft_delete: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword 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. + :paramtype enable_rbac_authorization: bool + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Possible values include: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode + :keyword 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. + :paramtype enable_purge_protection: bool + :keyword network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet + :keyword provisioning_state: Provisioning state of the vault. Possible values include: + "Succeeded", "RegisteringDns". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProvisioningState + :keyword public_network_access: Property to specify whether the vault will accept traffic from + public internet. If set to 'disabled' all traffic except private endpoint traffic and that that + originates from trusted services will be blocked. This will override the set firewall rules, + meaning that even if the firewall rules are present we will not honor the rules. + :paramtype public_network_access: str + """ super(VaultProperties, self).__init__(**kwargs) self.tenant_id = tenant_id self.sku = sku @@ -3119,12 +3863,12 @@ class VirtualNetworkRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Required. Full resource id of a vnet subnet, such as + :ivar id: Required. Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - :type id: str - :param ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + :vartype id: str + :ivar ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. - :type ignore_missing_vnet_service_endpoint: bool + :vartype ignore_missing_vnet_service_endpoint: bool """ _validation = { @@ -3143,6 +3887,14 @@ def __init__( ignore_missing_vnet_service_endpoint: Optional[bool] = None, **kwargs ): + """ + :keyword id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :paramtype id: str + :keyword ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + check if parent subnet has serviceEndpoints configured. + :paramtype ignore_missing_vnet_service_endpoint: bool + """ super(VirtualNetworkRule, self).__init__(**kwargs) self.id = id self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_keys_operations.py index 51a9e0e09639..4aa18a47e51a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_keys_operations.py @@ -5,23 +5,220 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_if_not_exist_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_version_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + key_version: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + "keyVersion": _SERIALIZER.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_versions_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class KeysOperations(object): """KeysOperations operations. @@ -45,15 +242,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_if_not_exist( self, - resource_group_name, # type: str - vault_name, # type: str - key_name, # type: str - parameters, # type: "_models.KeyCreateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Key" + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: "_models.KeyCreateParameters", + **kwargs: Any + ) -> "_models.Key": """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys. @@ -77,33 +274,23 @@ def create_if_not_exist( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_if_not_exist.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'KeyCreateParameters') + + request = build_create_if_not_exist_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + content_type=content_type, + json=_json, + template_url=self.create_if_not_exist.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'KeyCreateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,16 +304,18 @@ def create_if_not_exist( return cls(pipeline_response, deserialized, {}) return deserialized + create_if_not_exist.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Key" + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any + ) -> "_models.Key": """Gets the current version of the specified key from the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -146,28 +335,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,15 +360,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable["_models.KeyListResult"]: """Lists the keys in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -199,7 +380,8 @@ def list( :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either KeyListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] @@ -207,36 +389,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('KeyListResult', pipeline_response) + deserialized = self._deserialize("KeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -254,20 +433,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys'} # type: ignore + @distributed_trace def get_version( self, - resource_group_name, # type: str - vault_name, # type: str - key_name, # type: str - key_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Key" + resource_group_name: str, + vault_name: str, + key_name: str, + key_version: str, + **kwargs: Any + ) -> "_models.Key": """Gets the specified version of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -289,29 +469,19 @@ def get_version( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_version.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'keyVersion': self._serialize.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_version_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + key_version=key_version, + template_url=self.get_version.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -325,16 +495,18 @@ def get_version( return cls(pipeline_response, deserialized, {}) return deserialized + get_version.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}'} # type: ignore + + @distributed_trace def list_versions( self, - resource_group_name, # type: str - vault_name, # type: str - key_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.KeyListResult"] + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any + ) -> Iterable["_models.KeyListResult"]: """Lists the versions of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -346,7 +518,8 @@ def list_versions( :type key_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either KeyListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] @@ -354,37 +527,35 @@ def list_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_versions.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'keyName': self._serialize.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=self.list_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('KeyListResult', pipeline_response) + deserialized = self._deserialize("KeyListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -402,6 +573,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py index bdaec23b9da7..702dbbb5c97e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py @@ -5,25 +5,359 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_deleted_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_deleted_request( + name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}') + path_format_arguments = { + "name": _SERIALIZER.url("name", name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_purge_deleted_request_initial( + name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge') + path_format_arguments = { + "name": _SERIALIZER.url("name", name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ManagedHsmsOperations(object): """ManagedHsmsOperations operations. @@ -49,50 +383,38 @@ def __init__(self, client, config, serializer, deserializer): def _create_or_update_initial( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ManagedHsm" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedHsm" + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> "_models.ManagedHsm": cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ManagedHsm') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedHsm') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) @@ -104,16 +426,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ManagedHsm" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ManagedHsm"] + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> LROPoller["_models.ManagedHsm"]: """Create or update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -124,15 +448,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', @@ -144,27 +472,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -176,54 +498,43 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ManagedHsm" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedHsm" + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> "_models.ManagedHsm": cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'ManagedHsm') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedHsm') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) @@ -235,16 +546,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - name, # type: str - parameters, # type: "_models.ManagedHsm" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ManagedHsm"] + resource_group_name: str, + name: str, + parameters: "_models.ManagedHsm", + **kwargs: Any + ) -> LROPoller["_models.ManagedHsm"]: """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -255,15 +568,19 @@ def begin_update( :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', @@ -275,27 +592,21 @@ def begin_update( resource_group_name=resource_group_name, name=name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -307,61 +618,51 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -370,15 +671,17 @@ def begin_delete( :type name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -392,21 +695,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -418,15 +714,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.ManagedHsm"] + resource_group_name: str, + name: str, + **kwargs: Any + ) -> Optional["_models.ManagedHsm"]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -443,33 +740,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = None @@ -480,15 +767,17 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ManagedHsmListResult"] + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ManagedHsmListResult"]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -497,8 +786,10 @@ def list_by_resource_group( :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] @@ -506,37 +797,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -549,31 +836,34 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + @distributed_trace def list_by_subscription( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ManagedHsmListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ManagedHsmListResult"]: """The List operation gets information about the managed HSM Pools associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] @@ -581,36 +871,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -623,28 +908,31 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs'} # type: ignore + @distributed_trace def list_deleted( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedManagedHsmListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedManagedHsmListResult"]: """The List operation gets information about the deleted managed HSMs associated with the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedManagedHsmListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmListResult] + :return: An iterator like instance of either DeletedManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsmListResult"] @@ -652,34 +940,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedManagedHsmListResult', pipeline_response) + deserialized = self._deserialize("DeletedManagedHsmListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -692,24 +975,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs'} # type: ignore + @distributed_trace def get_deleted( self, - name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedManagedHsm" + name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedManagedHsm": """Gets the specified deleted managed HSM. :param name: The name of the deleted managed HSM. @@ -726,33 +1010,23 @@ def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + name=name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('DeletedManagedHsm', pipeline_response) @@ -761,61 +1035,52 @@ def get_deleted( return cls(pipeline_response, deserialized, {}) return deserialized + get_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}'} # type: ignore + def _purge_deleted_initial( self, - name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + name: str, + location: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._purge_deleted_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_deleted_request_initial( + name=name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + 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}/deletedManagedHSMs/{name}/purge'} # type: ignore + + @distributed_trace def begin_purge_deleted( self, - name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + name: str, + location: str, + **kwargs: Any + ) -> LROPoller[None]: """Permanently deletes the specified managed HSM. :param name: The name of the soft-deleted managed HSM. @@ -824,15 +1089,17 @@ def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -846,21 +1113,14 @@ def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'name': self._serialize.url("name", name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -872,4 +1132,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py index 80a9d4a68d28..65e8ecb8a6dc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py @@ -5,25 +5,183 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_resource_request( + subscription_id: str, + resource_group_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_put_request( + subscription_id: str, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class MHSMPrivateEndpointConnectionsOperations(object): """MHSMPrivateEndpointConnectionsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MHSMPrivateEndpointConnectionsListResult"] + resource_group_name: str, + name: str, + **kwargs: Any + ) -> Iterable["_models.MHSMPrivateEndpointConnectionsListResult"]: """The List operation gets information about the private endpoint connections associated with the managed HSM Pool. @@ -62,8 +220,10 @@ def list_by_resource( :param name: Name of the managed HSM Pool. :type name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either MHSMPrivateEndpointConnectionsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionsListResult] + :return: An iterator like instance of either MHSMPrivateEndpointConnectionsListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnectionsListResult"] @@ -71,36 +231,33 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('MHSMPrivateEndpointConnectionsListResult', pipeline_response) + deserialized = self._deserialize("MHSMPrivateEndpointConnectionsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,25 +270,26 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MHSMPrivateEndpointConnection" + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.MHSMPrivateEndpointConnection": """Gets the specified private endpoint connection associated with the managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -151,34 +309,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, response) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) @@ -187,17 +335,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.MHSMPrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.MHSMPrivateEndpointConnection" + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: "_models.MHSMPrivateEndpointConnection", + **kwargs: Any + ) -> "_models.MHSMPrivateEndpointConnection": """Updates the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -219,33 +369,23 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') + + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -256,49 +396,41 @@ def put( response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.MHSMPrivateEndpointConnection"] + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.MHSMPrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MHSMPrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,29 +438,32 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} if response.status_code == 200: deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if response.status_code == 202: response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.MHSMPrivateEndpointConnection"] + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller["_models.MHSMPrivateEndpointConnection"]: """Deletes the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -340,15 +475,19 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either MHSMPrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MHSMPrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -363,25 +502,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -393,4 +524,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_link_resources_operations.py index 2e5ca8a99b7a..07baa0f2b339 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_link_resources_operations.py @@ -5,22 +5,59 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_mhsm_resource_request( + subscription_id: str, + resource_group_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class MHSMPrivateLinkResourcesOperations(object): """MHSMPrivateLinkResourcesOperations operations. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_mhsm_resource( self, - resource_group_name, # type: str - name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MHSMPrivateLinkResourceListResult" + resource_group_name: str, + name: str, + **kwargs: Any + ) -> "_models.MHSMPrivateLinkResourceListResult": """Gets the private link resources supported for the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -67,27 +104,17 @@ def list_by_mhsm_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_mhsm_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'name': self._serialize.url("name", name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_mhsm_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + template_url=self.list_by_mhsm_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +128,6 @@ def list_by_mhsm_resource( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_mhsm_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_operations.py index b04178d842b3..4262d3e41d63 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_operations.py @@ -5,23 +5,50 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KeyVault/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,16 +72,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -62,30 +90,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +128,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py index 672c3bdb73ab..7a09864aa871 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py @@ -5,25 +5,183 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_put_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,14 +205,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -74,28 +232,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,17 +259,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def put( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - properties, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -143,33 +293,23 @@ def put( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.put.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -180,49 +320,41 @@ def put( response_headers = {} response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, response_headers) return deserialized + put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional["_models.PrivateEndpointConnection"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,29 +362,32 @@ def _delete_initial( map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, error_format=ARMErrorFormat) - response_headers = {} deserialized = None + response_headers = {} 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 + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - vault_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -264,15 +399,19 @@ def begin_delete( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,25 +426,17 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -317,15 +448,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + @distributed_trace def list_by_resource( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """The List operation gets information about the private endpoint connections associated with the vault. @@ -334,8 +466,10 @@ def list_by_resource( :param vault_name: The name of the key vault. :type vault_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -343,36 +477,33 @@ def list_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_resource.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -390,6 +521,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_link_resources_operations.py index 06922aaffaf9..e979cc1d9b36 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_link_resources_operations.py @@ -5,22 +5,59 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_vault_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_vault( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResourceListResult" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResourceListResult": """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -67,27 +104,17 @@ def list_by_vault( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.list_by_vault.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_vault_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + template_url=self.list_by_vault.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +128,6 @@ def list_by_vault( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_vault.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources'} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py index 8ee3a9db6128..7f6d4577e678 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py @@ -5,23 +5,194 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + vault_name: str, + secret_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "secretName": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + vault_name: str, + secret_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "secretName": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vault_name: str, + secret_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "secretName": _SERIALIZER.url("secret_name", secret_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SecretsOperations(object): """SecretsOperations operations. @@ -45,15 +216,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - vault_name, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretCreateOrUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Secret" + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: "_models.SecretCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.Secret": """Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -65,7 +236,8 @@ def create_or_update( :param secret_name: Name of the secret. :type secret_name: str :param parameters: Parameters to create or update the secret. - :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretCreateOrUpdateParameters + :type parameters: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: Secret, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret @@ -76,33 +248,23 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,17 +282,19 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - vault_name, # type: str - secret_name, # type: str - parameters, # type: "_models.SecretPatchParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Secret" + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: "_models.SecretPatchParameters", + **kwargs: Any + ) -> "_models.Secret": """Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -153,33 +317,23 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'SecretPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'SecretPatchParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,16 +351,18 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - secret_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Secret" + resource_group_name: str, + vault_name: str, + secret_name: str, + **kwargs: Any + ) -> "_models.Secret": """Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -226,28 +382,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'secretName': self._serialize.url("secret_name", secret_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -261,16 +407,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - vault_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SecretListResult"] + resource_group_name: str, + vault_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.SecretListResult"]: """The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -283,7 +431,8 @@ def list( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SecretListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] @@ -291,38 +440,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SecretListResult', pipeline_response) + deserialized = self._deserialize("SecretListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -340,6 +486,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py index ac58e909351a..fb4ea849b87f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py @@ -5,25 +5,482 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_update_access_policy_request( + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "operationKind": _SERIALIZER.url("operation_kind", operation_kind, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_deleted_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_deleted_request( + vault_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}') + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_purge_deleted_request_initial( + vault_name: str, + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge') + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + *, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + filter = "resourceType eq 'Microsoft.KeyVault/vaults'" + api_version = "2015-11-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + if top is not None: + query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-06-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VaultsOperations(object): """VaultsOperations operations. @@ -49,43 +506,32 @@ def __init__(self, client, config, serializer, deserializer): 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" + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> "_models.Vault": cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -103,16 +549,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - vault_name, # type: str - parameters, # type: "_models.VaultCreateOrUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Vault"] + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultCreateOrUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Vault"]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -123,15 +571,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultCreateOrUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Vault or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', @@ -143,27 +594,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -175,16 +620,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - vault_name, # type: str - parameters, # type: "_models.VaultPatchParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + parameters: "_models.VaultPatchParameters", + **kwargs: Any + ) -> "_models.Vault": """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -203,32 +649,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VaultPatchParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -246,15 +682,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> None: """Deletes the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -271,27 +709,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -304,13 +732,14 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - vault_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Vault" + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> "_models.Vault": """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -327,27 +756,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -361,17 +780,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore + + @distributed_trace def update_access_policy( self, - resource_group_name, # type: str - vault_name, # type: str - operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] - parameters, # type: "_models.VaultAccessPolicyParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.VaultAccessPolicyParameters" + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: "_models.VaultAccessPolicyParameters", + **kwargs: Any + ) -> "_models.VaultAccessPolicyParameters": """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -379,7 +800,8 @@ def update_access_policy( :param vault_name: Name of the vault. :type vault_name: str :param operation_kind: Name of the operation. - :type operation_kind: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyUpdateKind + :type operation_kind: str or + ~azure.mgmt.keyvault.v2021_06_01_preview.models.AccessPolicyUpdateKind :param parameters: Access policy to merge into the vault. :type parameters: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyParameters :keyword callable cls: A custom type or function that will be passed the direct response @@ -392,33 +814,23 @@ def update_access_policy( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_access_policy.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'vaultName': self._serialize.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), - 'operationKind': self._serialize.url("operation_kind", operation_kind, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -436,15 +848,17 @@ def update_access_policy( 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 + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultListResult"] + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -454,7 +868,8 @@ def list_by_resource_group( :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] @@ -462,37 +877,33 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -510,24 +921,26 @@ def get_next(next_link=None): 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 + @distributed_trace def list_by_subscription( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.VaultListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VaultListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] @@ -535,36 +948,31 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultListResult', pipeline_response) + deserialized = self._deserialize("VaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -582,21 +990,24 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults'} # type: ignore + @distributed_trace def list_deleted( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DeletedVaultListResult"] + **kwargs: Any + ) -> Iterable["_models.DeletedVaultListResult"]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DeletedVaultListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultListResult] + :return: An iterator like instance of either DeletedVaultListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] @@ -604,34 +1015,29 @@ def list_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=self.list_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DeletedVaultListResult', pipeline_response) + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -649,18 +1055,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults'} # type: ignore + @distributed_trace def get_deleted( self, - vault_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DeletedVault" + vault_name: str, + location: str, + **kwargs: Any + ) -> "_models.DeletedVault": """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -677,27 +1084,17 @@ def get_deleted( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_deleted.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_deleted.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -711,41 +1108,32 @@ def get_deleted( 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 + vault_name: str, + location: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - accept = "application/json" - - # Construct URL - url = self._purge_deleted_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + template_url=self._purge_deleted_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,13 +1146,14 @@ def _purge_deleted_initial( _purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + + @distributed_trace def begin_purge_deleted( self, - vault_name, # type: str - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + vault_name: str, + location: str, + **kwargs: Any + ) -> LROPoller[None]: """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. :param vault_name: The name of the soft-deleted vault. @@ -773,15 +1162,17 @@ def begin_purge_deleted( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -795,21 +1186,14 @@ def begin_purge_deleted( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'vaultName': self._serialize.url("vault_name", vault_name, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -821,21 +1205,23 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore + @distributed_trace def list( self, - top=None, # type: Optional[int] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceListResult"] + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.ResourceListResult"]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. :type top: int :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ResourceListResult] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] @@ -843,38 +1229,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - filter = "resourceType eq 'Microsoft.KeyVault/vaults'" - api_version = "2015-11-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - if top is not None: - query_parameters['$top'] = self._serialize.query("top", top, 'int') - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + top=top, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ResourceListResult', pipeline_response) + deserialized = self._deserialize("ResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -892,21 +1271,23 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resources'} # type: ignore + @distributed_trace def check_name_availability( self, - vault_name, # type: "_models.VaultCheckNameAvailabilityParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameAvailabilityResult" + vault_name: "_models.VaultCheckNameAvailabilityParameters", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResult": """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. - :type vault_name: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultCheckNameAvailabilityParameters + :type vault_name: + ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultCheckNameAvailabilityParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityResult, or the result of cls(response) :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.CheckNameAvailabilityResult @@ -917,30 +1298,20 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - 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 @@ -954,4 +1325,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability'} # type: ignore +