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 fca4a02c73a6..a4b33e5419e9 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 @@ -13,6 +13,8 @@ from ._models_py3 import AttestationProvider from ._models_py3 import AttestationProviderListResult from ._models_py3 import AttestationServiceCreationParams + from ._models_py3 import AttestationServiceCreationSpecificParams + from ._models_py3 import AttestationServicePatchParams from ._models_py3 import AzureEntityResource from ._models_py3 import JSONWebKey from ._models_py3 import JSONWebKeySet @@ -26,6 +28,8 @@ from ._models import AttestationProvider from ._models import AttestationProviderListResult from ._models import AttestationServiceCreationParams + from ._models import AttestationServiceCreationSpecificParams + from ._models import AttestationServicePatchParams from ._models import AzureEntityResource from ._models import JSONWebKey from ._models import JSONWebKeySet @@ -43,6 +47,8 @@ 'AttestationProvider', 'AttestationProviderListResult', 'AttestationServiceCreationParams', + 'AttestationServiceCreationSpecificParams', + 'AttestationServicePatchParams', 'AzureEntityResource', 'JSONWebKey', 'JSONWebKeySet', 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 14679b47b176..4eb490f29d07 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 @@ -48,7 +48,50 @@ def __init__(self, **kwargs): self.type = None -class AttestationProvider(Resource): +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: 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. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + + +class AttestationProvider(TrackedResource): """Attestation service response message. Variables are only populated by the server, and will be ignored when @@ -64,6 +107,12 @@ class AttestationProvider(Resource): :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: str + :param trust_model: Trust model for the attestation service instance. + :type trust_model: str :param status: Required. Status of attestation service. Possible values include: 'Ready', 'NotReady', 'Error' :type status: str or @@ -76,6 +125,7 @@ class AttestationProvider(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'required': True}, 'status': {'required': True}, } @@ -83,12 +133,16 @@ class AttestationProvider(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'trust_model': {'key': 'properties.trustModel', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'attest_uri': {'key': 'properties.attestUri', 'type': 'str'}, } def __init__(self, **kwargs): super(AttestationProvider, self).__init__(**kwargs) + self.trust_model = kwargs.get('trust_model', None) self.status = kwargs.get('status', None) self.attest_uri = kwargs.get('attest_uri', None) @@ -110,7 +164,43 @@ def __init__(self, **kwargs): class AttestationServiceCreationParams(Model): - """Client supplied parameters passed to attestation service. + """Parameters for creating an attestation service instance. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The supported Azure location where the + attestation service instance should be created. + :type location: str + :param tags: The tags that will be assigned to the attestation service + instance. + :type tags: dict[str, str] + :param properties: Required. Properties of the attestation service + instance + :type properties: + ~azure.mgmt.attestation.models.AttestationServiceCreationSpecificParams + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'AttestationServiceCreationSpecificParams'}, + } + + def __init__(self, **kwargs): + super(AttestationServiceCreationParams, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.tags = kwargs.get('tags', None) + self.properties = kwargs.get('properties', None) + + +class AttestationServiceCreationSpecificParams(Model): + """Client supplied parameters used to create a new attestation service + instance. :param attestation_policy: Name of attestation policy. :type attestation_policy: str @@ -127,11 +217,28 @@ class AttestationServiceCreationParams(Model): } def __init__(self, **kwargs): - super(AttestationServiceCreationParams, self).__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(Model): + """Parameters for patching an attestation service instance. + + :param tags: The tags that will be assigned to the attestation service + instance. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, **kwargs): + super(AttestationServicePatchParams, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + class AzureEntityResource(Resource): """The resource model definition for a Azure Resource Manager resource with an etag. @@ -455,46 +562,3 @@ class ProxyResource(Resource): def __init__(self, **kwargs): super(ProxyResource, self).__init__(**kwargs) - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: 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. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs.get('location', 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 3d9a459792d6..76b4c5fed428 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 @@ -48,7 +48,50 @@ def __init__(self, **kwargs) -> None: self.type = None -class AttestationProvider(Resource): +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: 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. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__(self, *, location: str, tags=None, **kwargs) -> None: + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class AttestationProvider(TrackedResource): """Attestation service response message. Variables are only populated by the server, and will be ignored when @@ -64,6 +107,12 @@ class AttestationProvider(Resource): :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. :vartype type: str + :param tags: Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives + :type location: str + :param trust_model: Trust model for the attestation service instance. + :type trust_model: str :param status: Required. Status of attestation service. Possible values include: 'Ready', 'NotReady', 'Error' :type status: str or @@ -76,6 +125,7 @@ class AttestationProvider(Resource): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, + 'location': {'required': True}, 'status': {'required': True}, } @@ -83,12 +133,16 @@ class AttestationProvider(Resource): 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'trust_model': {'key': 'properties.trustModel', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'attest_uri': {'key': 'properties.attestUri', 'type': 'str'}, } - def __init__(self, *, status, attest_uri: str=None, **kwargs) -> None: - super(AttestationProvider, self).__init__(**kwargs) + def __init__(self, *, location: str, status, tags=None, trust_model: str=None, attest_uri: str=None, **kwargs) -> None: + super(AttestationProvider, self).__init__(tags=tags, location=location, **kwargs) + self.trust_model = trust_model self.status = status self.attest_uri = attest_uri @@ -110,7 +164,43 @@ def __init__(self, *, value=None, **kwargs) -> None: class AttestationServiceCreationParams(Model): - """Client supplied parameters passed to attestation service. + """Parameters for creating an attestation service instance. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The supported Azure location where the + attestation service instance should be created. + :type location: str + :param tags: The tags that will be assigned to the attestation service + instance. + :type tags: dict[str, str] + :param properties: Required. Properties of the attestation service + instance + :type properties: + ~azure.mgmt.attestation.models.AttestationServiceCreationSpecificParams + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'AttestationServiceCreationSpecificParams'}, + } + + def __init__(self, *, location: str, properties, tags=None, **kwargs) -> None: + super(AttestationServiceCreationParams, self).__init__(**kwargs) + self.location = location + self.tags = tags + self.properties = properties + + +class AttestationServiceCreationSpecificParams(Model): + """Client supplied parameters used to create a new attestation service + instance. :param attestation_policy: Name of attestation policy. :type attestation_policy: str @@ -127,11 +217,28 @@ class AttestationServiceCreationParams(Model): } def __init__(self, *, attestation_policy: str=None, policy_signing_certificates=None, **kwargs) -> None: - super(AttestationServiceCreationParams, self).__init__(**kwargs) + super(AttestationServiceCreationSpecificParams, self).__init__(**kwargs) self.attestation_policy = attestation_policy self.policy_signing_certificates = policy_signing_certificates +class AttestationServicePatchParams(Model): + """Parameters for patching an attestation service instance. + + :param tags: The tags that will be assigned to the attestation service + instance. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__(self, *, tags=None, **kwargs) -> None: + super(AttestationServicePatchParams, self).__init__(**kwargs) + self.tags = tags + + class AzureEntityResource(Resource): """The resource model definition for a Azure Resource Manager resource with an etag. @@ -455,46 +562,3 @@ class ProxyResource(Resource): def __init__(self, **kwargs) -> None: super(ProxyResource, self).__init__(**kwargs) - - -class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. - - Variables are only populated by the server, and will be ignored when - sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: 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. Ex- - Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. - :vartype type: str - :param tags: Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__(self, *, location: str, tags=None, **kwargs) -> None: - super(TrackedResource, self).__init__(**kwargs) - self.tags = tags - self.location = location 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 06b43c024d71..b137fae89ae4 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 @@ -102,7 +102,7 @@ def get( get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} def create( - self, resource_group_name, provider_name, attestation_policy=None, policy_signing_certificates=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, provider_name, creation_params, custom_headers=None, raw=False, **operation_config): """Creates or updates the Attestation Provider. :param resource_group_name: The name of the resource group. The name @@ -110,13 +110,9 @@ def create( :type resource_group_name: str :param provider_name: Name of the attestation service :type provider_name: str - :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 + :param creation_params: Client supplied parameters. + :type creation_params: + ~azure.mgmt.attestation.models.AttestationServiceCreationParams :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -127,10 +123,6 @@ def create( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - creation_params = None - if attestation_policy is not None or policy_signing_certificates is not None: - creation_params = models.AttestationServiceCreationParams(attestation_policy=attestation_policy, policy_signing_certificates=policy_signing_certificates) - # Construct URL url = self.create.metadata['url'] path_format_arguments = { @@ -156,10 +148,7 @@ def create( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct body - if creation_params is not None: - body_content = self._serialize.body(creation_params, 'AttestationServiceCreationParams') - else: - body_content = None + body_content = self._serialize.body(creation_params, 'AttestationServiceCreationParams') # Construct and send request request = self._client.put(url, query_parameters, header_parameters, body_content) @@ -183,6 +172,77 @@ def create( return deserialized create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} + def update( + self, resource_group_name, provider_name, tags=None, custom_headers=None, raw=False, **operation_config): + """Updates the Attestation Provider. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param provider_name: Name of the attestation service + :type provider_name: str + :param tags: The tags that will be assigned to the attestation service + instance. + :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 + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: AttestationProvider or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.attestation.models.AttestationProvider or + ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + update_params = models.AttestationServicePatchParams(tags=tags) + + # Construct URL + url = self.update.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'providerName': self._serialize.url("provider_name", provider_name, 'str') + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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(update_params, 'AttestationServicePatchParams') + + # Construct and send request + request = self._client.patch(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('AttestationProvider', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders/{providerName}'} + def delete( self, resource_group_name, provider_name, custom_headers=None, raw=False, **operation_config): """Delete Attestation Service.