diff --git a/sdk/keyvault/azure-mgmt-keyvault/_meta.json b/sdk/keyvault/azure-mgmt-keyvault/_meta.json index 7d346d26cca5..edf35961488b 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": "b8fa43756c72adab0cb47380d59d82f7c53034ec", "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 --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..809036870bc3 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/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..dcc26b1bc4f5 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,23 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class KeyVaultManagementClient(object): """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. @@ -33,52 +32,60 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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/_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 index cc5ba5da4cf9..551617772b2b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models.py @@ -14,17 +14,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 = { @@ -44,6 +44,20 @@ def __init__( self, **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 = kwargs['tenant_id'] self.object_id = kwargs['object_id'] @@ -84,6 +98,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -101,8 +117,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 = { @@ -122,6 +138,10 @@ def __init__( self, **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 @@ -132,10 +152,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 = { @@ -147,6 +167,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -189,6 +215,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -200,12 +228,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 = { @@ -218,6 +246,14 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -227,14 +263,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 = { @@ -248,6 +284,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -258,14 +304,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 = { @@ -279,6 +325,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -289,10 +345,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 = { @@ -304,6 +360,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -312,14 +374,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 = { @@ -333,6 +396,17 @@ def __init__( self, **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 = kwargs.get('keys', None) self.secrets = kwargs.get('secrets', None) @@ -353,10 +427,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 = { @@ -378,6 +452,13 @@ def __init__( self, **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 @@ -389,10 +470,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 = { @@ -404,6 +485,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -412,8 +499,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 = { @@ -424,6 +511,10 @@ def __init__( self, **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 = kwargs.get('log_specifications', None) @@ -433,11 +524,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 = { @@ -454,6 +545,13 @@ def __init__( self, **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 = kwargs.get('family', "A") self.name = kwargs['name'] @@ -472,12 +570,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 = { @@ -501,6 +599,15 @@ def __init__( self, **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__(**kwargs) self.properties = kwargs['properties'] @@ -520,8 +627,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 = { @@ -544,6 +651,10 @@ def __init__( self, **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 @@ -557,9 +668,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 = { @@ -574,6 +685,11 @@ def __init__( self, **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 = kwargs['access_policies'] @@ -585,8 +701,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 @@ -608,6 +724,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -617,12 +737,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 = { @@ -640,6 +760,15 @@ def __init__( self, **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 = kwargs['location'] self.tags = kwargs.get('tags', None) @@ -649,10 +778,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 = { @@ -664,6 +793,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -672,10 +807,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 = { @@ -687,6 +822,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) @@ -695,33 +836,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 = { @@ -740,6 +881,35 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.sku = kwargs.get('sku', None) @@ -757,41 +927,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 = { @@ -816,6 +986,43 @@ def __init__( self, **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 = kwargs['tenant_id'] self.sku = kwargs['sku'] 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..0961cd513996 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,24 +5,58 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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..055e0b1b6575 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,26 +5,468 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_or_update_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class VaultsOperations(object): """VaultsOperations operations. @@ -47,6 +489,7 @@ 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 @@ -73,32 +516,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] - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,8 +549,11 @@ 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 @@ -144,32 +580,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,8 +613,11 @@ 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 @@ -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,6 +664,8 @@ 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 @@ -266,27 +689,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,8 +713,11 @@ 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 @@ -331,33 +747,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,8 +781,11 @@ 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 @@ -401,37 +810,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,11 +854,13 @@ 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] @@ -474,36 +881,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,11 +923,13 @@ 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 @@ -534,8 +938,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.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 +949,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,11 +989,13 @@ 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 @@ -616,27 +1019,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,8 +1043,10 @@ 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 @@ -664,25 +1059,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -695,6 +1082,8 @@ 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 @@ -710,15 +1099,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 +1123,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,8 +1142,10 @@ 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] @@ -772,7 +1158,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.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 +1167,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,11 +1209,13 @@ 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" @@ -854,30 +1236,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 +1263,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..936bc4c8930a 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/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..3427c083acdc 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,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class KeyVaultManagementClient(object): """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. @@ -32,63 +29,71 @@ class KeyVaultManagementClient(object): :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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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/_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 index 2ee0b2c6683d..2cbea634f404 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models.py @@ -14,17 +14,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 = { @@ -44,6 +44,20 @@ def __init__( self, **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 = kwargs['tenant_id'] self.object_id = kwargs['object_id'] @@ -84,6 +98,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -93,11 +109,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 = { @@ -109,6 +125,13 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -125,8 +148,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 = { @@ -146,6 +169,10 @@ def __init__( self, **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 @@ -156,10 +183,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 = { @@ -171,6 +198,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -213,6 +246,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -226,9 +261,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 = { @@ -243,6 +278,11 @@ def __init__( self, **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 = kwargs['value'] @@ -250,12 +290,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 = { @@ -268,6 +308,14 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -277,18 +325,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 = { @@ -302,6 +351,21 @@ def __init__( self, **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 = kwargs.get('bypass', None) self.default_action = kwargs.get('default_action', None) @@ -312,14 +376,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 = { @@ -333,6 +397,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -343,14 +417,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 = { @@ -364,6 +438,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -374,10 +458,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 = { @@ -389,6 +473,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -397,14 +487,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 = { @@ -418,6 +509,17 @@ def __init__( self, **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 = kwargs.get('keys', None) self.secrets = kwargs.get('secrets', None) @@ -446,6 +548,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -487,6 +591,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -510,10 +616,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". @@ -545,6 +651,13 @@ def __init__( self, **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 = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) @@ -556,10 +669,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". @@ -581,6 +694,13 @@ def __init__( self, **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 = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) @@ -606,8 +726,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 = { @@ -635,6 +755,10 @@ def __init__( self, **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 @@ -644,8 +768,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 = { @@ -656,6 +780,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -663,15 +791,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 = { @@ -684,6 +812,17 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -693,10 +832,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 = { @@ -708,6 +847,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -716,8 +861,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 = { @@ -728,6 +873,10 @@ def __init__( self, **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 = kwargs.get('log_specifications', None) @@ -737,11 +886,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 = { @@ -758,6 +907,13 @@ def __init__( self, **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 = kwargs.get('family', "A") self.name = kwargs['name'] @@ -776,12 +932,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 = { @@ -804,6 +960,14 @@ def __init__( self, **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 @@ -828,8 +992,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 = { @@ -852,6 +1016,10 @@ def __init__( self, **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 @@ -865,9 +1033,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 = { @@ -882,6 +1050,11 @@ def __init__( self, **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 = kwargs['access_policies'] @@ -893,8 +1066,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 @@ -916,6 +1089,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -925,12 +1102,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 = { @@ -948,6 +1125,15 @@ def __init__( self, **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 = kwargs['location'] self.tags = kwargs.get('tags', None) @@ -957,10 +1143,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 = { @@ -972,6 +1158,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -980,10 +1172,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 = { @@ -995,6 +1187,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) @@ -1003,38 +1201,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 = { @@ -1054,6 +1252,40 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.sku = kwargs.get('sku', None) @@ -1074,42 +1306,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: @@ -1141,6 +1373,44 @@ def __init__( self, **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 = kwargs['tenant_id'] self.sku = kwargs['sku'] @@ -1161,9 +1431,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 = { @@ -1178,5 +1448,10 @@ def __init__( self, **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 = 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..793d507d57bd 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,24 +5,58 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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..868b48b5d783 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,25 +5,151 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -46,6 +172,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -73,28 +200,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,8 +225,11 @@ 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 @@ -140,33 +260,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,14 +287,17 @@ 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 @@ -198,28 +311,18 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -227,21 +330,25 @@ 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 @@ -261,15 +368,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 +395,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 +417,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..d0ccb69e2947 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,23 +5,67 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_vault_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -67,27 +112,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +136,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..c618cedb7b29 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,26 +5,468 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_or_update_request_initial( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class VaultsOperations(object): """VaultsOperations operations. @@ -60,32 +502,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,8 +535,11 @@ 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 @@ -123,15 +558,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 +581,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,8 +607,10 @@ 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 @@ -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] - # 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 @@ -246,8 +670,11 @@ 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 @@ -271,25 +698,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,6 +721,8 @@ 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 @@ -325,27 +746,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,8 +770,11 @@ 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 @@ -390,33 +804,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] - # 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 @@ -434,8 +838,11 @@ 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 @@ -460,37 +867,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,11 +911,13 @@ 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] @@ -533,36 +938,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,11 +980,13 @@ 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 @@ -593,8 +995,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.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 +1006,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,11 +1046,13 @@ 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 @@ -675,27 +1076,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,8 +1100,10 @@ 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 @@ -723,25 +1116,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -754,6 +1139,8 @@ 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 @@ -769,15 +1156,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 +1180,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,8 +1199,10 @@ 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] @@ -831,7 +1215,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.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 +1224,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,11 +1266,13 @@ 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" @@ -913,30 +1293,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 +1320,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..4d94542a9cee 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/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..d3156b1d582f 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,26 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class KeyVaultManagementClient(object): """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. @@ -33,67 +29,74 @@ class KeyVaultManagementClient(object): :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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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/_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 index cd62451dea0a..ea6829ad094d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models.py @@ -14,17 +14,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 = { @@ -44,6 +44,20 @@ def __init__( self, **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 = kwargs['tenant_id'] self.object_id = kwargs['object_id'] @@ -56,12 +70,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. @@ -93,6 +107,14 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.not_before = kwargs.get('not_before', None) @@ -135,6 +157,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -144,11 +168,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 = { @@ -160,6 +184,13 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -176,8 +207,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 = { @@ -197,6 +228,10 @@ def __init__( self, **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 @@ -207,10 +242,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 = { @@ -222,6 +257,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -268,6 +309,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -280,13 +323,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 = { @@ -299,6 +342,15 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -310,9 +362,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 = { @@ -327,6 +379,11 @@ def __init__( self, **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 = kwargs['value'] @@ -368,6 +425,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -391,18 +450,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. @@ -438,6 +497,20 @@ def __init__( self, **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 = kwargs.get('attributes', None) self.kty = kwargs.get('kty', None) @@ -453,12 +526,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. @@ -490,6 +563,14 @@ def __init__( self, **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) @@ -498,10 +579,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 = { @@ -517,6 +598,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs['properties'] @@ -525,10 +612,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 = { @@ -540,6 +627,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -550,18 +643,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. @@ -587,6 +680,20 @@ def __init__( self, **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 = kwargs.get('attributes', None) self.kty = kwargs.get('kty', None) @@ -600,12 +707,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 = { @@ -618,6 +725,14 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -627,29 +742,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 = { @@ -670,6 +785,31 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -687,18 +827,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 = { @@ -712,6 +853,21 @@ def __init__( self, **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 = kwargs.get('bypass', None) self.default_action = kwargs.get('default_action', None) @@ -722,16 +878,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 = { @@ -746,6 +902,18 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -757,14 +925,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 = { @@ -778,6 +946,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -788,10 +966,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 = { @@ -803,6 +981,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -811,14 +995,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 = { @@ -832,6 +1017,17 @@ def __init__( self, **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 = kwargs.get('keys', None) self.secrets = kwargs.get('secrets', None) @@ -860,6 +1056,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -879,12 +1077,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". @@ -917,6 +1115,15 @@ def __init__( self, **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 = kwargs.get('etag', None) self.private_endpoint = kwargs.get('private_endpoint', None) @@ -929,14 +1136,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". @@ -960,6 +1167,17 @@ def __init__( self, **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 = kwargs.get('id', None) self.etag = kwargs.get('etag', None) @@ -987,8 +1205,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 = { @@ -1016,6 +1234,10 @@ def __init__( self, **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 @@ -1025,8 +1247,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 = { @@ -1037,6 +1259,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1044,15 +1270,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 = { @@ -1065,6 +1291,17 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -1074,10 +1311,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 = { @@ -1089,6 +1326,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1097,10 +1340,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 = { @@ -1112,6 +1356,13 @@ def __init__( self, **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 = kwargs.get('log_specifications', None) self.metric_specifications = kwargs.get('metric_specifications', None) @@ -1122,11 +1373,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 = { @@ -1143,6 +1394,13 @@ def __init__( self, **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 = kwargs.get('family', "A") self.name = kwargs['name'] @@ -1161,12 +1419,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 = { @@ -1189,6 +1447,14 @@ def __init__( self, **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 @@ -1213,8 +1479,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 = { @@ -1237,6 +1503,10 @@ def __init__( self, **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 @@ -1250,9 +1520,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 = { @@ -1267,6 +1537,11 @@ def __init__( self, **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 = kwargs['access_policies'] @@ -1278,8 +1553,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 @@ -1301,6 +1576,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -1310,12 +1589,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 = { @@ -1333,6 +1612,15 @@ def __init__( self, **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 = kwargs['location'] self.tags = kwargs.get('tags', None) @@ -1342,10 +1630,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 = { @@ -1357,6 +1645,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1365,10 +1659,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 = { @@ -1380,6 +1674,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) @@ -1388,47 +1688,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 = { @@ -1450,6 +1750,50 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.sku = kwargs.get('sku', None) @@ -1472,58 +1816,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: @@ -1560,6 +1905,60 @@ def __init__( self, **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 = kwargs['tenant_id'] self.sku = kwargs['sku'] @@ -1584,12 +1983,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 = { @@ -1605,6 +2004,14 @@ def __init__( self, **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 = 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..05b48c91d725 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,24 +5,226 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_if_not_exist_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + key_version, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class KeysOperations(object): """KeysOperations operations. @@ -45,6 +247,7 @@ 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 @@ -77,33 +280,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,8 +310,11 @@ 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 @@ -146,28 +342,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,8 +367,11 @@ 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 @@ -207,36 +396,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,11 +440,13 @@ 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 @@ -289,29 +477,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,8 +503,11 @@ 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 @@ -354,37 +535,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 +581,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..395d193bbcd1 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,24 +5,58 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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..0105124b6eff 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,25 +5,151 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -46,6 +172,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -73,28 +200,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,8 +227,11 @@ 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 @@ -142,33 +262,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,14 +289,17 @@ 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 @@ -200,28 +313,18 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -229,21 +332,25 @@ 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 @@ -263,15 +370,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 +397,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 +419,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..e8504e9197e3 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,23 +5,67 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_vault_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -67,27 +112,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +136,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..7e0592ccc54c 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,26 +5,480 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_or_update_request_initial( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class VaultsOperations(object): """VaultsOperations operations. @@ -60,32 +514,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,8 +547,11 @@ 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 @@ -123,15 +570,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 +593,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,8 +619,10 @@ 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 @@ -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] - # 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 @@ -246,8 +682,11 @@ 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 @@ -271,27 +710,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,6 +733,8 @@ 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 @@ -327,27 +758,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,8 +782,11 @@ 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 @@ -392,33 +816,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] - # 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 @@ -436,8 +850,11 @@ 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 @@ -462,37 +879,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,11 +923,13 @@ 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] @@ -535,36 +950,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,11 +992,13 @@ 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 @@ -595,8 +1007,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.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 +1018,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,11 +1058,13 @@ 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 @@ -677,27 +1088,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,8 +1112,10 @@ 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 @@ -725,27 +1128,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,6 +1151,8 @@ 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 @@ -773,15 +1168,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 +1192,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,8 +1211,10 @@ 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] @@ -835,7 +1227,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.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 +1236,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,11 +1278,13 @@ 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" @@ -917,30 +1305,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 +1332,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..6e3f69b851ce 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/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..d1794a834590 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,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class KeyVaultManagementClient(object): """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. @@ -37,9 +31,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 +44,65 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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/_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 index f6eaade6688d..e43c2eaf6344 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models.py @@ -15,17 +15,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 = { @@ -45,6 +45,20 @@ def __init__( self, **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 = kwargs['tenant_id'] self.object_id = kwargs['object_id'] @@ -57,12 +71,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. @@ -86,6 +100,14 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.not_before = kwargs.get('not_before', None) @@ -127,6 +149,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -136,11 +160,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 = { @@ -152,6 +176,13 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -168,8 +199,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 = { @@ -189,6 +220,10 @@ def __init__( self, **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 @@ -199,10 +234,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 = { @@ -214,6 +249,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -260,6 +301,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -272,13 +315,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 = { @@ -291,6 +334,15 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -326,6 +378,8 @@ def __init__( self, **kwargs ): + """ + """ super(Error, self).__init__(**kwargs) self.code = None self.message = None @@ -337,9 +391,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 +408,11 @@ def __init__( self, **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 = kwargs['value'] @@ -395,6 +454,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -418,18 +479,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. @@ -465,6 +527,22 @@ def __init__( self, **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 = kwargs.get('attributes', None) self.kty = kwargs.get('kty', None) @@ -480,12 +558,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. @@ -518,6 +596,14 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.not_before = kwargs.get('not_before', None) @@ -532,10 +618,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 = { @@ -551,6 +637,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs['properties'] @@ -559,10 +651,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 = { @@ -574,6 +666,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -584,18 +682,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. @@ -621,6 +720,22 @@ def __init__( self, **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 = kwargs.get('attributes', None) self.kty = kwargs.get('kty', None) @@ -634,12 +749,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 = { @@ -652,6 +767,14 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -669,12 +792,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 = { @@ -696,6 +819,14 @@ def __init__( self, **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 @@ -716,14 +847,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 = { @@ -746,6 +877,16 @@ def __init__( self, **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__(**kwargs) self.properties = kwargs.get('properties', None) @@ -771,6 +912,8 @@ def __init__( self, **kwargs ): + """ + """ super(ManagedHsmError, self).__init__(**kwargs) self.error = None @@ -778,10 +921,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 = { @@ -793,6 +936,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -803,30 +952,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", @@ -858,6 +1007,31 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.initial_admin_object_ids = kwargs.get('initial_admin_object_ids', None) @@ -875,11 +1049,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 = { @@ -896,6 +1070,13 @@ def __init__( self, **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 = kwargs.get('family', "B") self.name = kwargs['name'] @@ -904,29 +1085,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 = { @@ -947,6 +1128,32 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -964,18 +1171,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] """ @@ -990,6 +1199,23 @@ def __init__( self, **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 = kwargs.get('bypass', None) self.default_action = kwargs.get('default_action', None) @@ -1000,16 +1226,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 """ @@ -1025,6 +1251,19 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1036,14 +1275,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 = { @@ -1057,6 +1296,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1067,10 +1316,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 = { @@ -1082,6 +1331,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1090,15 +1345,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 = { @@ -1112,6 +1369,19 @@ def __init__( self, **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 = kwargs.get('keys', None) self.secrets = kwargs.get('secrets', None) @@ -1140,6 +1410,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1159,12 +1431,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". @@ -1197,6 +1469,15 @@ def __init__( self, **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 = kwargs.get('etag', None) self.private_endpoint = kwargs.get('private_endpoint', None) @@ -1209,14 +1490,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". @@ -1240,6 +1521,17 @@ def __init__( self, **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 = kwargs.get('id', None) self.etag = kwargs.get('etag', None) @@ -1267,8 +1559,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 = { @@ -1296,6 +1588,10 @@ def __init__( self, **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 @@ -1305,8 +1601,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 = { @@ -1317,6 +1613,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1324,15 +1624,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 = { @@ -1345,6 +1646,18 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -1354,10 +1667,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 = { @@ -1369,6 +1682,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1391,8 +1710,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 = { @@ -1417,6 +1736,10 @@ def __init__( self, **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 = kwargs['properties'] @@ -1426,12 +1749,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. @@ -1455,6 +1778,14 @@ def __init__( self, **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__(**kwargs) @@ -1463,10 +1794,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 = { @@ -1482,6 +1813,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs['properties'] @@ -1490,10 +1827,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 = { @@ -1505,6 +1842,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1513,10 +1856,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 = { @@ -1528,6 +1871,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) @@ -1536,12 +1885,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 = { @@ -1554,6 +1903,14 @@ def __init__( self, **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 = kwargs.get('value', None) self.content_type = kwargs.get('content_type', None) @@ -1565,14 +1922,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. @@ -1596,6 +1953,16 @@ def __init__( self, **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 = kwargs.get('value', None) self.content_type = kwargs.get('content_type', None) @@ -1607,11 +1974,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] """ @@ -1624,6 +1991,14 @@ def __init__( self, **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 = kwargs.get('log_specifications', None) self.metric_specifications = kwargs.get('metric_specifications', None) @@ -1634,11 +2009,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 = { @@ -1655,6 +2030,13 @@ def __init__( self, **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 = kwargs.get('family', "A") self.name = kwargs['name'] @@ -1663,21 +2045,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 = { @@ -1693,6 +2075,23 @@ def __init__( self, **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 = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -1715,14 +2114,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 = { @@ -1747,6 +2146,14 @@ def __init__( self, **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 @@ -1772,8 +2179,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 = { @@ -1796,6 +2204,11 @@ def __init__( self, **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 @@ -1809,9 +2222,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 = { @@ -1826,6 +2240,12 @@ def __init__( self, **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 = kwargs['access_policies'] @@ -1837,8 +2257,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 @@ -1860,6 +2280,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -1869,12 +2293,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 = { @@ -1892,6 +2316,15 @@ def __init__( self, **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 = kwargs['location'] self.tags = kwargs.get('tags', None) @@ -1901,10 +2334,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 = { @@ -1916,6 +2349,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1924,10 +2363,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 = { @@ -1939,6 +2378,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) @@ -1947,47 +2392,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 = { @@ -2009,6 +2455,51 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.sku = kwargs.get('sku', None) @@ -2031,55 +2522,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. @@ -2115,6 +2607,60 @@ def __init__( self, **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 = kwargs['tenant_id'] self.sku = kwargs['sku'] @@ -2138,12 +2684,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 = { @@ -2159,6 +2705,14 @@ def __init__( self, **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 = 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..d1683fa0d68c 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,24 +5,226 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_if_not_exist_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + key_version, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class KeysOperations(object): """KeysOperations operations. @@ -45,6 +247,7 @@ 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 @@ -77,33 +280,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,8 +310,11 @@ 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 @@ -146,28 +342,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,8 +367,11 @@ 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 @@ -199,7 +388,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 +397,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,11 +441,13 @@ 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 @@ -289,29 +478,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,8 +504,11 @@ 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 @@ -346,7 +528,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 +537,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 +583,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..f1e0a25fba8a 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,26 +5,260 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_or_update_request_initial( + resource_group_name, # type: str + name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name, # type: str + name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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 + ) + +# fmt: on class ManagedHsmsOperations(object): """ManagedHsmsOperations operations. @@ -60,39 +294,28 @@ 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 = 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,8 +327,11 @@ 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 @@ -124,15 +350,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 +374,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,6 +400,7 @@ 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( @@ -191,39 +416,28 @@ 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 = 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,8 +449,11 @@ 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 @@ -255,15 +472,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 +496,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,6 +522,7 @@ 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( @@ -321,40 +537,31 @@ 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 = 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 @@ -370,15 +577,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 +601,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,8 +620,10 @@ 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 @@ -443,33 +647,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,8 +674,11 @@ 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 @@ -497,8 +694,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 +705,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,17 +744,19 @@ 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] @@ -572,8 +769,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.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 +780,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 +817,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..fe88f072fade 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,24 +5,58 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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..b39c8fcf5029 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,25 +5,151 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -46,6 +172,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -73,28 +200,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,8 +227,11 @@ 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 @@ -142,33 +262,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,14 +289,17 @@ 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 @@ -200,28 +313,18 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -229,21 +332,25 @@ 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 @@ -263,15 +370,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 +397,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 +419,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..dc33d46c30fe 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,23 +5,67 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_vault_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -67,27 +112,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +136,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..d497ca457c14 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,24 +5,194 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_or_update_request( + resource_group_name, # type: str + vault_name, # type: str + secret_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + vault_name, # type: str + secret_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + vault_name, # type: str + secret_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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 + ) + +# fmt: on class SecretsOperations(object): """SecretsOperations operations. @@ -45,6 +215,7 @@ 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 @@ -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,8 +282,11 @@ 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 @@ -153,33 +318,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,8 +352,11 @@ 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 @@ -226,28 +384,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,8 +409,11 @@ 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 @@ -283,7 +434,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 +443,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 +489,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..2cbaa463440e 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,26 +5,480 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_or_update_request_initial( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class VaultsOperations(object): """VaultsOperations operations. @@ -60,32 +514,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,8 +547,11 @@ 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 @@ -123,15 +570,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 +593,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,8 +619,10 @@ 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 @@ -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] - # 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 @@ -246,8 +682,11 @@ 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 @@ -271,27 +710,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,6 +733,8 @@ 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 @@ -327,27 +758,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,8 +782,11 @@ 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 @@ -379,7 +803,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 +817,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] - # 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 @@ -436,8 +851,11 @@ 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 @@ -454,7 +872,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 +881,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,11 +925,13 @@ 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] @@ -527,7 +944,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.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 +953,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,11 +995,13 @@ 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 @@ -595,8 +1010,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.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 +1021,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,11 +1061,13 @@ 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 @@ -677,27 +1091,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,8 +1115,10 @@ 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 @@ -725,27 +1131,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,6 +1154,8 @@ 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 @@ -773,15 +1171,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 +1195,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,8 +1214,10 @@ 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] @@ -835,7 +1230,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.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 +1239,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,11 +1281,13 @@ 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" @@ -906,7 +1297,8 @@ 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 @@ -917,30 +1309,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 +1336,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..b2c4d2893180 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/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..762b73305a92 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,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class KeyVaultManagementClient(object): """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. @@ -35,75 +29,82 @@ class KeyVaultManagementClient(object): :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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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/_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 index 0429c6377b26..3e523ff86931 100644 --- 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 @@ -15,17 +15,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 = { @@ -45,6 +45,20 @@ def __init__( self, **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 = kwargs['tenant_id'] self.object_id = kwargs['object_id'] @@ -85,6 +99,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -94,11 +110,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 = { @@ -110,6 +126,13 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -126,8 +149,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 = { @@ -147,6 +171,11 @@ def __init__( self, **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 @@ -157,10 +186,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 = { @@ -172,6 +201,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -218,6 +253,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedManagedHsmProperties, self).__init__(**kwargs) self.mhsm_id = None self.location = None @@ -238,8 +275,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 = { @@ -259,6 +296,10 @@ def __init__( self, **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 @@ -269,10 +310,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 = { @@ -284,6 +325,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -330,6 +377,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -342,13 +391,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 = { @@ -361,6 +410,15 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -396,6 +454,8 @@ def __init__( self, **kwargs ): + """ + """ super(Error, self).__init__(**kwargs) self.code = None self.message = None @@ -407,9 +467,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 = { @@ -424,6 +484,11 @@ def __init__( self, **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 = kwargs['value'] @@ -431,12 +496,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 = { @@ -449,6 +514,14 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -466,12 +539,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 @@ -498,6 +571,14 @@ def __init__( self, **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 @@ -519,17 +600,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 = { @@ -554,6 +635,16 @@ def __init__( self, **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__(**kwargs) self.properties = kwargs.get('properties', None) @@ -579,6 +670,8 @@ def __init__( self, **kwargs ): + """ + """ super(ManagedHsmError, self).__init__(**kwargs) self.error = None @@ -586,10 +679,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 = { @@ -601,6 +694,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -611,30 +710,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", @@ -642,16 +741,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 @@ -685,6 +784,38 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.initial_admin_object_ids = kwargs.get('initial_admin_object_ids', None) @@ -706,11 +837,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 = { @@ -727,6 +858,13 @@ def __init__( self, **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 = kwargs.get('family', "B") self.name = kwargs['name'] @@ -735,29 +873,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 = { @@ -778,6 +916,32 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -797,9 +961,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 = { @@ -814,6 +978,11 @@ def __init__( self, **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 = kwargs['value'] @@ -821,18 +990,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] """ @@ -847,6 +1018,23 @@ def __init__( self, **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 = kwargs.get('bypass', None) self.default_action = kwargs.get('default_action', None) @@ -875,6 +1063,8 @@ def __init__( self, **kwargs ): + """ + """ super(MHSMPrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -890,25 +1080,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 """ @@ -937,6 +1127,26 @@ def __init__( self, **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__(**kwargs) self.etag = kwargs.get('etag', None) self.private_endpoint = kwargs.get('private_endpoint', None) @@ -947,14 +1157,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 """ @@ -968,6 +1178,18 @@ def __init__( self, **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 = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) @@ -977,11 +1199,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 = { @@ -993,6 +1215,13 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1009,12 +1238,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 @@ -1022,8 +1251,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 = { @@ -1052,6 +1281,16 @@ def __init__( self, **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__(**kwargs) self.group_id = None self.required_members = None @@ -1061,8 +1300,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 = { @@ -1073,6 +1312,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1080,15 +1323,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 = { @@ -1101,6 +1345,18 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -1112,9 +1368,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 = { @@ -1129,6 +1385,11 @@ def __init__( self, **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 = kwargs['id'] @@ -1136,18 +1397,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] """ @@ -1162,6 +1425,23 @@ def __init__( self, **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 = kwargs.get('bypass', None) self.default_action = kwargs.get('default_action', None) @@ -1172,16 +1452,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 """ @@ -1197,6 +1477,19 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1208,14 +1501,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 = { @@ -1229,6 +1522,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1239,10 +1542,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 = { @@ -1254,6 +1557,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1262,15 +1571,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 = { @@ -1284,6 +1595,19 @@ def __init__( self, **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 = kwargs.get('keys', None) self.secrets = kwargs.get('secrets', None) @@ -1312,6 +1636,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1353,6 +1679,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -1376,16 +1704,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 """ @@ -1413,6 +1741,19 @@ def __init__( self, **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 = kwargs.get('etag', None) self.private_endpoint = kwargs.get('private_endpoint', None) @@ -1423,18 +1764,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 """ @@ -1450,6 +1791,21 @@ def __init__( self, **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 = kwargs.get('id', None) self.etag = kwargs.get('etag', None) @@ -1461,10 +1817,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 = { @@ -1476,6 +1832,13 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1500,8 +1863,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 = { @@ -1529,6 +1892,10 @@ def __init__( self, **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 @@ -1538,8 +1905,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 = { @@ -1550,6 +1917,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1557,15 +1928,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 = { @@ -1578,6 +1950,18 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -1587,10 +1971,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 = { @@ -1602,6 +1986,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1610,11 +2000,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] """ @@ -1627,6 +2017,14 @@ def __init__( self, **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 = kwargs.get('log_specifications', None) self.metric_specifications = kwargs.get('metric_specifications', None) @@ -1637,11 +2035,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 = { @@ -1658,6 +2056,13 @@ def __init__( self, **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 = kwargs.get('family', "A") self.name = kwargs['name'] @@ -1666,21 +2071,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 = { @@ -1696,6 +2101,23 @@ def __init__( self, **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 = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -1718,14 +2140,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 = { @@ -1750,6 +2172,14 @@ def __init__( self, **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 @@ -1775,8 +2205,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 = { @@ -1799,6 +2230,11 @@ def __init__( self, **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 @@ -1812,9 +2248,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 = { @@ -1829,6 +2266,12 @@ def __init__( self, **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 = kwargs['access_policies'] @@ -1840,8 +2283,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 @@ -1863,6 +2306,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -1872,12 +2319,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 = { @@ -1895,6 +2342,15 @@ def __init__( self, **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 = kwargs['location'] self.tags = kwargs.get('tags', None) @@ -1904,10 +2360,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 = { @@ -1919,6 +2375,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1927,10 +2389,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 = { @@ -1942,6 +2404,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) @@ -1950,47 +2418,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 = { @@ -2012,6 +2481,51 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.sku = kwargs.get('sku', None) @@ -2034,57 +2548,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. @@ -2122,6 +2637,60 @@ def __init__( self, **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 = kwargs['tenant_id'] self.sku = kwargs['sku'] @@ -2146,12 +2715,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 = { @@ -2167,6 +2736,14 @@ def __init__( self, **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 = 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..07d876eb1767 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,26 +5,364 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_or_update_request_initial( + resource_group_name, # type: str + name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name, # type: str + name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ManagedHsmsOperations(object): """ManagedHsmsOperations operations. @@ -60,39 +398,28 @@ 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 = 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,8 +431,11 @@ 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 @@ -124,15 +454,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 +478,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,6 +504,7 @@ 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( @@ -191,39 +520,28 @@ 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 = 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,8 +553,11 @@ 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 @@ -255,15 +576,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 +600,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,6 +626,7 @@ 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( @@ -321,40 +641,31 @@ 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 = 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 @@ -370,15 +681,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 +705,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,8 +724,10 @@ 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 @@ -443,33 +751,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,8 +778,11 @@ 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 @@ -497,8 +798,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 +809,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,17 +848,19 @@ 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] @@ -572,8 +873,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.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 +884,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,17 +921,19 @@ 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 @@ -643,8 +943,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.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 +954,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,17 +989,19 @@ 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 @@ -726,33 +1025,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,8 +1050,10 @@ 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 @@ -775,40 +1066,31 @@ 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 = 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 @@ -824,15 +1106,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 +1130,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 +1149,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..7c25b9f89a10 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,26 +5,188 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_resource_request( + subscription_id, # type: str + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class MHSMPrivateEndpointConnectionsOperations(object): """MHSMPrivateEndpointConnectionsOperations operations. @@ -47,6 +209,7 @@ 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 @@ -62,8 +225,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 +236,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,17 +275,19 @@ 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 @@ -151,34 +315,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,8 +341,11 @@ 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 @@ -219,33 +376,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,14 +403,17 @@ 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 @@ -277,28 +427,18 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,21 +446,25 @@ 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 @@ -340,15 +484,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 +511,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 +533,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..c9294b1c9d7e 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,23 +5,67 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_mhsm_resource_request( + subscription_id, # type: str + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class MHSMPrivateLinkResourcesOperations(object): """MHSMPrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -67,27 +112,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +136,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..9384370d87c4 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,24 +5,58 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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..599384a7483b 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,26 +5,188 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,6 +209,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -74,28 +237,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,8 +264,11 @@ 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 @@ -143,33 +299,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,14 +326,17 @@ 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 @@ -201,28 +350,18 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,21 +369,25 @@ 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 @@ -264,15 +407,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 +434,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,8 +456,10 @@ 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 @@ -334,8 +475,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 +486,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 +530,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..da484f64b849 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,23 +5,67 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_vault_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -67,27 +112,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +136,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..d661af5db424 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,26 +5,480 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_or_update_request_initial( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class VaultsOperations(object): """VaultsOperations operations. @@ -60,32 +514,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,8 +547,11 @@ 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 @@ -123,15 +570,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 +593,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,8 +619,10 @@ 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 @@ -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] - # 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 @@ -246,8 +682,11 @@ 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 @@ -271,27 +710,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,6 +733,8 @@ 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 @@ -327,27 +758,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,8 +782,11 @@ 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 @@ -379,7 +803,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 +817,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] - # 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 @@ -436,8 +851,11 @@ 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 @@ -454,7 +872,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 +881,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,11 +925,13 @@ 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] @@ -527,7 +944,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.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 +953,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,11 +995,13 @@ 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 @@ -595,8 +1010,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.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 +1021,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,11 +1061,13 @@ 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 @@ -677,27 +1091,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,8 +1115,10 @@ 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 @@ -725,27 +1131,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,6 +1154,8 @@ 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 @@ -773,15 +1171,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 +1195,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,8 +1214,10 @@ 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] @@ -835,7 +1230,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.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 +1239,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,11 +1281,13 @@ 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" @@ -906,7 +1297,8 @@ 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 @@ -917,30 +1309,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 +1336,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..72340e2df206 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/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..2fe427733e8a 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,30 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class KeyVaultManagementClient(object): """The Azure management API provides a RESTful set of web services that interact with Azure Key Vault. @@ -39,81 +31,86 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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/_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 index e45a2139da24..221efd97d8e0 100644 --- 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 @@ -15,17 +15,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 = { @@ -45,6 +45,20 @@ def __init__( self, **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 = kwargs['tenant_id'] self.object_id = kwargs['object_id'] @@ -55,8 +69,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 = { @@ -67,6 +82,11 @@ def __init__( self, **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 = kwargs.get('type', None) @@ -76,12 +96,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. @@ -105,6 +125,14 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.not_before = kwargs.get('not_before', None) @@ -146,6 +174,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -155,11 +185,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 = { @@ -171,6 +201,13 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -187,8 +224,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 = { @@ -208,6 +246,11 @@ def __init__( self, **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 @@ -218,10 +261,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 = { @@ -233,6 +276,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -279,6 +328,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedManagedHsmProperties, self).__init__(**kwargs) self.mhsm_id = None self.location = None @@ -299,8 +350,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 = { @@ -320,6 +371,10 @@ def __init__( self, **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 @@ -330,10 +385,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 = { @@ -345,6 +400,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -391,6 +452,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedVaultProperties, self).__init__(**kwargs) self.vault_id = None self.location = None @@ -403,13 +466,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 = { @@ -422,6 +485,15 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -457,6 +529,8 @@ def __init__( self, **kwargs ): + """ + """ super(Error, self).__init__(**kwargs) self.code = None self.message = None @@ -468,9 +542,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 = { @@ -485,6 +559,11 @@ def __init__( self, **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 = kwargs['value'] @@ -526,6 +605,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -549,28 +630,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 = { @@ -604,6 +686,28 @@ def __init__( self, **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 = kwargs.get('attributes', None) self.kty = kwargs.get('kty', None) @@ -621,12 +725,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. @@ -638,8 +742,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 = { @@ -662,6 +766,16 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.not_before = kwargs.get('not_before', None) @@ -677,10 +791,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 = { @@ -696,6 +810,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs['properties'] @@ -704,10 +824,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 = { @@ -719,6 +839,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -729,28 +855,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 = { @@ -774,6 +901,28 @@ def __init__( self, **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 = kwargs.get('attributes', None) self.kty = kwargs.get('kty', None) @@ -789,10 +938,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 = { @@ -804,6 +953,12 @@ def __init__( self, **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 = kwargs.get('content_type', "application/json; charset=utf-8") self.data = kwargs.get('data', None) @@ -818,9 +973,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 = { @@ -838,6 +993,11 @@ def __init__( self, **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 @@ -847,10 +1007,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 = { @@ -862,6 +1022,12 @@ def __init__( self, **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 = kwargs.get('trigger', None) self.action = kwargs.get('action', None) @@ -870,12 +1036,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 = { @@ -888,6 +1054,14 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -905,12 +1079,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 @@ -937,6 +1111,14 @@ def __init__( self, **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 @@ -958,17 +1140,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 = { @@ -993,6 +1175,16 @@ def __init__( self, **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__(**kwargs) self.properties = kwargs.get('properties', None) @@ -1018,6 +1210,8 @@ def __init__( self, **kwargs ): + """ + """ super(ManagedHsmError, self).__init__(**kwargs) self.error = None @@ -1025,10 +1219,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 = { @@ -1040,6 +1234,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1050,30 +1250,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", @@ -1081,16 +1281,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 @@ -1124,6 +1324,38 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.initial_admin_object_ids = kwargs.get('initial_admin_object_ids', None) @@ -1145,11 +1377,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 = { @@ -1166,6 +1398,13 @@ def __init__( self, **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 = kwargs.get('family', "B") self.name = kwargs['name'] @@ -1174,29 +1413,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 = { @@ -1217,6 +1456,32 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1236,9 +1501,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 = { @@ -1253,6 +1518,11 @@ def __init__( self, **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 = kwargs['value'] @@ -1260,18 +1530,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] """ @@ -1286,6 +1558,23 @@ def __init__( self, **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 = kwargs.get('bypass', None) self.default_action = kwargs.get('default_action', None) @@ -1314,6 +1603,8 @@ def __init__( self, **kwargs ): + """ + """ super(MHSMPrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1329,25 +1620,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 """ @@ -1376,6 +1667,26 @@ def __init__( self, **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__(**kwargs) self.etag = kwargs.get('etag', None) self.private_endpoint = kwargs.get('private_endpoint', None) @@ -1386,14 +1697,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 """ @@ -1407,6 +1718,18 @@ def __init__( self, **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 = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) @@ -1416,11 +1739,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 = { @@ -1432,6 +1755,13 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1448,12 +1778,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 @@ -1461,8 +1791,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 = { @@ -1491,6 +1821,16 @@ def __init__( self, **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__(**kwargs) self.group_id = None self.required_members = None @@ -1500,8 +1840,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 = { @@ -1512,6 +1852,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1519,15 +1863,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 = { @@ -1540,6 +1885,18 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -1551,9 +1908,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 = { @@ -1568,6 +1925,11 @@ def __init__( self, **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 = kwargs['id'] @@ -1575,18 +1937,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] """ @@ -1601,6 +1965,23 @@ def __init__( self, **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 = kwargs.get('bypass', None) self.default_action = kwargs.get('default_action', None) @@ -1611,16 +1992,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 """ @@ -1636,6 +2017,19 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1647,14 +2041,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 = { @@ -1668,6 +2062,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1678,10 +2082,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 = { @@ -1693,6 +2097,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1701,15 +2111,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 = { @@ -1723,6 +2135,19 @@ def __init__( self, **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 = kwargs.get('keys', None) self.secrets = kwargs.get('secrets', None) @@ -1751,6 +2176,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1770,16 +2197,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 """ @@ -1807,6 +2234,19 @@ def __init__( self, **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 = kwargs.get('etag', None) self.private_endpoint = kwargs.get('private_endpoint', None) @@ -1817,18 +2257,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 """ @@ -1844,6 +2284,21 @@ def __init__( self, **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 = kwargs.get('id', None) self.etag = kwargs.get('etag', None) @@ -1855,10 +2310,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 = { @@ -1870,6 +2325,13 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -1894,8 +2356,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 = { @@ -1923,6 +2385,10 @@ def __init__( self, **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 @@ -1932,8 +2398,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 = { @@ -1944,6 +2410,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1951,15 +2421,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 = { @@ -1972,6 +2443,18 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -1981,10 +2464,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 = { @@ -1996,6 +2479,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -2004,10 +2493,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 = { @@ -2019,6 +2509,14 @@ def __init__( self, **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 = kwargs.get('attributes', None) self.lifetime_actions = kwargs.get('lifetime_actions', None) @@ -2041,8 +2539,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 = { @@ -2067,6 +2565,10 @@ def __init__( self, **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 = kwargs['properties'] @@ -2076,12 +2578,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. @@ -2105,6 +2607,14 @@ def __init__( self, **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__(**kwargs) @@ -2113,10 +2623,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 = { @@ -2132,6 +2642,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs['properties'] @@ -2140,10 +2656,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 = { @@ -2155,6 +2671,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -2163,10 +2685,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 = { @@ -2178,6 +2700,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) @@ -2186,12 +2714,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 = { @@ -2204,6 +2732,14 @@ def __init__( self, **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 = kwargs.get('value', None) self.content_type = kwargs.get('content_type', None) @@ -2215,14 +2751,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. @@ -2246,6 +2782,16 @@ def __init__( self, **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 = kwargs.get('value', None) self.content_type = kwargs.get('content_type', None) @@ -2257,11 +2803,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] """ @@ -2274,6 +2820,14 @@ def __init__( self, **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 = kwargs.get('log_specifications', None) self.metric_specifications = kwargs.get('metric_specifications', None) @@ -2284,11 +2838,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 = { @@ -2305,6 +2859,13 @@ def __init__( self, **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 = kwargs.get('family', "A") self.name = kwargs['name'] @@ -2313,21 +2874,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 = { @@ -2343,6 +2904,23 @@ def __init__( self, **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 = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -2355,12 +2933,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 = { @@ -2372,6 +2950,14 @@ def __init__( self, **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 = kwargs.get('time_after_create', None) self.time_before_expiry = kwargs.get('time_before_expiry', None) @@ -2390,14 +2976,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 = { @@ -2422,6 +3008,14 @@ def __init__( self, **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 @@ -2447,8 +3041,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 = { @@ -2471,6 +3066,11 @@ def __init__( self, **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 @@ -2484,9 +3084,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 = { @@ -2501,6 +3102,12 @@ def __init__( self, **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 = kwargs['access_policies'] @@ -2512,8 +3119,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 @@ -2535,6 +3142,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -2544,12 +3155,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 = { @@ -2567,6 +3178,15 @@ def __init__( self, **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 = kwargs['location'] self.tags = kwargs.get('tags', None) @@ -2576,10 +3196,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 = { @@ -2591,6 +3211,12 @@ def __init__( self, **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 = kwargs.get('value', None) self.next_link = kwargs.get('next_link', None) @@ -2599,10 +3225,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 = { @@ -2614,6 +3240,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.properties = kwargs.get('properties', None) @@ -2622,52 +3254,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 = { @@ -2690,6 +3323,56 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.sku = kwargs.get('sku', None) @@ -2713,68 +3396,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 = { @@ -2808,6 +3492,66 @@ def __init__( self, **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 = kwargs['tenant_id'] self.sku = kwargs['sku'] @@ -2833,12 +3577,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 = { @@ -2854,6 +3598,14 @@ def __init__( self, **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 = 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..4ee8d46b1e65 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,24 +5,226 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_if_not_exist_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + key_version, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + key_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class KeysOperations(object): """KeysOperations operations. @@ -45,6 +247,7 @@ 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 @@ -77,33 +280,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -117,8 +310,11 @@ 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 @@ -146,28 +342,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,8 +367,11 @@ 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 @@ -199,7 +388,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 +397,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,11 +441,13 @@ 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 @@ -289,29 +478,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,8 +504,11 @@ 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 @@ -346,7 +528,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 +537,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 +583,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..7c569c968f2c 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,26 +5,364 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_or_update_request_initial( + resource_group_name, # type: str + name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name, # type: str + name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name, # type: str + name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ManagedHsmsOperations(object): """ManagedHsmsOperations operations. @@ -60,39 +398,28 @@ 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 = 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,8 +431,11 @@ 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 @@ -124,15 +454,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 +478,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,6 +504,7 @@ 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( @@ -191,39 +520,28 @@ 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 = 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,8 +553,11 @@ 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 @@ -255,15 +576,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 +600,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,6 +626,7 @@ 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( @@ -321,40 +641,31 @@ 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 = 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 @@ -370,15 +681,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 +705,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,8 +724,10 @@ 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 @@ -443,33 +751,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,8 +778,11 @@ 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 @@ -497,8 +798,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 +809,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,17 +848,19 @@ 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] @@ -572,8 +873,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.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 +884,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,17 +921,19 @@ 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 @@ -643,8 +943,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.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 +954,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,17 +989,19 @@ 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 @@ -726,33 +1025,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,8 +1050,10 @@ 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 @@ -775,40 +1066,31 @@ 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 = 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 @@ -824,15 +1106,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 +1130,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 +1149,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..fd705f374bd2 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,26 +5,188 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_resource_request( + subscription_id, # type: str + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class MHSMPrivateEndpointConnectionsOperations(object): """MHSMPrivateEndpointConnectionsOperations operations. @@ -47,6 +209,7 @@ 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 @@ -62,8 +225,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 +236,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,17 +275,19 @@ 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 @@ -151,34 +315,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,8 +341,11 @@ 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 @@ -219,33 +376,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,14 +403,17 @@ 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 @@ -277,28 +427,18 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,21 +446,25 @@ 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 @@ -340,15 +484,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 +511,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 +533,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..2e1fe4876195 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,23 +5,67 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_mhsm_resource_request( + subscription_id, # type: str + resource_group_name, # type: str + name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class MHSMPrivateLinkResourcesOperations(object): """MHSMPrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -67,27 +112,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +136,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..03e65c9e71a9 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,24 +5,58 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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..3ecf1f357b7f 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,26 +5,188 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,6 +209,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -74,28 +237,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,8 +264,11 @@ 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 @@ -143,33 +299,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,14 +326,17 @@ 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 @@ -201,28 +350,18 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -230,21 +369,25 @@ 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 @@ -264,15 +407,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 +434,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,8 +456,10 @@ 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 @@ -334,8 +475,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 +486,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 +530,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..637e8439e69b 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,23 +5,67 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_vault_request( + subscription_id, # type: str + resource_group_name, # type: str + vault_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -67,27 +112,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,4 +136,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..59cb1f833fe7 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,24 +5,194 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_or_update_request( + resource_group_name, # type: str + vault_name, # type: str + secret_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + vault_name, # type: str + secret_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + vault_name, # type: str + secret_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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 + ) + +# fmt: on class SecretsOperations(object): """SecretsOperations operations. @@ -45,6 +215,7 @@ 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 @@ -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,8 +282,11 @@ 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 @@ -153,33 +318,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,8 +352,11 @@ 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 @@ -226,28 +384,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,8 +409,11 @@ 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 @@ -283,7 +434,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 +443,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 +489,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..15a1e6b15a53 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,26 +5,480 @@ # 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 TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 +from .._vendor import _convert_request, _format_url_section 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_or_update_request_initial( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + vault_name, # type: str + operation_kind, # type: Union[str, "_models.AccessPolicyUpdateKind"] + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + top = kwargs.pop('top', None) # type: Optional[int] + + 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, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class VaultsOperations(object): """VaultsOperations operations. @@ -60,32 +514,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -103,8 +547,11 @@ 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 @@ -123,15 +570,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 +593,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,8 +619,10 @@ 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 @@ -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] - # 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 @@ -246,8 +682,11 @@ 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 @@ -271,27 +710,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,6 +733,8 @@ 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 @@ -327,27 +758,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,8 +782,11 @@ 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 @@ -379,7 +803,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 +817,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] - # 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 @@ -436,8 +851,11 @@ 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 @@ -454,7 +872,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 +881,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,11 +925,13 @@ 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] @@ -527,7 +944,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.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 +953,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,11 +995,13 @@ 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 @@ -595,8 +1010,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.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 +1021,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,11 +1061,13 @@ 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 @@ -677,27 +1091,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,8 +1115,10 @@ 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 @@ -725,27 +1131,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -758,6 +1154,8 @@ 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 @@ -773,15 +1171,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 +1195,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,8 +1214,10 @@ 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] @@ -835,7 +1230,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.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 +1239,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,11 +1281,13 @@ 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" @@ -906,7 +1297,8 @@ 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 @@ -917,30 +1309,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 +1336,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 +