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 4a95dd2d17c9..e19988cb8aaf 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 @@ -20,16 +20,19 @@ from ._configuration import AttestationManagementClientConfiguration from .operations import Operations from .operations import AttestationProvidersOperations +from .operations import PrivateEndpointConnectionsOperations from . import models class AttestationManagementClient(object): - """Various APIs for managing resources in attestation service. This primarily encompasses per-tenant instance management. + """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 + :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. @@ -52,13 +55,14 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.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 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 ff25016c47f9..e25687fba9df 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_configuration.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_configuration.py @@ -48,7 +48,7 @@ def __init__( 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) 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 000000000000..f6d1efa19889 --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_metadata.json @@ -0,0 +1,63 @@ +{ + "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.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": true + }, + "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, # type: \"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, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null + }, + "operation_groups": { + "operations": "Operations", + "attestation_providers": "AttestationProvidersOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file 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 515f51c112dd..eae7c95b6fbd 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_version.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_version.py @@ -6,5 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b1" - +VERSION = "0.1.0" 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 382f63c03865..a7bbe52e169f 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 @@ -18,16 +18,19 @@ from ._configuration import AttestationManagementClientConfiguration from .operations import Operations from .operations import AttestationProvidersOperations +from .operations import PrivateEndpointConnectionsOperations from .. import models class AttestationManagementClient(object): - """Various APIs for managing resources in attestation service. This primarily encompasses per-tenant instance management. + """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 + :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. @@ -49,13 +52,14 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.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) 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 2b7705caf627..e597b38d22c6 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 @@ -45,7 +45,7 @@ def __init__( 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) 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 fe9ce6fc7a08..81a65fb9726b 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 d76e7e1fc805..34915fd7677a 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 @@ -50,7 +50,7 @@ async def get( :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,7 +62,7 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" accept = "application/json" # Construct URL @@ -105,11 +105,11 @@ async def create( creation_params: "_models.AttestationServiceCreationParams", **kwargs ) -> "_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,7 +123,7 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -179,7 +179,7 @@ async def update( :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,7 +193,7 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -256,7 +256,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" accept = "application/json" # Construct URL @@ -305,7 +305,7 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" accept = "application/json" # Construct URL @@ -358,7 +358,7 @@ 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" + api_version = "2020-10-01" accept = "application/json" # Construct URL @@ -409,7 +409,7 @@ async def list_default( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" accept = "application/json" # Construct URL @@ -462,7 +462,7 @@ 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" + api_version = "2020-10-01" accept = "application/json" # Construct URL 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 1d5bf1265c89..9eca6b0130fe 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 @@ -56,7 +56,7 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" accept = "application/json" # Construct URL 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 000000000000..65798916efe6 --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,311 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class 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 + + def list( + self, + resource_group_name: str, + provider_name: str, + **kwargs + ) -> 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', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + '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', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + '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 = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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/attestationProvider/{providerName}/privateEndpointConnections'} # type: ignore + + async def get( + self, + resource_group_name: str, + provider_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> "_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', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + async def create( + self, + resource_group_name: str, + provider_name: str, + private_endpoint_connection_name: str, + properties: "_models.PrivateEndpointConnection", + **kwargs + ) -> "_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', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.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\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(properties, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + 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 + + async def delete( + self, + resource_group_name: str, + provider_name: str, + private_endpoint_connection_name: str, + **kwargs + ) -> 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', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 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 752684408fdd..8020fbdab2ee 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 @@ -18,7 +18,13 @@ 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 PrivateEndpointConnectionProperties + from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import Resource + from ._models_py3 import SystemData from ._models_py3 import TrackedResource except (SyntaxError, ImportError): from ._models import AttestationProvider # type: ignore @@ -32,11 +38,20 @@ from ._models import OperationList # type: ignore from ._models import OperationsDefinition # type: ignore from ._models import OperationsDisplayDefinition # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionListResult # type: ignore + from ._models import PrivateEndpointConnectionProperties # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore from ._models import Resource # type: ignore + from ._models import SystemData # type: ignore from ._models import TrackedResource # type: ignore from ._attestation_management_client_enums import ( AttestationServiceStatus, + CreatedByType, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, ) __all__ = [ @@ -51,7 +66,16 @@ 'OperationList', 'OperationsDefinition', 'OperationsDisplayDefinition', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResult', + 'PrivateEndpointConnectionProperties', + '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 69819cfa98dc..a77fd5200a0f 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 @@ -33,3 +33,29 @@ class AttestationServiceStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu 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 index e76043fd1c3e..78bdd296fdc9 100644 --- a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_models.py +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_models.py @@ -110,13 +110,19 @@ class AttestationProvider(TrackedResource): :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. + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.attestation.models.SystemData + :param trust_model: Trust model for the attestation provider. :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 + :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 = { @@ -124,6 +130,8 @@ class AttestationProvider(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, + 'system_data': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { @@ -132,9 +140,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__( @@ -142,19 +152,30 @@ def __init__( **kwargs ): super(AttestationProvider, self).__init__(**kwargs) + self.system_data = None self.trust_model = kwargs.get('trust_model', None) self.status = kwargs.get('status', None) self.attest_uri = kwargs.get('attest_uri', None) + self.private_endpoint_connections = None class AttestationProviderListResult(msrest.serialization.Model): """Attestation Providers List. + 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 :param value: Attestation Provider array. :type 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]'}, } @@ -163,20 +184,21 @@ def __init__( **kwargs ): super(AttestationProviderListResult, self).__init__(**kwargs) + self.system_data = None self.value = kwargs.get('value', None) 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. + :param location: Required. The supported Azure location where the attestation provider should + be created. :type location: str - :param tags: A set of tags. The tags that will be assigned to the attestation service instance. + :param tags: A set of tags. The tags that will be assigned to the attestation provider. :type tags: dict[str, str] - :param properties: Required. Properties of the attestation service instance. + :param properties: Required. Properties of the attestation provider. :type properties: ~azure.mgmt.attestation.models.AttestationServiceCreationSpecificParams """ @@ -202,17 +224,14 @@ 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 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'}, } @@ -221,14 +240,13 @@ def __init__( **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. + """Parameters for patching an attestation provider. - :param tags: A set of tags. The tags that will be assigned to the attestation service instance. + :param tags: A set of tags. The tags that will be assigned to the attestation provider. :type tags: dict[str, str] """ @@ -274,7 +292,7 @@ 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 + :param 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- @@ -292,7 +310,7 @@ class JSONWebKey(msrest.serialization.Model): :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 + :param 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 @@ -316,7 +334,7 @@ class JSONWebKey(msrest.serialization.Model): :type q: str :param qi: RSA Private Key Parameter. :type qi: str - :param use: Required. Use ("public key use") identifies the intended use of + :param 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). @@ -336,10 +354,7 @@ class JSONWebKey(msrest.serialization.Model): """ _validation = { - 'alg': {'required': True}, - 'kid': {'required': True}, 'kty': {'required': True}, - 'use': {'required': True}, } _attribute_map = { @@ -367,20 +382,20 @@ def __init__( **kwargs ): super(JSONWebKey, self).__init__(**kwargs) - self.alg = kwargs['alg'] + self.alg = kwargs.get('alg', None) 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.kid = kwargs.get('kid', None) 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.use = kwargs.get('use', None) self.x = kwargs.get('x', None) self.x5_c = kwargs.get('x5_c', None) self.y = kwargs.get('y', None) @@ -412,11 +427,20 @@ def __init__( class OperationList(msrest.serialization.Model): """List of supported operations. + 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 :param value: List of supported operations. :type 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]'}, } @@ -425,6 +449,7 @@ def __init__( **kwargs ): super(OperationList, self).__init__(**kwargs) + self.system_data = None self.value = kwargs.get('value', None) @@ -480,3 +505,195 @@ def __init__( self.resource = kwargs.get('resource', None) self.operation = kwargs.get('operation', None) self.description = kwargs.get('description', None) + + +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 + :param private_endpoint: The resource of private end point. + :type private_endpoint: ~azure.mgmt.attestation.models.PrivateEndpoint + :param private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :type 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, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = None + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connection associated with the specified storage account. + + :param value: Array of private endpoint connections. + :type value: list[~azure.mgmt.attestation.models.PrivateEndpointConnection] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class PrivateEndpointConnectionProperties(msrest.serialization.Model): + """Properties of the private endpoint connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.attestation.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.provisioning_state = None + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :type status: str or ~azure.mgmt.attestation.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval/rejection of the connection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = kwargs.get('actions_required', None) + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.attestation.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.attestation.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) 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 f0ef448e6cb8..99f66019a495 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 @@ -117,13 +118,19 @@ class AttestationProvider(TrackedResource): :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. + :ivar system_data: The system metadata relating to this resource. + :vartype system_data: ~azure.mgmt.attestation.models.SystemData + :param trust_model: Trust model for the attestation provider. :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 + :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 +138,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 +148,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__( @@ -155,19 +166,30 @@ def __init__( **kwargs ): 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. + 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 :param value: Attestation Provider array. :type 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]'}, } @@ -178,20 +200,21 @@ def __init__( **kwargs ): 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. + :param location: Required. The supported Azure location where the attestation provider should + be created. :type location: str - :param tags: A set of tags. The tags that will be assigned to the attestation service instance. + :param tags: A set of tags. The tags that will be assigned to the attestation provider. :type tags: dict[str, str] - :param properties: Required. Properties of the attestation service instance. + :param properties: Required. Properties of the attestation provider. :type properties: ~azure.mgmt.attestation.models.AttestationServiceCreationSpecificParams """ @@ -221,36 +244,31 @@ 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 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, *, - attestation_policy: Optional[str] = None, policy_signing_certificates: Optional["JSONWebKeySet"] = None, **kwargs ): 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. + :param tags: A set of tags. The tags that will be assigned to the attestation provider. :type tags: dict[str, str] """ @@ -301,7 +319,7 @@ 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 + :param 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- @@ -319,7 +337,7 @@ class JSONWebKey(msrest.serialization.Model): :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 + :param 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 @@ -343,7 +361,7 @@ class JSONWebKey(msrest.serialization.Model): :type q: str :param qi: RSA Private Key Parameter. :type qi: str - :param use: Required. Use ("public key use") identifies the intended use of + :param 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). @@ -363,10 +381,7 @@ class JSONWebKey(msrest.serialization.Model): """ _validation = { - 'alg': {'required': True}, - 'kid': {'required': True}, 'kty': {'required': True}, - 'use': {'required': True}, } _attribute_map = { @@ -392,20 +407,20 @@ 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, @@ -459,11 +474,20 @@ def __init__( class OperationList(msrest.serialization.Model): """List of supported operations. + 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 :param value: List of supported operations. :type 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]'}, } @@ -474,6 +498,7 @@ def __init__( **kwargs ): super(OperationList, self).__init__(**kwargs) + self.system_data = None self.value = value @@ -537,3 +562,211 @@ def __init__( 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 + :param private_endpoint: The resource of private end point. + :type private_endpoint: ~azure.mgmt.attestation.models.PrivateEndpoint + :param private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :type 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 + ): + 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. + + :param value: Array of private endpoint connections. + :type value: list[~azure.mgmt.attestation.models.PrivateEndpointConnection] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnection"]] = None, + **kwargs + ): + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateEndpointConnectionProperties(msrest.serialization.Model): + """Properties of the private endpoint connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible + values include: "Succeeded", "Creating", "Deleting", "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.attestation.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionProperties, self).__init__(**kwargs) + self.provisioning_state = None + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :type status: str or ~azure.mgmt.attestation.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval/rejection of the connection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs + ): + 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. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~azure.mgmt.attestation.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~azure.mgmt.attestation.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "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 + ): + 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 fe9ce6fc7a08..81a65fb9726b 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 9e2d5da51d0b..1a04da25c6c7 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 @@ -55,7 +55,7 @@ def get( :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,7 +67,7 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" accept = "application/json" # Construct URL @@ -111,11 +111,11 @@ def create( **kwargs # type: Any ): # type: (...) -> "_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 @@ -129,7 +129,7 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -186,7 +186,7 @@ def update( :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,7 +200,7 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -264,7 +264,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" accept = "application/json" # Construct URL @@ -314,7 +314,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" accept = "application/json" # Construct URL @@ -368,7 +368,7 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" accept = "application/json" # Construct URL @@ -420,7 +420,7 @@ def list_default( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" accept = "application/json" # Construct URL @@ -474,7 +474,7 @@ def get_default_by_location( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" accept = "application/json" # Construct URL 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 aaade27566ad..6a8b0f3e3b0f 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 @@ -61,7 +61,7 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2018-09-01-preview" + api_version = "2020-10-01" accept = "application/json" # Construct URL 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 000000000000..155592643631 --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,319 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class 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 + + def list( + self, + resource_group_name, # type: str + provider_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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', {})) + api_version = "2020-10-01" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + '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', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + '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 = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return 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/attestationProvider/{providerName}/privateEndpointConnections'} # type: ignore + + def get( + self, + resource_group_name, # type: str + provider_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 + + def create( + self, + resource_group_name, # type: str + provider_name, # type: str + private_endpoint_connection_name, # type: str + properties, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_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', {})) + api_version = "2020-10-01" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.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\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(properties, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + 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 + + def delete( + self, + resource_group_name, # type: str + provider_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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', {})) + api_version = "2020-10-01" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 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