From cb3f8b1eff59f0c47702848923395c310b171ff2 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 28 Jan 2021 06:18:43 +0000 Subject: [PATCH] CodeGen from PR 12692 in Azure/azure-rest-api-specs Merge 87b2deaea738f092a92cc8a9802c5da82d56fbb5 into b3199b96ecc6d2e18216305385b13035e39df968 --- .../_attestation_management_client.py | 7 +- .../azure/mgmt/attestation/models/__init__.py | 7 + .../_attestation_management_client_enums.py | 8 + .../azure/mgmt/attestation/models/_models.py | 80 +++-- .../mgmt/attestation/models/_models_py3.py | 82 +++-- .../mgmt/attestation/models/_paged_models.py | 27 ++ .../mgmt/attestation/operations/__init__.py | 2 + .../_attestation_providers_operations.py | 12 +- ...private_endpoint_connections_operations.py | 318 ++++++++++++++++++ 9 files changed, 493 insertions(+), 50 deletions(-) create mode 100644 sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_paged_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/azure/mgmt/attestation/_attestation_management_client.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/_attestation_management_client.py index cce0c89d5058..b4dcc9dd2427 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 @@ -15,11 +15,12 @@ from ._configuration import AttestationManagementClientConfiguration from .operations import Operations from .operations import AttestationProvidersOperations +from .operations import PrivateEndpointConnectionsOperations from . import models class AttestationManagementClient(SDKClient): - """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 config: Configuration for client. :vartype config: AttestationManagementClientConfiguration @@ -28,6 +29,8 @@ class AttestationManagementClient(SDKClient): :vartype operations: azure.mgmt.attestation.operations.Operations :ivar attestation_providers: AttestationProviders operations :vartype attestation_providers: azure.mgmt.attestation.operations.AttestationProvidersOperations + :ivar private_endpoint_connections: PrivateEndpointConnections operations + :vartype private_endpoint_connections: azure.mgmt.attestation.operations.PrivateEndpointConnectionsOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -52,3 +55,5 @@ def __init__( 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) 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 fb7c00fb5f6e..eb3df2884914 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 @@ -21,6 +21,7 @@ from ._models_py3 import OperationList from ._models_py3 import OperationsDefinition from ._models_py3 import OperationsDisplayDefinition + from ._models_py3 import PrivateEndpointConnection from ._models_py3 import ProxyResource from ._models_py3 import Resource from ._models_py3 import SystemData @@ -37,13 +38,16 @@ from ._models import OperationList from ._models import OperationsDefinition from ._models import OperationsDisplayDefinition + from ._models import PrivateEndpointConnection from ._models import ProxyResource from ._models import Resource from ._models import SystemData from ._models import TrackedResource +from ._paged_models import PrivateEndpointConnectionPaged from ._attestation_management_client_enums import ( CreatedByType, AttestationServiceStatus, + PrivateEndpointConnectionProvisioningState, ) __all__ = [ @@ -58,10 +62,13 @@ 'OperationList', 'OperationsDefinition', 'OperationsDisplayDefinition', + 'PrivateEndpointConnection', 'ProxyResource', 'Resource', 'SystemData', 'TrackedResource', + 'PrivateEndpointConnectionPaged', 'CreatedByType', 'AttestationServiceStatus', + 'PrivateEndpointConnectionProvisioningState', ] 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 fcf855284547..7e2b71ca7e57 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 @@ -25,3 +25,11 @@ class AttestationServiceStatus(str, Enum): ready = "Ready" not_ready = "NotReady" error = "Error" + + +class PrivateEndpointConnectionProvisioningState(str, Enum): + + succeeded = "Succeeded" + creating = "Creating" + deleting = "Deleting" + failed = "Failed" 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 6705046df07b..3abd6f8522fd 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 @@ -119,7 +119,7 @@ class AttestationProvider(TrackedResource): :type location: str :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 service instance. + :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' @@ -127,6 +127,10 @@ class AttestationProvider(TrackedResource): ~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 = { @@ -135,6 +139,7 @@ class AttestationProvider(TrackedResource): 'type': {'readonly': True}, 'location': {'required': True}, 'system_data': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { @@ -147,6 +152,7 @@ class AttestationProvider(TrackedResource): '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__(self, **kwargs): @@ -155,6 +161,7 @@ def __init__(self, **kwargs): 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(Model): @@ -185,18 +192,16 @@ def __init__(self, **kwargs): class AttestationServiceCreationParams(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. + attestation provider should be created. :type location: str - :param tags: The tags that will be assigned to the attestation service - instance. + :param 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 """ @@ -220,8 +225,7 @@ def __init__(self, **kwargs): class AttestationServiceCreationSpecificParams(Model): - """Client supplied parameters used to create a new attestation service - instance. + """Client supplied parameters used to create a new attestation provider. :param policy_signing_certificates: JSON Web Key Set defining a set of X.509 Certificates that will represent the parent certificate for the @@ -240,10 +244,9 @@ def __init__(self, **kwargs): class AttestationServicePatchParams(Model): - """Parameters for patching an attestation service instance. + """Parameters for patching an attestation provider. - :param tags: The tags that will be assigned to the attestation service - instance. + :param tags: The tags that will be assigned to the attestation provider. :type tags: dict[str, str] """ @@ -351,8 +354,8 @@ class JSONWebKey(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- @@ -370,8 +373,8 @@ class JSONWebKey(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 @@ -396,8 +399,7 @@ class JSONWebKey(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). @@ -418,10 +420,7 @@ class JSONWebKey(Model): """ _validation = { - 'alg': {'required': True}, - 'kid': {'required': True}, 'kty': {'required': True}, - 'use': {'required': True}, } _attribute_map = { @@ -561,6 +560,45 @@ def __init__(self, **kwargs): self.description = kwargs.get('description', 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 provisioning_state: Provisioning state of the private endpoint + connection. Possible values include: 'Succeeded', 'Creating', 'Deleting', + 'Failed' + :type provisioning_state: str or + ~azure.mgmt.attestation.models.PrivateEndpointConnectionProvisioningState + """ + + _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'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.provisioning_state = kwargs.get('provisioning_state', None) + + class ProxyResource(Resource): """Proxy Resource. 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 31023ef01edd..2ed412b14b17 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 @@ -119,7 +119,7 @@ class AttestationProvider(TrackedResource): :type location: str :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 service instance. + :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' @@ -127,6 +127,10 @@ class AttestationProvider(TrackedResource): ~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 = { @@ -135,6 +139,7 @@ class AttestationProvider(TrackedResource): 'type': {'readonly': True}, 'location': {'required': True}, 'system_data': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { @@ -147,6 +152,7 @@ class AttestationProvider(TrackedResource): '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__(self, *, location: str, tags=None, trust_model: str=None, status=None, attest_uri: str=None, **kwargs) -> None: @@ -155,6 +161,7 @@ def __init__(self, *, location: str, tags=None, trust_model: str=None, status=No self.trust_model = trust_model self.status = status self.attest_uri = attest_uri + self.private_endpoint_connections = None class AttestationProviderListResult(Model): @@ -185,18 +192,16 @@ def __init__(self, *, value=None, **kwargs) -> None: class AttestationServiceCreationParams(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. + attestation provider should be created. :type location: str - :param tags: The tags that will be assigned to the attestation service - instance. + :param 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 """ @@ -220,8 +225,7 @@ def __init__(self, *, location: str, properties, tags=None, **kwargs) -> None: class AttestationServiceCreationSpecificParams(Model): - """Client supplied parameters used to create a new attestation service - instance. + """Client supplied parameters used to create a new attestation provider. :param policy_signing_certificates: JSON Web Key Set defining a set of X.509 Certificates that will represent the parent certificate for the @@ -240,10 +244,9 @@ def __init__(self, *, policy_signing_certificates=None, **kwargs) -> None: class AttestationServicePatchParams(Model): - """Parameters for patching an attestation service instance. + """Parameters for patching an attestation provider. - :param tags: The tags that will be assigned to the attestation service - instance. + :param tags: The tags that will be assigned to the attestation provider. :type tags: dict[str, str] """ @@ -351,8 +354,8 @@ class JSONWebKey(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- @@ -370,8 +373,8 @@ class JSONWebKey(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 @@ -396,8 +399,7 @@ class JSONWebKey(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). @@ -418,10 +420,7 @@ class JSONWebKey(Model): """ _validation = { - 'alg': {'required': True}, - 'kid': {'required': True}, 'kty': {'required': True}, - 'use': {'required': True}, } _attribute_map = { @@ -444,7 +443,7 @@ class JSONWebKey(Model): 'y': {'key': 'y', 'type': 'str'}, } - def __init__(self, *, alg: str, kid: str, kty: str, use: str, crv: str=None, d: str=None, dp: str=None, dq: str=None, e: str=None, k: str=None, n: str=None, p: str=None, q: str=None, qi: str=None, x: str=None, x5c=None, y: str=None, **kwargs) -> None: + def __init__(self, *, kty: str, alg: str=None, crv: str=None, d: str=None, dp: str=None, dq: str=None, e: str=None, k: str=None, kid: str=None, n: str=None, p: str=None, q: str=None, qi: str=None, use: str=None, x: str=None, x5c=None, y: str=None, **kwargs) -> None: super(JSONWebKey, self).__init__(**kwargs) self.alg = alg self.crv = crv @@ -561,6 +560,45 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non self.description = description +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 provisioning_state: Provisioning state of the private endpoint + connection. Possible values include: 'Succeeded', 'Creating', 'Deleting', + 'Failed' + :type provisioning_state: str or + ~azure.mgmt.attestation.models.PrivateEndpointConnectionProvisioningState + """ + + _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'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__(self, *, provisioning_state=None, **kwargs) -> None: + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.provisioning_state = provisioning_state + + class ProxyResource(Resource): """Proxy Resource. diff --git a/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_paged_models.py b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_paged_models.py new file mode 100644 index 000000000000..211fed20c52a --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/models/_paged_models.py @@ -0,0 +1,27 @@ +# 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 msrest.paging import Paged + + +class PrivateEndpointConnectionPaged(Paged): + """ + A paging container for iterating over a list of :class:`PrivateEndpointConnection ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[PrivateEndpointConnection]'} + } + + def __init__(self, *args, **kwargs): + + super(PrivateEndpointConnectionPaged, self).__init__(*args, **kwargs) 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 8d81eaf9193e..af001a24dc25 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 @@ -11,8 +11,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 e956bb56d419..44e0b02df00b 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 @@ -46,7 +46,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 :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the @@ -103,12 +103,12 @@ def get( def create( self, resource_group_name, provider_name, creation_params, custom_headers=None, raw=False, **operation_config): - """Creates a new Attestation Provider instance. + """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: @@ -179,10 +179,10 @@ 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 tags: The tags that will be assigned to the attestation service - instance. + :param tags: The tags that will be assigned to the attestation + provider. :type tags: dict[str, str] :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the 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..92f51852ecf4 --- /dev/null +++ b/sdk/attestation/azure-mgmt-attestation/azure/mgmt/attestation/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,318 @@ +# 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 uuid +from msrest.pipeline import ClientRawResponse +from msrestazure.azure_exceptions import CloudError + +from .. import models + + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client API version. Current version is 2020-10-01. Constant value: "2020-10-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2020-10-01" + + self.config = config + + def list( + self, resource_group_name, provider_name, custom_headers=None, raw=False, **operation_config): + """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 + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.mgmt.attestation.models.PrivateEndpointConnectionPaged[~azure.mgmt.attestation.models.PrivateEndpointConnection] + :raises: :class:`CloudError` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.PrivateEndpointConnectionPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProvider/{providerName}/privateEndpointConnections'} + + def get( + self, resource_group_name, provider_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + """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: Name of the private endpoint + connection associated with the attestation providers. + :type private_endpoint_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PrivateEndpointConnection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.attestation.models.PrivateEndpointConnection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.get.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + def create( + self, resource_group_name, provider_name, private_endpoint_connection_name, provisioning_state=None, custom_headers=None, raw=False, **operation_config): + """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: Name of the private endpoint + connection associated with the attestation providers. + :type private_endpoint_connection_name: str + :param provisioning_state: Provisioning state of the private endpoint + connection. Possible values include: 'Succeeded', 'Creating', + 'Deleting', 'Failed' + :type provisioning_state: str or + ~azure.mgmt.attestation.models.PrivateEndpointConnectionProvisioningState + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: PrivateEndpointConnection or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.attestation.models.PrivateEndpointConnection or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + properties = models.PrivateEndpointConnection(provisioning_state=provisioning_state) + + # Construct URL + url = self.create.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(properties, 'PrivateEndpointConnection') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}'} + + def delete( + self, resource_group_name, provider_name, private_endpoint_connection_name, custom_headers=None, raw=False, **operation_config): + """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: Name of the private endpoint + connection associated with the attestation providers. + :type private_endpoint_connection_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.delete.metadata['url'] + 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 = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + + # Construct headers + header_parameters = {} + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}/privateEndpointConnections/{privateEndpointConnectionName}'}