From fb108b3b9330724cc02315b8026d4a0cf9bfbea8 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 4 Aug 2021 10:22:38 +0000 Subject: [PATCH] CodeGen from PR 15335 in Azure/azure-rest-api-specs Merge 9b5c6b814dff785a5e1b1cb6a4cbd54591675f0a into e77ce605fc14239b071218d52a75e7c3fafee58e --- .../MANIFEST.in | 1 + .../azure-mgmt-marketplaceordering/_meta.json | 11 ++++ .../_marketplace_ordering_agreements.py | 20 ++++++ .../mgmt/marketplaceordering/_metadata.json | 62 ++++++++++++++++--- .../mgmt/marketplaceordering/_version.py | 2 +- .../aio/_marketplace_ordering_agreements.py | 19 ++++++ .../_marketplace_agreements_operations.py | 24 +++---- .../aio/operations/_operations.py | 4 +- .../_marketplace_agreements_operations.py | 12 ++-- .../operations/_operations.py | 2 +- 10 files changed, 125 insertions(+), 32 deletions(-) create mode 100644 sdk/marketplaceordering/azure-mgmt-marketplaceordering/_meta.json diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/MANIFEST.in b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/MANIFEST.in index a3cb07df8765..3a9b6517412b 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/MANIFEST.in +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/MANIFEST.in @@ -1,3 +1,4 @@ +include _meta.json recursive-include tests *.py *.yaml include *.md include azure/__init__.py diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/_meta.json b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/_meta.json new file mode 100644 index 000000000000..8822990bf820 --- /dev/null +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "aaa1ba5745d844b196b06837aa84897b209ca367", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/marketplaceordering/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "readme": "specification/marketplaceordering/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_marketplace_ordering_agreements.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_marketplace_ordering_agreements.py index 18cfa9bab79a..8d6079c329f5 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_marketplace_ordering_agreements.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_marketplace_ordering_agreements.py @@ -16,6 +16,7 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse from ._configuration import MarketplaceOrderingAgreementsConfiguration from .operations import MarketplaceAgreementsOperations @@ -52,6 +53,7 @@ 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.marketplace_agreements = MarketplaceAgreementsOperations( @@ -59,6 +61,24 @@ def __init__( self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + def close(self): # type: () -> None self._client.close() diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_metadata.json b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_metadata.json index 17c1d7d6889a..00c12a9ede0c 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_metadata.json +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_metadata.json @@ -9,7 +9,9 @@ "custom_base_url": null, "azure_arm": true, "has_lro_operations": false, - "client_side_validation": true + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MarketplaceOrderingAgreementsConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"MarketplaceOrderingAgreementsConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" }, "global_parameters": { "sync": { @@ -28,13 +30,13 @@ }, "async": { "credential": { - "signature": "credential, # type: \"AsyncTokenCredential\"", + "signature": "credential: \"AsyncTokenCredential\",", "description": "Credential needed for the client to connect to Azure.", "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", "required": true }, "subscription_id": { - "signature": "subscription_id, # type: str", + "signature": "subscription_id: str,", "description": "The subscription ID that identifies an Azure subscription.", "docstring_type": "str", "required": true @@ -42,21 +44,61 @@ }, "constant": { }, - "call": "credential, subscription_id" + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } }, "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], "credential_default_policy_type": "BearerTokenCredentialPolicy", "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "marketplace_agreements": "MarketplaceAgreementsOperations", "operations": "Operations" - }, - "operation_mixins": { - }, - "sync_imports": "None", - "async_imports": "None" + } } \ No newline at end of file diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_version.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_version.py index 59deb8c7263b..e5754a47ce68 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_version.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.1.0" +VERSION = "1.0.0b1" diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/_marketplace_ordering_agreements.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/_marketplace_ordering_agreements.py index 72f9509cb863..d3415e19c55b 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/_marketplace_ordering_agreements.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/_marketplace_ordering_agreements.py @@ -8,6 +8,7 @@ from typing import Any, Optional, TYPE_CHECKING +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer @@ -49,6 +50,7 @@ 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.marketplace_agreements = MarketplaceAgreementsOperations( @@ -56,6 +58,23 @@ def __init__( self.operations = Operations( self._client, self._config, self._serialize, self._deserialize) + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + async def close(self) -> None: await self._client.close() diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_marketplace_agreements_operations.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_marketplace_agreements_operations.py index b39221dae1e7..1801d8d76150 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_marketplace_agreements_operations.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_marketplace_agreements_operations.py @@ -46,7 +46,7 @@ async def get( publisher_id: str, offer_id: str, plan_id: str, - **kwargs + **kwargs: Any ) -> "_models.AgreementTerms": """Get marketplace terms. @@ -96,7 +96,7 @@ async def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgreementTerms', pipeline_response) @@ -114,7 +114,7 @@ async def create( offer_id: str, plan_id: str, parameters: "_models.AgreementTerms", - **kwargs + **kwargs: Any ) -> "_models.AgreementTerms": """Save marketplace terms. @@ -171,7 +171,7 @@ async def create( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgreementTerms', pipeline_response) @@ -187,7 +187,7 @@ async def sign( publisher_id: str, offer_id: str, plan_id: str, - **kwargs + **kwargs: Any ) -> "_models.AgreementTerms": """Sign marketplace terms. @@ -234,7 +234,7 @@ async def sign( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgreementTerms', pipeline_response) @@ -250,7 +250,7 @@ async def cancel( publisher_id: str, offer_id: str, plan_id: str, - **kwargs + **kwargs: Any ) -> "_models.AgreementTerms": """Cancel marketplace terms. @@ -297,7 +297,7 @@ async def cancel( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgreementTerms', pipeline_response) @@ -313,7 +313,7 @@ async def get_agreement( publisher_id: str, offer_id: str, plan_id: str, - **kwargs + **kwargs: Any ) -> "_models.AgreementTerms": """Get marketplace agreement. @@ -360,7 +360,7 @@ async def get_agreement( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgreementTerms', pipeline_response) @@ -373,7 +373,7 @@ async def get_agreement( async def list( self, - **kwargs + **kwargs: Any ) -> List["_models.AgreementTerms"]: """List marketplace agreements in the subscription. @@ -411,7 +411,7 @@ async def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('[AgreementTerms]', pipeline_response) diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_operations.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_operations.py index f49736bb230a..7df8cbdd0bfa 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_operations.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/aio/operations/_operations.py @@ -43,7 +43,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Microsoft.MarketplaceOrdering REST API operations. @@ -93,7 +93,7 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_marketplace_agreements_operations.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_marketplace_agreements_operations.py index cb3bd2632398..0ab35b0b1e47 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_marketplace_agreements_operations.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_marketplace_agreements_operations.py @@ -101,7 +101,7 @@ def get( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgreementTerms', pipeline_response) @@ -177,7 +177,7 @@ def create( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgreementTerms', pipeline_response) @@ -241,7 +241,7 @@ def sign( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgreementTerms', pipeline_response) @@ -305,7 +305,7 @@ def cancel( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgreementTerms', pipeline_response) @@ -369,7 +369,7 @@ def get_agreement( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('AgreementTerms', pipeline_response) @@ -421,7 +421,7 @@ def list( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('[AgreementTerms]', pipeline_response) diff --git a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_operations.py b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_operations.py index 6440cd07edcf..fd0eeea3d357 100644 --- a/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_operations.py +++ b/sdk/marketplaceordering/azure-mgmt-marketplaceordering/azure/mgmt/marketplaceordering/operations/_operations.py @@ -98,7 +98,7 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)