From 51ff6bae3b25f68cd73b896506b38151962962df Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 5 Jan 2022 10:03:36 +0000 Subject: [PATCH] CodeGen from PR 16847 in Azure/azure-rest-api-specs Add Track2 release go tag (#16847) * Add Track2 release go tag * recover --- .../azure-mgmt-attestation/_meta.json | 11 + .../azure/mgmt/attestation/__init__.py | 9 +- .../_attestation_management_client.py | 79 ++- .../azure/mgmt/attestation/_configuration.py | 21 +- .../azure/mgmt/attestation/_metadata.json | 104 +++ .../azure/mgmt/attestation/_patch.py | 31 + .../azure/mgmt/attestation/_vendor.py | 27 + .../azure/mgmt/attestation/_version.py | 2 +- .../azure/mgmt/attestation/aio/__init__.py | 5 + .../aio/_attestation_management_client.py | 68 +- .../mgmt/attestation/aio/_configuration.py | 8 +- .../azure/mgmt/attestation/aio/_patch.py | 31 + .../attestation/aio/operations/__init__.py | 2 + .../_attestation_providers_operations.py | 283 ++++---- .../attestation/aio/operations/_operations.py | 32 +- ...private_endpoint_connections_operations.py | 295 ++++++++ .../azure/mgmt/attestation/models/__init__.py | 58 +- .../_attestation_management_client_enums.py | 47 +- .../azure/mgmt/attestation/models/_models.py | 482 -------------- .../mgmt/attestation/models/_models_py3.py | 579 +++++++++++++--- .../mgmt/attestation/operations/__init__.py | 2 + .../_attestation_providers_operations.py | 630 ++++++++++++------ .../attestation/operations/_operations.py | 72 +- ...private_endpoint_connections_operations.py | 452 +++++++++++++ 24 files changed, 2225 insertions(+), 1105 deletions(-) create mode 100644 sdk/attestation/azure-mgmt-attestation/_meta.json create mode 100644 sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_metadata.json create mode 100644 sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_patch.py create mode 100644 sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_vendor.py create mode 100644 sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/_patch.py create mode 100644 sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_models.py create mode 100644 sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_private_endpoint_connections_operations.py diff --git a/sdk/attestation/azure-mgmt-attestation/_meta.json b/sdk/attestation/azure-mgmt-attestation/_meta.json new file mode 100644 index 0000000000000..d6649bec2551d --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "6acc7e2e59b3777da22e417149d0c71d05054bff", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/attestation/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "specification/attestation/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/__init__.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/__init__.py index 677a8fa676727..2a2a5e8f71abf 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/__init__.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['AttestationManagementClient'] -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/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_attestation_management_client.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_attestation_management_client.py index 4a95dd2d17c98..d1a4d7f76b360 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_attestation_management_client.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_attestation_management_client.py @@ -6,59 +6,84 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import AttestationManagementClientConfiguration +from .operations import AttestationProvidersOperations, Operations, PrivateEndpointConnectionsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential -from ._configuration import AttestationManagementClientConfiguration -from .operations import Operations -from .operations import AttestationProvidersOperations -from . import models - - -class AttestationManagementClient(object): - """Various APIs for managing resources in attestation service. This primarily encompasses per-tenant instance management. +class AttestationManagementClient: + """Various APIs for managing resources in attestation service. This primarily encompasses per-provider management. :ivar operations: Operations operations :vartype operations: azure.mgmt.attestation.operations.Operations :ivar attestation_providers: AttestationProvidersOperations operations - :vartype attestation_providers: azure.mgmt.attestation.operations.AttestationProvidersOperations + :vartype attestation_providers: + azure.mgmt.attestation.operations.AttestationProvidersOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.attestation.operations.PrivateEndpointConnectionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = AttestationManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = AttestationManagementClientConfiguration(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.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.attestation_providers = AttestationProvidersOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> 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.rest.HttpResponse + """ - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.attestation_providers = AttestationProvidersOperations( - self._client, self._config, self._serialize, self._deserialize) + 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/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_configuration.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_configuration.py index ff25016c47f9b..c43c969a2ccb7 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_configuration.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,20 +33,19 @@ class AttestationManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(AttestationManagementClientConfiguration, 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(AttestationManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-09-01-preview" + self.api_version = "2020-10-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-attestation/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_metadata.json b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_metadata.json new file mode 100644 index 0000000000000..d71064f39c8fe --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_metadata.json @@ -0,0 +1,104 @@ +{ + "chosen_version": "2020-10-01", + "total_api_version_list": ["2020-10-01"], + "client": { + "name": "AttestationManagementClient", + "filename": "_attestation_management_client", + "description": "Various APIs for managing resources in attestation service. This primarily encompasses per-provider management.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": false, + "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\": [\"AttestationManagementClientConfiguration\"]}}, \"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\": [\"AttestationManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_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": { + "operations": "Operations", + "attestation_providers": "AttestationProvidersOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations" + } +} \ No newline at end of file diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_patch.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_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/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_vendor.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_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/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_version.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_version.py index c47f66669f1bf..eae7c95b6fbdb 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_version.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "0.1.0" diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/__init__.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/__init__.py index b76b31d5b48bc..f24a2013d852c 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/__init__.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/__init__.py @@ -8,3 +8,8 @@ from ._attestation_management_client import AttestationManagementClient __all__ = ['AttestationManagementClient'] + +# `._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/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/_attestation_management_client.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/_attestation_management_client.py index 382f63c038653..b3c231f1124e6 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/_attestation_management_client.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/_attestation_management_client.py @@ -6,56 +6,84 @@ # 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.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import AttestationManagementClientConfiguration +from .operations import AttestationProvidersOperations, Operations, PrivateEndpointConnectionsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import AttestationManagementClientConfiguration -from .operations import Operations -from .operations import AttestationProvidersOperations -from .. import models - - -class AttestationManagementClient(object): - """Various APIs for managing resources in attestation service. This primarily encompasses per-tenant instance management. +class AttestationManagementClient: + """Various APIs for managing resources in attestation service. This primarily encompasses per-provider management. :ivar operations: Operations operations :vartype operations: azure.mgmt.attestation.aio.operations.Operations :ivar attestation_providers: AttestationProvidersOperations operations - :vartype attestation_providers: azure.mgmt.attestation.aio.operations.AttestationProvidersOperations + :vartype attestation_providers: + azure.mgmt.attestation.aio.operations.AttestationProvidersOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.attestation.aio.operations.PrivateEndpointConnectionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str """ 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 = AttestationManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = AttestationManagementClientConfiguration(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.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.attestation_providers = AttestationProvidersOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> 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.rest.AsyncHttpResponse + """ - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.attestation_providers = AttestationProvidersOperations( - self._client, self._config, self._serialize, self._deserialize) + 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/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/_configuration.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/_configuration.py index 2b7705caf6275..9a596d127d060 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/_configuration.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/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,15 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(AttestationManagementClientConfiguration, 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(AttestationManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2018-09-01-preview" + self.api_version = "2020-10-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-attestation/{}'.format(VERSION)) self._configure(**kwargs) @@ -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/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/_patch.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/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/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/__init__.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/__init__.py index fe9ce6fc7a082..81a65fb9726b0 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/__init__.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/__init__.py @@ -8,8 +8,10 @@ from ._operations import Operations from ._attestation_providers_operations import AttestationProvidersOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations __all__ = [ 'Operations', 'AttestationProvidersOperations', + 'PrivateEndpointConnectionsOperations', ] diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_attestation_providers_operations.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_attestation_providers_operations.py index d76e7e1fc8052..2f937d7c019ea 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_attestation_providers_operations.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_attestation_providers_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, 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.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._attestation_providers_operations import build_create_request, build_delete_request, build_get_default_by_location_request, build_get_request, build_list_by_resource_group_request, build_list_default_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,17 +44,18 @@ 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, provider_name: str, - **kwargs + **kwargs: Any ) -> "_models.AttestationProvider": """Get the status of Attestation Provider. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param provider_name: Name of the attestation service instance. + :param provider_name: Name of the attestation provider. :type provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AttestationProvider, or the result of cls(response) @@ -62,27 +67,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'providerName': self._serialize.url("provider_name", provider_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, + provider_name=provider_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 @@ -96,20 +91,23 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, provider_name: str, creation_params: "_models.AttestationServiceCreationParams", - **kwargs + **kwargs: Any ) -> "_models.AttestationProvider": - """Creates or updates the Attestation Provider. + """Creates a new Attestation Provider. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param provider_name: Name of the attestation service instance. + :param provider_name: Name of the attestation provider. :type provider_name: str :param creation_params: Client supplied parameters. :type creation_params: ~azure.mgmt.attestation.models.AttestationServiceCreationParams @@ -123,32 +121,22 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'providerName': self._serialize.url("provider_name", provider_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(creation_params, 'AttestationServiceCreationParams') - # 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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_name=provider_name, + content_type=content_type, + json=_json, + template_url=self.create.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(creation_params, 'AttestationServiceCreationParams') - 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 @@ -166,20 +154,23 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, provider_name: str, update_params: "_models.AttestationServicePatchParams", - **kwargs + **kwargs: Any ) -> "_models.AttestationProvider": """Updates the Attestation Provider. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param provider_name: Name of the attestation service instance. + :param provider_name: Name of the attestation provider. :type provider_name: str :param update_params: Client supplied parameters. :type update_params: ~azure.mgmt.attestation.models.AttestationServicePatchParams @@ -193,32 +184,22 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'providerName': self._serialize.url("provider_name", provider_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(update_params, 'AttestationServicePatchParams') - # 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_name=provider_name, + 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(update_params, 'AttestationServicePatchParams') - 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 @@ -232,13 +213,16 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, provider_name: str, - **kwargs + **kwargs: Any ) -> None: """Delete Attestation Service. @@ -256,27 +240,17 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'providerName': self._serialize.url("provider_name", provider_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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_name=provider_name, + 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 @@ -289,9 +263,11 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} # type: ignore + + @distributed_trace_async async def list( self, - **kwargs + **kwargs: Any ) -> "_models.AttestationProviderListResult": """Returns a list of attestation providers in a subscription. @@ -305,25 +281,15 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - accept = "application/json" - - # 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', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.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_request( + subscription_id=self._config.subscription_id, + 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) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -337,12 +303,15 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders'} # type: ignore + + @distributed_trace_async async def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> "_models.AttestationProviderListResult": """Returns attestation providers list in a resource group. @@ -358,26 +327,16 @@ async def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - accept = "application/json" - - # 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -391,11 +350,14 @@ async def list_by_resource_group( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders'} # type: ignore + + @distributed_trace_async async def list_default( self, - **kwargs + **kwargs: Any ) -> "_models.AttestationProviderListResult": """Get the default provider. @@ -409,25 +371,15 @@ async def list_default( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - accept = "application/json" - # Construct URL - url = self.list_default.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) + + request = build_list_default_request( + subscription_id=self._config.subscription_id, + template_url=self.list_default.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -441,12 +393,15 @@ async def list_default( return cls(pipeline_response, deserialized, {}) return deserialized + list_default.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders'} # type: ignore + + @distributed_trace_async async def get_default_by_location( self, location: str, - **kwargs + **kwargs: Any ) -> "_models.AttestationProvider": """Get the default provider by location. @@ -462,26 +417,16 @@ async def get_default_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_default_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str', min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.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_default_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_default_by_location.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 @@ -495,4 +440,6 @@ async def get_default_by_location( return cls(pipeline_response, deserialized, {}) return deserialized + get_default_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider'} # type: ignore + diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_operations.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_operations.py index 1d5bf1265c89b..4e5c744b6f778 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_operations.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_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._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,9 +44,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def list( self, - **kwargs + **kwargs: Any ) -> "_models.OperationList": """Lists all of the available Azure attestation operations. @@ -56,21 +61,14 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - accept = "application/json" - - # 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') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, '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) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -84,4 +82,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/providers/Microsoft.Attestation/operations'} # type: ignore + diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_private_endpoint_connections_operations.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 0000000000000..a1589c1b67e74 --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,295 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import 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 +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._private_endpoint_connections_operations import build_create_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.attestation.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + provider_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + """List all the private endpoint connections associated with the attestation provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param provider_name: The name of the attestation provider. + :type provider_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.attestation.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + provider_name=provider_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + provider_name=provider_name, + 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("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + provider_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Gets the specified private endpoint connection associated with the attestation provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param provider_name: The name of the attestation provider. + :type provider_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.attestation.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + provider_name=provider_name, + subscription_id=self._config.subscription_id, + 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) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + provider_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Update the state of specified private endpoint connection associated with the attestation + provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param provider_name: The name of the attestation provider. + :type provider_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. + :type properties: ~azure.mgmt.attestation.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.attestation.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_create_request( + resource_group_name=resource_group_name, + provider_name=provider_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace_async + async def delete( + self, + resource_group_name: str, + provider_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified private endpoint connection associated with the attestation provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param provider_name: The name of the attestation provider. + :type provider_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + resource_group_name=resource_group_name, + provider_name=provider_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/__init__.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/__init__.py index 752684408fddf..0632b4e244d91 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/__init__.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/__init__.py @@ -6,37 +6,31 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AttestationProvider - from ._models_py3 import AttestationProviderListResult - from ._models_py3 import AttestationServiceCreationParams - from ._models_py3 import AttestationServiceCreationSpecificParams - from ._models_py3 import AttestationServicePatchParams - from ._models_py3 import CloudErrorBody - from ._models_py3 import JSONWebKey - from ._models_py3 import JSONWebKeySet - from ._models_py3 import OperationList - from ._models_py3 import OperationsDefinition - from ._models_py3 import OperationsDisplayDefinition - from ._models_py3 import Resource - from ._models_py3 import TrackedResource -except (SyntaxError, ImportError): - from ._models import AttestationProvider # type: ignore - from ._models import AttestationProviderListResult # type: ignore - from ._models import AttestationServiceCreationParams # type: ignore - from ._models import AttestationServiceCreationSpecificParams # type: ignore - from ._models import AttestationServicePatchParams # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import JSONWebKey # type: ignore - from ._models import JSONWebKeySet # type: ignore - from ._models import OperationList # type: ignore - from ._models import OperationsDefinition # type: ignore - from ._models import OperationsDisplayDefinition # type: ignore - from ._models import Resource # type: ignore - from ._models import TrackedResource # type: ignore +from ._models_py3 import AttestationProvider +from ._models_py3 import AttestationProviderListResult +from ._models_py3 import AttestationServiceCreationParams +from ._models_py3 import AttestationServiceCreationSpecificParams +from ._models_py3 import AttestationServicePatchParams +from ._models_py3 import CloudErrorBody +from ._models_py3 import JSONWebKey +from ._models_py3 import JSONWebKeySet +from ._models_py3 import OperationList +from ._models_py3 import OperationsDefinition +from ._models_py3 import OperationsDisplayDefinition +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import SystemData +from ._models_py3 import TrackedResource + from ._attestation_management_client_enums import ( AttestationServiceStatus, + CreatedByType, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, ) __all__ = [ @@ -51,7 +45,15 @@ 'OperationList', 'OperationsDefinition', 'OperationsDisplayDefinition', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkServiceConnectionState', 'Resource', + 'SystemData', 'TrackedResource', 'AttestationServiceStatus', + 'CreatedByType', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', ] diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_attestation_management_client_enums.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_attestation_management_client_enums.py index 69819cfa98dc3..a4e4484138c9c 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_attestation_management_client_enums.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_attestation_management_client_enums.py @@ -6,30 +6,41 @@ # 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 AttestationServiceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AttestationServiceStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of attestation service. """ READY = "Ready" NOT_READY = "NotReady" ERROR = "Error" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The private endpoint connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_models.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_models.py deleted file mode 100644 index e76043fd1c3e8..0000000000000 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_models.py +++ /dev/null @@ -1,482 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class AttestationProvider(TrackedResource): - """Attestation service response message. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param trust_model: Trust model for the attestation service instance. - :type trust_model: str - :param status: Status of attestation service. Possible values include: "Ready", "NotReady", - "Error". - :type status: str or ~azure.mgmt.attestation.models.AttestationServiceStatus - :param attest_uri: Gets the uri of attestation service. - :type attest_uri: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'trust_model': {'key': 'properties.trustModel', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'attest_uri': {'key': 'properties.attestUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AttestationProvider, self).__init__(**kwargs) - self.trust_model = kwargs.get('trust_model', None) - self.status = kwargs.get('status', None) - self.attest_uri = kwargs.get('attest_uri', None) - - -class AttestationProviderListResult(msrest.serialization.Model): - """Attestation Providers List. - - :param value: Attestation Provider array. - :type value: list[~azure.mgmt.attestation.models.AttestationProvider] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AttestationProvider]'}, - } - - def __init__( - self, - **kwargs - ): - super(AttestationProviderListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class AttestationServiceCreationParams(msrest.serialization.Model): - """Parameters for creating an attestation service instance. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. The supported Azure location where the attestation service instance - should be created. - :type location: str - :param tags: A set of tags. The tags that will be assigned to the attestation service instance. - :type tags: dict[str, str] - :param properties: Required. Properties of the attestation service instance. - :type properties: ~azure.mgmt.attestation.models.AttestationServiceCreationSpecificParams - """ - - _validation = { - 'location': {'required': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'properties': {'key': 'properties', 'type': 'AttestationServiceCreationSpecificParams'}, - } - - def __init__( - self, - **kwargs - ): - super(AttestationServiceCreationParams, self).__init__(**kwargs) - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.properties = kwargs['properties'] - - -class AttestationServiceCreationSpecificParams(msrest.serialization.Model): - """Client supplied parameters used to create a new attestation service instance. - - :param attestation_policy: Name of attestation policy. - :type attestation_policy: str - :param policy_signing_certificates: JSON Web Key Set defining a set of X.509 Certificates that - will represent the parent certificate for the signing certificate used for policy operations. - :type policy_signing_certificates: ~azure.mgmt.attestation.models.JSONWebKeySet - """ - - _attribute_map = { - 'attestation_policy': {'key': 'attestationPolicy', 'type': 'str'}, - 'policy_signing_certificates': {'key': 'policySigningCertificates', 'type': 'JSONWebKeySet'}, - } - - def __init__( - self, - **kwargs - ): - super(AttestationServiceCreationSpecificParams, self).__init__(**kwargs) - self.attestation_policy = kwargs.get('attestation_policy', None) - self.policy_signing_certificates = kwargs.get('policy_signing_certificates', None) - - -class AttestationServicePatchParams(msrest.serialization.Model): - """Parameters for patching an attestation service instance. - - :param tags: A set of tags. The tags that will be assigned to the attestation service instance. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(AttestationServicePatchParams, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from Attestation. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for displaying in a - user interface. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class JSONWebKey(msrest.serialization.Model): - """JSONWebKey. - - All required parameters must be populated in order to send to Azure. - - :param alg: Required. The "alg" (algorithm) parameter identifies the algorithm intended for - use with the key. The values used should either be registered in the - IANA "JSON Web Signature and Encryption Algorithms" registry - established by [JWA] or be a value that contains a Collision- - Resistant Name. - :type alg: str - :param crv: The "crv" (curve) parameter identifies the curve type. - :type crv: str - :param d: RSA private exponent or ECC private key. - :type d: str - :param dp: RSA Private Key Parameter. - :type dp: str - :param dq: RSA Private Key Parameter. - :type dq: str - :param e: RSA public exponent, in Base64. - :type e: str - :param k: Symmetric key. - :type k: str - :param kid: Required. The "kid" (key ID) parameter is used to match a specific key. This - is used, for instance, to choose among a set of keys within a JWK Set - during key rollover. The structure of the "kid" value is - unspecified. When "kid" values are used within a JWK Set, different - keys within the JWK Set SHOULD use distinct "kid" values. (One - example in which different keys might use the same "kid" value is if - they have different "kty" (key type) values but are considered to be - equivalent alternatives by the application using them.) The "kid" - value is a case-sensitive string. - :type kid: str - :param kty: Required. The "kty" (key type) parameter identifies the cryptographic algorithm - family used with the key, such as "RSA" or "EC". "kty" values should - either be registered in the IANA "JSON Web Key Types" registry - established by [JWA] or be a value that contains a Collision- - Resistant Name. The "kty" value is a case-sensitive string. - :type kty: str - :param n: RSA modulus, in Base64. - :type n: str - :param p: RSA secret prime. - :type p: str - :param q: RSA secret prime, with p < q. - :type q: str - :param qi: RSA Private Key Parameter. - :type qi: str - :param use: Required. Use ("public key use") identifies the intended use of - the public key. The "use" parameter is employed to indicate whether - a public key is used for encrypting data or verifying the signature - on data. Values are commonly "sig" (signature) or "enc" (encryption). - :type use: str - :param x: X coordinate for the Elliptic Curve point. - :type x: str - :param x5_c: The "x5c" (X.509 certificate chain) parameter contains a chain of one - or more PKIX certificates [RFC5280]. The certificate chain is - represented as a JSON array of certificate value strings. Each - string in the array is a base64-encoded (Section 4 of [RFC4648] -- - not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. - The PKIX certificate containing the key value MUST be the first - certificate. - :type x5_c: list[str] - :param y: Y coordinate for the Elliptic Curve point. - :type y: str - """ - - _validation = { - 'alg': {'required': True}, - 'kid': {'required': True}, - 'kty': {'required': True}, - 'use': {'required': True}, - } - - _attribute_map = { - 'alg': {'key': 'alg', 'type': 'str'}, - 'crv': {'key': 'crv', 'type': 'str'}, - 'd': {'key': 'd', 'type': 'str'}, - 'dp': {'key': 'dp', 'type': 'str'}, - 'dq': {'key': 'dq', 'type': 'str'}, - 'e': {'key': 'e', 'type': 'str'}, - 'k': {'key': 'k', 'type': 'str'}, - 'kid': {'key': 'kid', 'type': 'str'}, - 'kty': {'key': 'kty', 'type': 'str'}, - 'n': {'key': 'n', 'type': 'str'}, - 'p': {'key': 'p', 'type': 'str'}, - 'q': {'key': 'q', 'type': 'str'}, - 'qi': {'key': 'qi', 'type': 'str'}, - 'use': {'key': 'use', 'type': 'str'}, - 'x': {'key': 'x', 'type': 'str'}, - 'x5_c': {'key': 'x5c', 'type': '[str]'}, - 'y': {'key': 'y', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(JSONWebKey, self).__init__(**kwargs) - self.alg = kwargs['alg'] - self.crv = kwargs.get('crv', None) - self.d = kwargs.get('d', None) - self.dp = kwargs.get('dp', None) - self.dq = kwargs.get('dq', None) - self.e = kwargs.get('e', None) - self.k = kwargs.get('k', None) - self.kid = kwargs['kid'] - self.kty = kwargs['kty'] - self.n = kwargs.get('n', None) - self.p = kwargs.get('p', None) - self.q = kwargs.get('q', None) - self.qi = kwargs.get('qi', None) - self.use = kwargs['use'] - self.x = kwargs.get('x', None) - self.x5_c = kwargs.get('x5_c', None) - self.y = kwargs.get('y', None) - - -class JSONWebKeySet(msrest.serialization.Model): - """JSONWebKeySet. - - :param keys: The value of the "keys" parameter is an array of JWK values. By - default, the order of the JWK values within the array does not imply - an order of preference among them, although applications of JWK Sets - can choose to assign a meaning to the order for their purposes, if - desired. - :type keys: list[~azure.mgmt.attestation.models.JSONWebKey] - """ - - _attribute_map = { - 'keys': {'key': 'keys', 'type': '[JSONWebKey]'}, - } - - def __init__( - self, - **kwargs - ): - super(JSONWebKeySet, self).__init__(**kwargs) - self.keys = kwargs.get('keys', None) - - -class OperationList(msrest.serialization.Model): - """List of supported operations. - - :param value: List of supported operations. - :type value: list[~azure.mgmt.attestation.models.OperationsDefinition] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationsDefinition]'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class OperationsDefinition(msrest.serialization.Model): - """Definition object with the name and properties of an operation. - - :param name: Name of the operation. - :type name: str - :param display: Display object with properties of the operation. - :type display: ~azure.mgmt.attestation.models.OperationsDisplayDefinition - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationsDisplayDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - - -class OperationsDisplayDefinition(msrest.serialization.Model): - """Display object with properties of the operation. - - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource for the operation. - :type resource: str - :param operation: Short description of the operation. - :type operation: str - :param description: Description of the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationsDisplayDefinition, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_models_py3.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_models_py3.py index f0ef448e6cb8f..5dc9291a57a5f 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_models_py3.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_models_py3.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime from typing import Dict, List, Optional, Union import msrest.serialization @@ -44,6 +45,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -65,10 +68,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -93,6 +96,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -113,17 +122,23 @@ class AttestationProvider(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param trust_model: Trust model for the attestation service instance. - :type trust_model: str - :param status: Status of attestation service. Possible values include: "Ready", "NotReady", + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.attestation.models.SystemData + :ivar trust_model: Trust model for the attestation provider. + :vartype trust_model: str + :ivar status: Status of attestation service. Possible values include: "Ready", "NotReady", "Error". - :type status: str or ~azure.mgmt.attestation.models.AttestationServiceStatus - :param attest_uri: Gets the uri of attestation service. - :type attest_uri: str + :vartype status: str or ~azure.mgmt.attestation.models.AttestationServiceStatus + :ivar attest_uri: Gets the uri of attestation service. + :vartype attest_uri: str + :ivar private_endpoint_connections: List of private endpoint connections associated with the + attestation provider. + :vartype private_endpoint_connections: + list[~azure.mgmt.attestation.models.PrivateEndpointConnection] """ _validation = { @@ -131,6 +146,8 @@ class AttestationProvider(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { @@ -139,9 +156,11 @@ class AttestationProvider(TrackedResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'location': {'key': 'location', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'trust_model': {'key': 'properties.trustModel', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'attest_uri': {'key': 'properties.attestUri', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, } def __init__( @@ -154,20 +173,44 @@ def __init__( attest_uri: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword trust_model: Trust model for the attestation provider. + :paramtype trust_model: str + :keyword status: Status of attestation service. Possible values include: "Ready", "NotReady", + "Error". + :paramtype status: str or ~azure.mgmt.attestation.models.AttestationServiceStatus + :keyword attest_uri: Gets the uri of attestation service. + :paramtype attest_uri: str + """ super(AttestationProvider, self).__init__(tags=tags, location=location, **kwargs) + self.system_data = None self.trust_model = trust_model self.status = status self.attest_uri = attest_uri + self.private_endpoint_connections = None class AttestationProviderListResult(msrest.serialization.Model): """Attestation Providers List. - :param value: Attestation Provider array. - :type value: list[~azure.mgmt.attestation.models.AttestationProvider] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.attestation.models.SystemData + :ivar value: Attestation Provider array. + :vartype value: list[~azure.mgmt.attestation.models.AttestationProvider] """ + _validation = { + 'system_data': {'readonly': True}, + } + _attribute_map = { + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'value': {'key': 'value', 'type': '[AttestationProvider]'}, } @@ -177,22 +220,27 @@ def __init__( value: Optional[List["AttestationProvider"]] = None, **kwargs ): + """ + :keyword value: Attestation Provider array. + :paramtype value: list[~azure.mgmt.attestation.models.AttestationProvider] + """ super(AttestationProviderListResult, self).__init__(**kwargs) + self.system_data = None self.value = value class AttestationServiceCreationParams(msrest.serialization.Model): - """Parameters for creating an attestation service instance. + """Parameters for creating an attestation provider. All required parameters must be populated in order to send to Azure. - :param location: Required. The supported Azure location where the attestation service instance - should be created. - :type location: str - :param tags: A set of tags. The tags that will be assigned to the attestation service instance. - :type tags: dict[str, str] - :param properties: Required. Properties of the attestation service instance. - :type properties: ~azure.mgmt.attestation.models.AttestationServiceCreationSpecificParams + :ivar location: Required. The supported Azure location where the attestation provider should be + created. + :vartype location: str + :ivar tags: A set of tags. The tags that will be assigned to the attestation provider. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the attestation provider. + :vartype properties: ~azure.mgmt.attestation.models.AttestationServiceCreationSpecificParams """ _validation = { @@ -214,6 +262,15 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. The supported Azure location where the attestation provider should + be created. + :paramtype location: str + :keyword tags: A set of tags. The tags that will be assigned to the attestation provider. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the attestation provider. + :paramtype properties: ~azure.mgmt.attestation.models.AttestationServiceCreationSpecificParams + """ super(AttestationServiceCreationParams, self).__init__(**kwargs) self.location = location self.tags = tags @@ -221,37 +278,38 @@ def __init__( class AttestationServiceCreationSpecificParams(msrest.serialization.Model): - """Client supplied parameters used to create a new attestation service instance. + """Client supplied parameters used to create a new attestation provider. - :param attestation_policy: Name of attestation policy. - :type attestation_policy: str - :param policy_signing_certificates: JSON Web Key Set defining a set of X.509 Certificates that + :ivar policy_signing_certificates: JSON Web Key Set defining a set of X.509 Certificates that will represent the parent certificate for the signing certificate used for policy operations. - :type policy_signing_certificates: ~azure.mgmt.attestation.models.JSONWebKeySet + :vartype policy_signing_certificates: ~azure.mgmt.attestation.models.JSONWebKeySet """ _attribute_map = { - 'attestation_policy': {'key': 'attestationPolicy', 'type': 'str'}, 'policy_signing_certificates': {'key': 'policySigningCertificates', 'type': 'JSONWebKeySet'}, } def __init__( self, *, - attestation_policy: Optional[str] = None, policy_signing_certificates: Optional["JSONWebKeySet"] = None, **kwargs ): + """ + :keyword policy_signing_certificates: JSON Web Key Set defining a set of X.509 Certificates + that will represent the parent certificate for the signing certificate used for policy + operations. + :paramtype policy_signing_certificates: ~azure.mgmt.attestation.models.JSONWebKeySet + """ super(AttestationServiceCreationSpecificParams, self).__init__(**kwargs) - self.attestation_policy = attestation_policy self.policy_signing_certificates = policy_signing_certificates class AttestationServicePatchParams(msrest.serialization.Model): - """Parameters for patching an attestation service instance. + """Parameters for patching an attestation provider. - :param tags: A set of tags. The tags that will be assigned to the attestation service instance. - :type tags: dict[str, str] + :ivar tags: A set of tags. The tags that will be assigned to the attestation provider. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -264,6 +322,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the attestation provider. + :paramtype tags: dict[str, str] + """ super(AttestationServicePatchParams, self).__init__(**kwargs) self.tags = tags @@ -271,12 +333,12 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from Attestation. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for displaying in a - user interface. - :type message: str + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for displaying in a user + interface. + :vartype message: str """ _attribute_map = { @@ -291,6 +353,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for displaying in a + user interface. + :paramtype message: str + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -301,25 +371,25 @@ class JSONWebKey(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param alg: Required. The "alg" (algorithm) parameter identifies the algorithm intended for + :ivar alg: The "alg" (algorithm) parameter identifies the algorithm intended for use with the key. The values used should either be registered in the IANA "JSON Web Signature and Encryption Algorithms" registry established by [JWA] or be a value that contains a Collision- Resistant Name. - :type alg: str - :param crv: The "crv" (curve) parameter identifies the curve type. - :type crv: str - :param d: RSA private exponent or ECC private key. - :type d: str - :param dp: RSA Private Key Parameter. - :type dp: str - :param dq: RSA Private Key Parameter. - :type dq: str - :param e: RSA public exponent, in Base64. - :type e: str - :param k: Symmetric key. - :type k: str - :param kid: Required. The "kid" (key ID) parameter is used to match a specific key. This + :vartype alg: str + :ivar crv: The "crv" (curve) parameter identifies the curve type. + :vartype crv: str + :ivar d: RSA private exponent or ECC private key. + :vartype d: str + :ivar dp: RSA Private Key Parameter. + :vartype dp: str + :ivar dq: RSA Private Key Parameter. + :vartype dq: str + :ivar e: RSA public exponent, in Base64. + :vartype e: str + :ivar k: Symmetric key. + :vartype k: str + :ivar kid: The "kid" (key ID) parameter is used to match a specific key. This is used, for instance, to choose among a set of keys within a JWK Set during key rollover. The structure of the "kid" value is unspecified. When "kid" values are used within a JWK Set, different @@ -328,45 +398,42 @@ class JSONWebKey(msrest.serialization.Model): they have different "kty" (key type) values but are considered to be equivalent alternatives by the application using them.) The "kid" value is a case-sensitive string. - :type kid: str - :param kty: Required. The "kty" (key type) parameter identifies the cryptographic algorithm + :vartype kid: str + :ivar kty: Required. The "kty" (key type) parameter identifies the cryptographic algorithm family used with the key, such as "RSA" or "EC". "kty" values should either be registered in the IANA "JSON Web Key Types" registry established by [JWA] or be a value that contains a Collision- Resistant Name. The "kty" value is a case-sensitive string. - :type kty: str - :param n: RSA modulus, in Base64. - :type n: str - :param p: RSA secret prime. - :type p: str - :param q: RSA secret prime, with p < q. - :type q: str - :param qi: RSA Private Key Parameter. - :type qi: str - :param use: Required. Use ("public key use") identifies the intended use of + :vartype kty: str + :ivar n: RSA modulus, in Base64. + :vartype n: str + :ivar p: RSA secret prime. + :vartype p: str + :ivar q: RSA secret prime, with p < q. + :vartype q: str + :ivar qi: RSA Private Key Parameter. + :vartype qi: str + :ivar use: Use ("public key use") identifies the intended use of the public key. The "use" parameter is employed to indicate whether a public key is used for encrypting data or verifying the signature on data. Values are commonly "sig" (signature) or "enc" (encryption). - :type use: str - :param x: X coordinate for the Elliptic Curve point. - :type x: str - :param x5_c: The "x5c" (X.509 certificate chain) parameter contains a chain of one + :vartype use: str + :ivar x: X coordinate for the Elliptic Curve point. + :vartype x: str + :ivar x5_c: The "x5c" (X.509 certificate chain) parameter contains a chain of one or more PKIX certificates [RFC5280]. The certificate chain is represented as a JSON array of certificate value strings. Each string in the array is a base64-encoded (Section 4 of [RFC4648] -- not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. The PKIX certificate containing the key value MUST be the first certificate. - :type x5_c: list[str] - :param y: Y coordinate for the Elliptic Curve point. - :type y: str + :vartype x5_c: list[str] + :ivar y: Y coordinate for the Elliptic Curve point. + :vartype y: str """ _validation = { - 'alg': {'required': True}, - 'kid': {'required': True}, 'kty': {'required': True}, - 'use': {'required': True}, } _attribute_map = { @@ -392,25 +459,86 @@ class JSONWebKey(msrest.serialization.Model): def __init__( self, *, - alg: str, - kid: str, kty: str, - use: str, + alg: Optional[str] = None, crv: Optional[str] = None, d: Optional[str] = None, dp: Optional[str] = None, dq: Optional[str] = None, e: Optional[str] = None, k: Optional[str] = None, + kid: Optional[str] = None, n: Optional[str] = None, p: Optional[str] = None, q: Optional[str] = None, qi: Optional[str] = None, + use: Optional[str] = None, x: Optional[str] = None, x5_c: Optional[List[str]] = None, y: Optional[str] = None, **kwargs ): + """ + :keyword alg: The "alg" (algorithm) parameter identifies the algorithm intended for + use with the key. The values used should either be registered in the + IANA "JSON Web Signature and Encryption Algorithms" registry + established by [JWA] or be a value that contains a Collision- + Resistant Name. + :paramtype alg: str + :keyword crv: The "crv" (curve) parameter identifies the curve type. + :paramtype crv: str + :keyword d: RSA private exponent or ECC private key. + :paramtype d: str + :keyword dp: RSA Private Key Parameter. + :paramtype dp: str + :keyword dq: RSA Private Key Parameter. + :paramtype dq: str + :keyword e: RSA public exponent, in Base64. + :paramtype e: str + :keyword k: Symmetric key. + :paramtype k: str + :keyword kid: The "kid" (key ID) parameter is used to match a specific key. This + is used, for instance, to choose among a set of keys within a JWK Set + during key rollover. The structure of the "kid" value is + unspecified. When "kid" values are used within a JWK Set, different + keys within the JWK Set SHOULD use distinct "kid" values. (One + example in which different keys might use the same "kid" value is if + they have different "kty" (key type) values but are considered to be + equivalent alternatives by the application using them.) The "kid" + value is a case-sensitive string. + :paramtype kid: str + :keyword kty: Required. The "kty" (key type) parameter identifies the cryptographic algorithm + family used with the key, such as "RSA" or "EC". "kty" values should + either be registered in the IANA "JSON Web Key Types" registry + established by [JWA] or be a value that contains a Collision- + Resistant Name. The "kty" value is a case-sensitive string. + :paramtype kty: str + :keyword n: RSA modulus, in Base64. + :paramtype n: str + :keyword p: RSA secret prime. + :paramtype p: str + :keyword q: RSA secret prime, with p < q. + :paramtype q: str + :keyword qi: RSA Private Key Parameter. + :paramtype qi: str + :keyword use: Use ("public key use") identifies the intended use of + the public key. The "use" parameter is employed to indicate whether + a public key is used for encrypting data or verifying the signature + on data. Values are commonly "sig" (signature) or "enc" (encryption). + :paramtype use: str + :keyword x: X coordinate for the Elliptic Curve point. + :paramtype x: str + :keyword x5_c: The "x5c" (X.509 certificate chain) parameter contains a chain of one + or more PKIX certificates [RFC5280]. The certificate chain is + represented as a JSON array of certificate value strings. Each + string in the array is a base64-encoded (Section 4 of [RFC4648] -- + not base64url-encoded) DER [ITU.X690.1994] PKIX certificate value. + The PKIX certificate containing the key value MUST be the first + certificate. + :paramtype x5_c: list[str] + :keyword y: Y coordinate for the Elliptic Curve point. + :paramtype y: str + """ super(JSONWebKey, self).__init__(**kwargs) self.alg = alg self.crv = crv @@ -434,12 +562,12 @@ def __init__( class JSONWebKeySet(msrest.serialization.Model): """JSONWebKeySet. - :param keys: The value of the "keys" parameter is an array of JWK values. By + :ivar keys: The value of the "keys" parameter is an array of JWK values. By default, the order of the JWK values within the array does not imply an order of preference among them, although applications of JWK Sets can choose to assign a meaning to the order for their purposes, if desired. - :type keys: list[~azure.mgmt.attestation.models.JSONWebKey] + :vartype keys: list[~azure.mgmt.attestation.models.JSONWebKey] """ _attribute_map = { @@ -452,6 +580,14 @@ def __init__( keys: Optional[List["JSONWebKey"]] = None, **kwargs ): + """ + :keyword keys: The value of the "keys" parameter is an array of JWK values. By + default, the order of the JWK values within the array does not imply + an order of preference among them, although applications of JWK Sets + can choose to assign a meaning to the order for their purposes, if + desired. + :paramtype keys: list[~azure.mgmt.attestation.models.JSONWebKey] + """ super(JSONWebKeySet, self).__init__(**kwargs) self.keys = keys @@ -459,11 +595,20 @@ def __init__( class OperationList(msrest.serialization.Model): """List of supported operations. - :param value: List of supported operations. - :type value: list[~azure.mgmt.attestation.models.OperationsDefinition] + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.attestation.models.SystemData + :ivar value: List of supported operations. + :vartype value: list[~azure.mgmt.attestation.models.OperationsDefinition] """ + _validation = { + 'system_data': {'readonly': True}, + } + _attribute_map = { + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'value': {'key': 'value', 'type': '[OperationsDefinition]'}, } @@ -473,17 +618,22 @@ def __init__( value: Optional[List["OperationsDefinition"]] = None, **kwargs ): + """ + :keyword value: List of supported operations. + :paramtype value: list[~azure.mgmt.attestation.models.OperationsDefinition] + """ super(OperationList, self).__init__(**kwargs) + self.system_data = None self.value = value class OperationsDefinition(msrest.serialization.Model): """Definition object with the name and properties of an operation. - :param name: Name of the operation. - :type name: str - :param display: Display object with properties of the operation. - :type display: ~azure.mgmt.attestation.models.OperationsDisplayDefinition + :ivar name: Name of the operation. + :vartype name: str + :ivar display: Display object with properties of the operation. + :vartype display: ~azure.mgmt.attestation.models.OperationsDisplayDefinition """ _attribute_map = { @@ -498,6 +648,12 @@ def __init__( display: Optional["OperationsDisplayDefinition"] = None, **kwargs ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword display: Display object with properties of the operation. + :paramtype display: ~azure.mgmt.attestation.models.OperationsDisplayDefinition + """ super(OperationsDefinition, self).__init__(**kwargs) self.name = name self.display = display @@ -506,14 +662,14 @@ def __init__( class OperationsDisplayDefinition(msrest.serialization.Model): """Display object with properties of the operation. - :param provider: Resource provider of the operation. - :type provider: str - :param resource: Resource for the operation. - :type resource: str - :param operation: Short description of the operation. - :type operation: str - :param description: Description of the operation. - :type description: str + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource for the operation. + :vartype resource: str + :ivar operation: Short description of the operation. + :vartype operation: str + :ivar description: Description of the operation. + :vartype description: str """ _attribute_map = { @@ -532,8 +688,239 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource for the operation. + :paramtype resource: str + :keyword operation: Short description of the operation. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ super(OperationsDisplayDefinition, self).__init__(**kwargs) self.provider = provider self.resource = resource self.operation = operation self.description = description + + +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.attestation.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.attestation.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.attestation.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + **kwargs + ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.attestation.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.attestation.models.PrivateLinkServiceConnectionState + """ + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connection associated with the specified storage account. + + :ivar value: Array of private endpoint connections. + :vartype value: list[~azure.mgmt.attestation.models.PrivateEndpointConnection] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~azure.mgmt.attestation.models.PrivateEndpointConnection] + """ + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :vartype status: str or ~azure.mgmt.attestation.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs + ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or ~azure.mgmt.attestation.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :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 + self.actions_required = actions_required + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.attestation.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.attestation.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.attestation.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.attestation.models.CreatedByType + :keyword last_modified_at: The timestamp of 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 + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/__init__.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/__init__.py index fe9ce6fc7a082..81a65fb9726b0 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/__init__.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/__init__.py @@ -8,8 +8,10 @@ from ._operations import Operations from ._attestation_providers_operations import AttestationProvidersOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations __all__ = [ 'Operations', 'AttestationProvidersOperations', + 'PrivateEndpointConnectionsOperations', ] diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_attestation_providers_operations.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_attestation_providers_operations.py index 9e2d5da51d0bd..9fe5387803bad 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_attestation_providers_operations.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_attestation_providers_operations.py @@ -5,22 +5,311 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + provider_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "providerName": _SERIALIZER.url("provider_name", provider_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_create_request( + subscription_id: str, + resource_group_name: str, + provider_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "providerName": _SERIALIZER.url("provider_name", provider_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + provider_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "providerName": _SERIALIZER.url("provider_name", provider_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="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + provider_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "providerName": _SERIALIZER.url("provider_name", provider_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_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + 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_default_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + 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_default_by_location_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str', min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AttestationProvidersOperations(object): """AttestationProvidersOperations operations. @@ -44,18 +333,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - provider_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AttestationProvider" + resource_group_name: str, + provider_name: str, + **kwargs: Any + ) -> "_models.AttestationProvider": """Get the status of Attestation Provider. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param provider_name: Name of the attestation service instance. + :param provider_name: Name of the attestation provider. :type provider_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AttestationProvider, or the result of cls(response) @@ -67,27 +356,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'providerName': self._serialize.url("provider_name", provider_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_name=provider_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -101,21 +380,23 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - provider_name, # type: str - creation_params, # type: "_models.AttestationServiceCreationParams" - **kwargs # type: Any - ): - # type: (...) -> "_models.AttestationProvider" - """Creates or updates the Attestation Provider. + resource_group_name: str, + provider_name: str, + creation_params: "_models.AttestationServiceCreationParams", + **kwargs: Any + ) -> "_models.AttestationProvider": + """Creates a new Attestation Provider. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param provider_name: Name of the attestation service instance. + :param provider_name: Name of the attestation provider. :type provider_name: str :param creation_params: Client supplied parameters. :type creation_params: ~azure.mgmt.attestation.models.AttestationServiceCreationParams @@ -129,32 +410,22 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'providerName': self._serialize.url("provider_name", provider_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(creation_params, 'AttestationServiceCreationParams') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_name=provider_name, + content_type=content_type, + json=_json, + template_url=self.create.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(creation_params, 'AttestationServiceCreationParams') - 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 @@ -172,21 +443,23 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - provider_name, # type: str - update_params, # type: "_models.AttestationServicePatchParams" - **kwargs # type: Any - ): - # type: (...) -> "_models.AttestationProvider" + resource_group_name: str, + provider_name: str, + update_params: "_models.AttestationServicePatchParams", + **kwargs: Any + ) -> "_models.AttestationProvider": """Updates the Attestation Provider. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str - :param provider_name: Name of the attestation service instance. + :param provider_name: Name of the attestation provider. :type provider_name: str :param update_params: Client supplied parameters. :type update_params: ~azure.mgmt.attestation.models.AttestationServicePatchParams @@ -200,32 +473,22 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-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 = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'providerName': self._serialize.url("provider_name", provider_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(update_params, 'AttestationServicePatchParams') - # 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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_name=provider_name, + 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(update_params, 'AttestationServicePatchParams') - 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 @@ -239,15 +502,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - provider_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + provider_name: str, + **kwargs: Any + ) -> None: """Delete Attestation Service. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -264,27 +529,17 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'providerName': self._serialize.url("provider_name", provider_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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + provider_name=provider_name, + 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 @@ -297,11 +552,12 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} # type: ignore + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.AttestationProviderListResult" + **kwargs: Any + ) -> "_models.AttestationProviderListResult": """Returns a list of attestation providers in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -314,25 +570,15 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - accept = "application/json" - # 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', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -346,14 +592,16 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/attestationProviders'} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AttestationProviderListResult" + resource_group_name: str, + **kwargs: Any + ) -> "_models.AttestationProviderListResult": """Returns attestation providers list in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -368,26 +616,16 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - accept = "application/json" - - # 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', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -401,13 +639,15 @@ def list_by_resource_group( return cls(pipeline_response, deserialized, {}) return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders'} # type: ignore + + @distributed_trace def list_default( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.AttestationProviderListResult" + **kwargs: Any + ) -> "_models.AttestationProviderListResult": """Get the default provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -420,25 +660,15 @@ def list_default( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - accept = "application/json" - # Construct URL - url = self.list_default.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) + + request = build_list_default_request( + subscription_id=self._config.subscription_id, + template_url=self.list_default.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -452,14 +682,16 @@ def list_default( return cls(pipeline_response, deserialized, {}) return deserialized + list_default.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders'} # type: ignore + + @distributed_trace def get_default_by_location( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AttestationProvider" + location: str, + **kwargs: Any + ) -> "_models.AttestationProvider": """Get the default provider by location. :param location: The location of the default provider. @@ -474,26 +706,16 @@ def get_default_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - accept = "application/json" - - # Construct URL - url = self.get_default_by_location.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str', min_length=1), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.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_default_by_location_request( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.get_default_by_location.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 @@ -507,4 +729,6 @@ def get_default_by_location( return cls(pipeline_response, deserialized, {}) return deserialized + get_default_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider'} # type: ignore + diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_operations.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_operations.py index aaade27566ad3..24a562e902d0d 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_operations.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_operations.py @@ -5,22 +5,49 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Attestation/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -44,11 +71,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationList" + **kwargs: Any + ) -> "_models.OperationList": """Lists all of the available Azure attestation operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -61,21 +88,14 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" - accept = "application/json" - - # 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) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -89,4 +109,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/providers/Microsoft.Attestation/operations'} # type: ignore + diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_private_endpoint_connections_operations.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_private_endpoint_connections_operations.py new file mode 100644 index 0000000000000..e5ae7b963ff53 --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,452 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + resource_group_name: str, + provider_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "providerName": _SERIALIZER.url("provider_name", provider_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + 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( + resource_group_name: str, + provider_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "providerName": _SERIALIZER.url("provider_name", provider_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "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_create_request( + resource_group_name: str, + provider_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "providerName": _SERIALIZER.url("provider_name", provider_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + provider_name: str, + subscription_id: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "providerName": _SERIALIZER.url("provider_name", provider_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.attestation.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + provider_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: + """List all the private endpoint connections associated with the attestation provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param provider_name: The name of the attestation provider. + :type provider_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.attestation.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + provider_name=provider_name, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + provider_name=provider_name, + 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("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + provider_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Gets the specified private endpoint connection associated with the attestation provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param provider_name: The name of the attestation provider. + :type provider_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.attestation.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + provider_name=provider_name, + subscription_id=self._config.subscription_id, + 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) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace + def create( + self, + resource_group_name: str, + provider_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": + """Update the state of specified private endpoint connection associated with the attestation + provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param provider_name: The name of the attestation provider. + :type provider_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param properties: The private endpoint connection properties. + :type properties: ~azure.mgmt.attestation.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.attestation.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_create_request( + resource_group_name=resource_group_name, + provider_name=provider_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + + @distributed_trace + def delete( + self, + resource_group_name: str, + provider_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified private endpoint connection associated with the attestation provider. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param provider_name: The name of the attestation provider. + :type provider_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request( + resource_group_name=resource_group_name, + provider_name=provider_name, + subscription_id=self._config.subscription_id, + private_endpoint_connection_name=private_endpoint_connection_name, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore +