From 13a5b0ffbb63f7b1f7763b2f765a40973299b3dc Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 13 Nov 2020 03:39:22 +0000 Subject: [PATCH] CodeGen from PR 11659 in Azure/azure-rest-api-specs Fix output-folder (#11659) --- .../_attestation_management_client.py | 2 +- .../azure/mgmt/attestation/models/_models.py | 55 ++++---- .../mgmt/attestation/models/_models_py3.py | 57 ++++---- .../_attestation_providers_operations.py | 122 +++++++++++++++++- .../attestation/operations/_operations.py | 4 +- 5 files changed, 186 insertions(+), 54 deletions(-) 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 560d397d2880..5e0cdb650393 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 @@ -44,7 +44,7 @@ def __init__( super(AttestationManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2018-09-01-preview' + self.api_version = '2018-09-01' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) 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 4eb490f29d07..13b3a77b9184 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 @@ -16,16 +16,19 @@ class Resource(Model): """Resource. + Common fields that are returned in the response for all Azure Resource + Manager resources. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - + :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. + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" :vartype type: str """ @@ -49,20 +52,23 @@ def __init__(self, **kwargs): class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. + """Tracked Resource. + + The resource model definition for an Azure Resource Manager tracked top + level resource which has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - + :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. + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" :vartype type: str :param tags: Resource tags. :type tags: dict[str, str] @@ -99,13 +105,13 @@ class AttestationProvider(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - + :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. + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" :vartype type: str :param tags: Resource tags. :type tags: dict[str, str] @@ -113,8 +119,8 @@ class AttestationProvider(TrackedResource): :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' + :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 @@ -126,7 +132,6 @@ class AttestationProvider(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'status': {'required': True}, } _attribute_map = { @@ -240,19 +245,21 @@ def __init__(self, **kwargs): class AzureEntityResource(Resource): - """The resource model definition for a Azure Resource Manager resource with an - etag. + """Entity Resource. + + The resource model definition for an Azure Resource Manager resource with + an etag. 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 - + :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. + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" :vartype type: str :ivar etag: Resource Etag. :vartype etag: str @@ -532,19 +539,21 @@ def __init__(self, **kwargs): class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. + """Proxy Resource. + + The resource model definition for a Azure Resource Manager proxy resource. + It will not have tags and a location. 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 - + :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. + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" :vartype type: str """ 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 76b4c5fed428..ef8d5901f7c8 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 @@ -16,16 +16,19 @@ class Resource(Model): """Resource. + Common fields that are returned in the response for all Azure Resource + Manager resources. + Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource Id for the resource. Ex - + :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. + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" :vartype type: str """ @@ -49,20 +52,23 @@ def __init__(self, **kwargs) -> None: class TrackedResource(Resource): - """The resource model definition for a ARM tracked top level resource. + """Tracked Resource. + + The resource model definition for an Azure Resource Manager tracked top + level resource which has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - + :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. + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" :vartype type: str :param tags: Resource tags. :type tags: dict[str, str] @@ -99,13 +105,13 @@ class AttestationProvider(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource Id for the resource. Ex - + :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. + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" :vartype type: str :param tags: Resource tags. :type tags: dict[str, str] @@ -113,8 +119,8 @@ class AttestationProvider(TrackedResource): :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' + :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 @@ -126,7 +132,6 @@ class AttestationProvider(TrackedResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'location': {'required': True}, - 'status': {'required': True}, } _attribute_map = { @@ -140,7 +145,7 @@ class AttestationProvider(TrackedResource): 'attest_uri': {'key': 'properties.attestUri', 'type': 'str'}, } - def __init__(self, *, location: str, status, tags=None, trust_model: str=None, attest_uri: str=None, **kwargs) -> None: + def __init__(self, *, location: str, tags=None, trust_model: str=None, status=None, attest_uri: str=None, **kwargs) -> None: super(AttestationProvider, self).__init__(tags=tags, location=location, **kwargs) self.trust_model = trust_model self.status = status @@ -240,19 +245,21 @@ def __init__(self, *, tags=None, **kwargs) -> None: class AzureEntityResource(Resource): - """The resource model definition for a Azure Resource Manager resource with an - etag. + """Entity Resource. + + The resource model definition for an Azure Resource Manager resource with + an etag. 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 - + :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. + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" :vartype type: str :ivar etag: Resource Etag. :vartype etag: str @@ -532,19 +539,21 @@ def __init__(self, *, provider: str=None, resource: str=None, operation: str=Non class ProxyResource(Resource): - """The resource model definition for a ARM proxy resource. It will have - everything other than required location and tags. + """Proxy Resource. + + The resource model definition for a Azure Resource Manager proxy resource. + It will not have tags and a location. 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 - + :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. + :ivar type: The type of the resource. E.g. + "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" :vartype type: str """ 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 b137fae89ae4..a30137d14f7c 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 @@ -25,7 +25,7 @@ class AttestationProvidersOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client API version. Constant value: "2018-09-01-preview". + :ivar api_version: Client API version. Constant value: "2018-09-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-09-01-preview" + self.api_version = "2018-09-01" self.config = config @@ -108,7 +108,7 @@ def create( :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 + :param provider_name: Name of the attestation service instance. :type provider_name: str :param creation_params: Client supplied parameters. :type creation_params: @@ -179,7 +179,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 + :param provider_name: Name of the attestation service instance. :type provider_name: str :param tags: The tags that will be assigned to the attestation service instance. @@ -412,3 +412,117 @@ def list_by_resource_group( return deserialized list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Attestation/attestationProviders'} + + def list_default( + self, custom_headers=None, raw=False, **operation_config): + """Get the default provider. + + :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: AttestationProviderListResult or ClientRawResponse if + raw=true + :rtype: ~azure.mgmt.attestation.models.AttestationProviderListResult + or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + # Construct URL + url = self.list_default.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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('AttestationProviderListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_default.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/defaultProviders'} + + def get_default_by_location( + self, location, custom_headers=None, raw=False, **operation_config): + """Get the default provider by location. + + :param location: The location of the default provider. + :type location: 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` + """ + # Construct URL + url = self.get_default_by_location.metadata['url'] + path_format_arguments = { + 'location': self._serialize.url("location", location, 'str', min_length=1), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + 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('AttestationProvider', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_default_by_location.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Attestation/locations/{location}/defaultProvider'} 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 635e4b645882..87c31adca341 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 @@ -25,7 +25,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client API version. Constant value: "2018-09-01-preview". + :ivar api_version: Client API version. Constant value: "2018-09-01". """ models = models @@ -35,7 +35,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2018-09-01-preview" + self.api_version = "2018-09-01" self.config = config