From b8f3ea2372e03cbcd00ec55deb68c622c076bc54 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 1 Feb 2022 04:43:27 +0000 Subject: [PATCH] CodeGen from PR 17070 in Azure/azure-rest-api-specs Merge f2b41af80ee1b33bfaeb5a3330218830ad393d13 into 03da592cccfa0e52ccd6ecc53d232afda8a38c95 --- sdk/confluent/azure-mgmt-confluent/_meta.json | 10 +- .../azure/mgmt/confluent/__init__.py | 9 +- .../azure/mgmt/confluent/_configuration.py | 21 +- .../confluent/_confluent_management_client.py | 98 +-- .../azure/mgmt/confluent/_metadata.json | 25 +- .../azure/mgmt/confluent/_patch.py | 31 + .../azure/mgmt/confluent/_vendor.py | 27 + .../azure/mgmt/confluent/_version.py | 2 +- .../azure/mgmt/confluent/aio/__init__.py | 5 + .../mgmt/confluent/aio/_configuration.py | 8 +- .../aio/_confluent_management_client.py | 84 +-- .../azure/mgmt/confluent/aio/_patch.py | 31 + .../_marketplace_agreements_operations.py | 99 ++- .../operations/_organization_operations.py | 318 ++++----- .../_organization_operations_operations.py | 47 +- .../aio/operations/_validations_operations.py | 49 +- .../azure/mgmt/confluent/models/__init__.py | 42 +- .../_confluent_management_client_enums.py | 25 +- .../azure/mgmt/confluent/models/_models.py | 503 -------------- .../mgmt/confluent/models/_models_py3.py | 287 +++++--- .../_marketplace_agreements_operations.py | 194 ++++-- .../operations/_organization_operations.py | 624 +++++++++++------- .../_organization_operations_operations.py | 85 ++- .../operations/_validations_operations.py | 117 ++-- 24 files changed, 1344 insertions(+), 1397 deletions(-) create mode 100644 sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_patch.py create mode 100644 sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_vendor.py create mode 100644 sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/_patch.py delete mode 100644 sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/_models.py diff --git a/sdk/confluent/azure-mgmt-confluent/_meta.json b/sdk/confluent/azure-mgmt-confluent/_meta.json index ebef24fa2ad7..af9b7d0e826d 100644 --- a/sdk/confluent/azure-mgmt-confluent/_meta.json +++ b/sdk/confluent/azure-mgmt-confluent/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.2", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.0", - "@autorest/modelerfour@4.19.1" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "58af5ba424f6a4e270a22327933c78143e89bf07", + "commit": "35e6d5eccbface92ece9f759a64b92e742d2b15a", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/confluent/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.0 --use=@autorest/modelerfour@4.19.1 --version=3.4.2", + "autorest_command": "autorest specification/confluent/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/confluent/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/__init__.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/__init__.py index 8531fdbc09ad..3f523715f231 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/__init__.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ConfluentManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_configuration.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_configuration.py index 0b48dbf156a6..0c23f6e07ca0 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_configuration.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,20 +33,19 @@ class ConfluentManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ConfluentManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ConfluentManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-03-01-preview" + self.api_version = "2021-12-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-confluent/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_confluent_management_client.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_confluent_management_client.py index 443d64ea8ab3..0538a9cfcbd3 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_confluent_management_client.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_confluent_management_client.py @@ -6,33 +6,30 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ConfluentManagementClientConfiguration +from .operations import MarketplaceAgreementsOperations, OrganizationOperations, OrganizationOperationsOperations, ValidationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import ConfluentManagementClientConfiguration -from .operations import MarketplaceAgreementsOperations -from .operations import OrganizationOperationsOperations -from .operations import OrganizationOperations -from .operations import ValidationsOperations -from . import models - -class ConfluentManagementClient(object): +class ConfluentManagementClient: """ConfluentManagementClient. :ivar marketplace_agreements: MarketplaceAgreementsOperations operations - :vartype marketplace_agreements: azure.mgmt.confluent.operations.MarketplaceAgreementsOperations + :vartype marketplace_agreements: + azure.mgmt.confluent.operations.MarketplaceAgreementsOperations :ivar organization_operations: OrganizationOperationsOperations operations - :vartype organization_operations: azure.mgmt.confluent.operations.OrganizationOperationsOperations + :vartype organization_operations: + azure.mgmt.confluent.operations.OrganizationOperationsOperations :ivar organization: OrganizationOperations operations :vartype organization: azure.mgmt.confluent.operations.OrganizationOperations :ivar validations: ValidationsOperations operations @@ -41,54 +38,57 @@ class ConfluentManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: Microsoft Azure subscription id. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ConfluentManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ConfluentManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) 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._serialize.client_side_validation = False + self.marketplace_agreements = MarketplaceAgreementsOperations(self._client, self._config, self._serialize, self._deserialize) + self.organization_operations = OrganizationOperationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.organization = OrganizationOperations(self._client, self._config, self._serialize, self._deserialize) + self.validations = ValidationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.marketplace_agreements = MarketplaceAgreementsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.organization_operations = OrganizationOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.organization = OrganizationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.validations = ValidationsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: 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. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.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 + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_metadata.json b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_metadata.json index c3767b56d646..1cc398902f39 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_metadata.json +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2021-03-01-preview", - "total_api_version_list": ["2021-03-01-preview"], + "chosen_version": "2021-12-01", + "total_api_version_list": ["2021-12-01"], "client": { "name": "ConfluentManagementClient", "filename": "_confluent_management_client", "description": "ConfluentManagementClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": 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\": [\"ConfluentManagementClientConfiguration\"]}}, \"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\": [\"ConfluentManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "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\": [\"ConfluentManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ConfluentManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "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, - "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\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"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\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "marketplace_agreements": "MarketplaceAgreementsOperations", diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_patch.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_vendor.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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 azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_version.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_version.py index e32dc6ec4218..e5754a47ce68 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_version.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/__init__.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/__init__.py index 8af95dbcb097..17d69ce48ac6 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/__init__.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/__init__.py @@ -8,3 +8,8 @@ from ._confluent_management_client import ConfluentManagementClient __all__ = ['ConfluentManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/_configuration.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/_configuration.py index c963369cfd9a..8b2f687fb8fa 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/_configuration.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,15 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ConfluentManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ConfluentManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-03-01-preview" + self.api_version = "2021-12-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-confluent/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/_confluent_management_client.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/_confluent_management_client.py index 936d61d2afe0..783ab70ce3d0 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/_confluent_management_client.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/_confluent_management_client.py @@ -6,31 +6,30 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ConfluentManagementClientConfiguration +from .operations import MarketplaceAgreementsOperations, OrganizationOperations, OrganizationOperationsOperations, ValidationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ConfluentManagementClientConfiguration -from .operations import MarketplaceAgreementsOperations -from .operations import OrganizationOperationsOperations -from .operations import OrganizationOperations -from .operations import ValidationsOperations -from .. import models - - -class ConfluentManagementClient(object): +class ConfluentManagementClient: """ConfluentManagementClient. :ivar marketplace_agreements: MarketplaceAgreementsOperations operations - :vartype marketplace_agreements: azure.mgmt.confluent.aio.operations.MarketplaceAgreementsOperations + :vartype marketplace_agreements: + azure.mgmt.confluent.aio.operations.MarketplaceAgreementsOperations :ivar organization_operations: OrganizationOperationsOperations operations - :vartype organization_operations: azure.mgmt.confluent.aio.operations.OrganizationOperationsOperations + :vartype organization_operations: + azure.mgmt.confluent.aio.operations.OrganizationOperationsOperations :ivar organization: OrganizationOperations operations :vartype organization: azure.mgmt.confluent.aio.operations.OrganizationOperations :ivar validations: ValidationsOperations operations @@ -39,52 +38,57 @@ class ConfluentManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: Microsoft Azure subscription id. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ConfluentManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ConfluentManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) 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._serialize.client_side_validation = False + self.marketplace_agreements = MarketplaceAgreementsOperations(self._client, self._config, self._serialize, self._deserialize) + self.organization_operations = OrganizationOperationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.organization = OrganizationOperations(self._client, self._config, self._serialize, self._deserialize) + self.validations = ValidationsOperations(self._client, self._config, self._serialize, self._deserialize) - self.marketplace_agreements = MarketplaceAgreementsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.organization_operations = OrganizationOperationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.organization = OrganizationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.validations = ValidationsOperations( - self._client, self._config, self._serialize, self._deserialize) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[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. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.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 + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/_patch.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_marketplace_agreements_operations.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_marketplace_agreements_operations.py index 6c29deb8b9a5..0598192ef59b 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_marketplace_agreements_operations.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_marketplace_agreements_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._marketplace_agreements_operations import build_create_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -50,8 +56,10 @@ def list( List Confluent marketplace agreements in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfluentAgreementResourceListResponse or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.ConfluentAgreementResourceListResponse] + :return: An iterator like instance of either ConfluentAgreementResourceListResponse or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.ConfluentAgreementResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfluentAgreementResourceListResponse"] @@ -59,34 +67,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ConfluentAgreementResourceListResponse', pipeline_response) + deserialized = self._deserialize("ConfluentAgreementResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,17 +102,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements'} # type: ignore + @distributed_trace_async async def create( self, body: Optional["_models.ConfluentAgreementResource"] = None, @@ -131,39 +136,29 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'ConfluentAgreementResource') + _json = self._serialize.body(body, 'ConfluentAgreementResource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConfluentAgreementResource', pipeline_response) @@ -172,4 +167,6 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default'} # type: ignore + diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations.py index 205b58590846..2604626e1bd4 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._organization_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -52,8 +58,10 @@ def list_by_subscription( List all organizations under the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OrganizationResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult] + :return: An iterator like instance of either OrganizationResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResourceListResult"] @@ -61,34 +69,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OrganizationResourceListResult', pipeline_response) + deserialized = self._deserialize("OrganizationResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,17 +104,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -124,8 +129,10 @@ def list_by_resource_group( :param resource_group_name: Resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OrganizationResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult] + :return: An iterator like instance of either OrganizationResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResourceListResult"] @@ -133,35 +140,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OrganizationResourceListResult', pipeline_response) + deserialized = self._deserialize("OrganizationResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -174,17 +177,19 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -209,33 +214,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + organization_name=organization_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OrganizationResource', pipeline_response) @@ -244,8 +239,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -258,42 +255,31 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'OrganizationResource') + _json = self._serialize.body(body, 'OrganizationResource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + organization_name=organization_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('OrganizationResource', pipeline_response) @@ -305,8 +291,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -326,15 +315,19 @@ async def begin_create( :type body: ~azure.mgmt.confluent.models.OrganizationResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either OrganizationResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either OrganizationResource or the result + of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.confluent.models.OrganizationResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -346,27 +339,21 @@ async def begin_create( resource_group_name=resource_group_name, organization_name=organization_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OrganizationResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -378,8 +365,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -407,41 +396,31 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'OrganizationResourceUpdate') + _json = self._serialize.body(body, 'OrganizationResourceUpdate') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + organization_name=organization_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OrganizationResource', pipeline_response) @@ -450,8 +429,10 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -463,40 +444,31 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + organization_name=organization_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -513,15 +485,17 @@ async def begin_delete( :type organization_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -535,21 +509,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -561,4 +528,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations_operations.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations_operations.py index 25d94c7b51ec..7edf27fd2779 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations_operations.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_organization_operations_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._organization_operations_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -51,7 +57,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.confluent.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -59,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -95,12 +99,13 @@ async def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_validations_operations.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_validations_operations.py index b5f4e96dcc92..fe0c4a378d20 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_validations_operations.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/aio/operations/_validations_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._validations_operations import build_validate_organization_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def validate_organization( self, resource_group_name: str, @@ -67,38 +72,28 @@ async def validate_organization( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_organization.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'OrganizationResource') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_validate_organization_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + organization_name=organization_name, + content_type=content_type, + json=_json, + template_url=self.validate_organization.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'OrganizationResource') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OrganizationResource', pipeline_response) @@ -107,4 +102,6 @@ async def validate_organization( return cls(pipeline_response, deserialized, {}) return deserialized + validate_organization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/validations/{organizationName}/orgvalidate'} # type: ignore + diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/__init__.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/__init__.py index 9744155717fe..e86780265ca8 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/__init__.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/__init__.py @@ -6,34 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ConfluentAgreementResource - from ._models_py3 import ConfluentAgreementResourceListResponse - from ._models_py3 import ErrorResponseBody - from ._models_py3 import OfferDetail - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import OperationResult - from ._models_py3 import OrganizationResource - from ._models_py3 import OrganizationResourceListResult - from ._models_py3 import OrganizationResourceUpdate - from ._models_py3 import ResourceProviderDefaultErrorResponse - from ._models_py3 import SystemData - from ._models_py3 import UserDetail -except (SyntaxError, ImportError): - from ._models import ConfluentAgreementResource # type: ignore - from ._models import ConfluentAgreementResourceListResponse # type: ignore - from ._models import ErrorResponseBody # type: ignore - from ._models import OfferDetail # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationResult # type: ignore - from ._models import OrganizationResource # type: ignore - from ._models import OrganizationResourceListResult # type: ignore - from ._models import OrganizationResourceUpdate # type: ignore - from ._models import ResourceProviderDefaultErrorResponse # type: ignore - from ._models import SystemData # type: ignore - from ._models import UserDetail # type: ignore +from ._models_py3 import ConfluentAgreementResource +from ._models_py3 import ConfluentAgreementResourceListResponse +from ._models_py3 import ErrorResponseBody +from ._models_py3 import OfferDetail +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationResult +from ._models_py3 import OrganizationResource +from ._models_py3 import OrganizationResourceListResult +from ._models_py3 import OrganizationResourceUpdate +from ._models_py3 import ResourceProviderDefaultErrorResponse +from ._models_py3 import SystemData +from ._models_py3 import UserDetail + from ._confluent_management_client_enums import ( CreatedByType, diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/_confluent_management_client_enums.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/_confluent_management_client_enums.py index 93b95b746f2f..aafd103099c1 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/_confluent_management_client_enums.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/_confluent_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -35,7 +20,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class ProvisionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provision states for confluent RP """ @@ -49,7 +34,7 @@ class ProvisionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DELETED = "Deleted" NOT_SPECIFIED = "NotSpecified" -class SaaSOfferStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SaaSOfferStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SaaS Offer Status for confluent RP """ diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/_models.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/_models.py deleted file mode 100644 index 667c5448e0d0..000000000000 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/_models.py +++ /dev/null @@ -1,503 +0,0 @@ -# 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 azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class ConfluentAgreementResource(msrest.serialization.Model): - """Agreement Terms definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM id of the resource. - :vartype id: str - :ivar name: The name of the agreement. - :vartype name: str - :ivar type: The type of the agreement. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.confluent.models.SystemData - :param publisher: Publisher identifier string. - :type publisher: str - :param product: Product identifier string. - :type product: str - :param plan: Plan identifier string. - :type plan: str - :param license_text_link: Link to HTML with Microsoft and Publisher terms. - :type license_text_link: str - :param privacy_policy_link: Link to the privacy policy of the publisher. - :type privacy_policy_link: str - :param retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty - if Accepted is false. - :type retrieve_datetime: ~datetime.datetime - :param signature: Terms signature. - :type signature: str - :param accepted: If any version of the terms have been accepted, otherwise false. - :type accepted: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'publisher': {'key': 'properties.publisher', 'type': 'str'}, - 'product': {'key': 'properties.product', 'type': 'str'}, - 'plan': {'key': 'properties.plan', 'type': 'str'}, - 'license_text_link': {'key': 'properties.licenseTextLink', 'type': 'str'}, - 'privacy_policy_link': {'key': 'properties.privacyPolicyLink', 'type': 'str'}, - 'retrieve_datetime': {'key': 'properties.retrieveDatetime', 'type': 'iso-8601'}, - 'signature': {'key': 'properties.signature', 'type': 'str'}, - 'accepted': {'key': 'properties.accepted', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfluentAgreementResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - self.publisher = kwargs.get('publisher', None) - self.product = kwargs.get('product', None) - self.plan = kwargs.get('plan', None) - self.license_text_link = kwargs.get('license_text_link', None) - self.privacy_policy_link = kwargs.get('privacy_policy_link', None) - self.retrieve_datetime = kwargs.get('retrieve_datetime', None) - self.signature = kwargs.get('signature', None) - self.accepted = kwargs.get('accepted', None) - - -class ConfluentAgreementResourceListResponse(msrest.serialization.Model): - """Response of a list operation. - - :param value: Results of a list operation. - :type value: list[~azure.mgmt.confluent.models.ConfluentAgreementResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ConfluentAgreementResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfluentAgreementResourceListResponse, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ErrorResponseBody(msrest.serialization.Model): - """Response body of Error. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: Error code. - :vartype code: str - :ivar message: Error message. - :vartype message: str - :ivar target: Error target. - :vartype target: str - :ivar details: Error detail. - :vartype details: list[~azure.mgmt.confluent.models.ErrorResponseBody] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorResponseBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponseBody, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - - -class OfferDetail(msrest.serialization.Model): - """Confluent Offer detail. - - All required parameters must be populated in order to send to Azure. - - :param publisher_id: Required. Publisher Id. - :type publisher_id: str - :param id: Required. Offer Id. - :type id: str - :param plan_id: Required. Offer Plan Id. - :type plan_id: str - :param plan_name: Required. Offer Plan Name. - :type plan_name: str - :param term_unit: Required. Offer Plan Term unit. - :type term_unit: str - :param status: SaaS Offer Status. Possible values include: "Started", - "PendingFulfillmentStart", "InProgress", "Subscribed", "Suspended", "Reinstated", "Succeeded", - "Failed", "Unsubscribed", "Updating". - :type status: str or ~azure.mgmt.confluent.models.SaaSOfferStatus - """ - - _validation = { - 'publisher_id': {'required': True, 'max_length': 50, 'min_length': 0}, - 'id': {'required': True, 'max_length': 50, 'min_length': 0}, - 'plan_id': {'required': True, 'max_length': 50, 'min_length': 0}, - 'plan_name': {'required': True, 'max_length': 50, 'min_length': 0}, - 'term_unit': {'required': True, 'max_length': 25, 'min_length': 0}, - } - - _attribute_map = { - 'publisher_id': {'key': 'publisherId', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'plan_id': {'key': 'planId', 'type': 'str'}, - 'plan_name': {'key': 'planName', 'type': 'str'}, - 'term_unit': {'key': 'termUnit', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OfferDetail, self).__init__(**kwargs) - self.publisher_id = kwargs['publisher_id'] - self.id = kwargs['id'] - self.plan_id = kwargs['plan_id'] - self.plan_name = kwargs['plan_name'] - self.term_unit = kwargs['term_unit'] - self.status = kwargs.get('status', None) - - -class OperationDisplay(msrest.serialization.Model): - """The object that represents the operation. - - :param provider: Service provider: Microsoft.Confluent. - :type provider: str - :param resource: Type on which the operation is performed, e.g., 'clusters'. - :type resource: str - :param operation: Operation type, e.g., read, write, delete, etc. - :type operation: str - :param description: Description of the operation, e.g., 'Write confluent'. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of GET request to list Confluent operations. - - :param value: List of Confluent operations supported by the Microsoft.Confluent provider. - :type value: list[~azure.mgmt.confluent.models.OperationResult] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationResult(msrest.serialization.Model): - """An Confluent REST API operation. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.confluent.models.OperationDisplay - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResult, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = kwargs.get('is_data_action', None) - - -class OrganizationResource(msrest.serialization.Model): - """Organization 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: The ARM id of the resource. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.confluent.models.SystemData - :param tags: A set of tags. Organization resource tags. - :type tags: dict[str, str] - :param location: Location of Organization resource. - :type location: str - :ivar created_time: The creation time of the resource. - :vartype created_time: ~datetime.datetime - :ivar provisioning_state: Provision states for confluent RP. Possible values include: - "Accepted", "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", - "NotSpecified". - :vartype provisioning_state: str or ~azure.mgmt.confluent.models.ProvisionState - :ivar organization_id: Id of the Confluent organization. - :vartype organization_id: str - :ivar sso_url: SSO url for the Confluent organization. - :vartype sso_url: str - :param offer_detail: Required. Confluent offer detail. - :type offer_detail: ~azure.mgmt.confluent.models.OfferDetail - :param user_detail: Required. Subscriber detail. - :type user_detail: ~azure.mgmt.confluent.models.UserDetail - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'created_time': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'organization_id': {'readonly': True}, - 'sso_url': {'readonly': True}, - 'offer_detail': {'required': True}, - 'user_detail': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'organization_id': {'key': 'properties.organizationId', 'type': 'str'}, - 'sso_url': {'key': 'properties.ssoUrl', 'type': 'str'}, - 'offer_detail': {'key': 'properties.offerDetail', 'type': 'OfferDetail'}, - 'user_detail': {'key': 'properties.userDetail', 'type': 'UserDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(OrganizationResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - self.tags = kwargs.get('tags', None) - self.location = kwargs.get('location', None) - self.created_time = None - self.provisioning_state = None - self.organization_id = None - self.sso_url = None - self.offer_detail = kwargs['offer_detail'] - self.user_detail = kwargs['user_detail'] - - -class OrganizationResourceListResult(msrest.serialization.Model): - """The response of a list operation. - - :param value: Result of a list operation. - :type value: list[~azure.mgmt.confluent.models.OrganizationResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OrganizationResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OrganizationResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OrganizationResourceUpdate(msrest.serialization.Model): - """Organization Resource update. - - :param tags: A set of tags. ARM resource tags. - :type tags: dict[str, str] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(OrganizationResourceUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - - -class ResourceProviderDefaultErrorResponse(msrest.serialization.Model): - """Default error response for resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Response body of Error. - :vartype error: ~azure.mgmt.confluent.models.ErrorResponseBody - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorResponseBody'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderDefaultErrorResponse, self).__init__(**kwargs) - self.error = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.confluent.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.confluent.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class UserDetail(msrest.serialization.Model): - """Subscriber detail. - - All required parameters must be populated in order to send to Azure. - - :param first_name: First name. - :type first_name: str - :param last_name: Last name. - :type last_name: str - :param email_address: Required. Email address. - :type email_address: str - """ - - _validation = { - 'first_name': {'max_length': 50, 'min_length': 0}, - 'last_name': {'max_length': 50, 'min_length': 0}, - 'email_address': {'required': True, 'pattern': r'^\S+@\S+\.\S+$'}, - } - - _attribute_map = { - 'first_name': {'key': 'firstName', 'type': 'str'}, - 'last_name': {'key': 'lastName', 'type': 'str'}, - 'email_address': {'key': 'emailAddress', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserDetail, self).__init__(**kwargs) - self.first_name = kwargs.get('first_name', None) - self.last_name = kwargs.get('last_name', None) - self.email_address = kwargs['email_address'] diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/_models_py3.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/_models_py3.py index 7e5fef6d9e2f..ee42bcb85dce 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/_models_py3.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/models/_models_py3.py @@ -28,23 +28,23 @@ class ConfluentAgreementResource(msrest.serialization.Model): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.confluent.models.SystemData - :param publisher: Publisher identifier string. - :type publisher: str - :param product: Product identifier string. - :type product: str - :param plan: Plan identifier string. - :type plan: str - :param license_text_link: Link to HTML with Microsoft and Publisher terms. - :type license_text_link: str - :param privacy_policy_link: Link to the privacy policy of the publisher. - :type privacy_policy_link: str - :param retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty - if Accepted is false. - :type retrieve_datetime: ~datetime.datetime - :param signature: Terms signature. - :type signature: str - :param accepted: If any version of the terms have been accepted, otherwise false. - :type accepted: bool + :ivar publisher: Publisher identifier string. + :vartype publisher: str + :ivar product: Product identifier string. + :vartype product: str + :ivar plan: Plan identifier string. + :vartype plan: str + :ivar license_text_link: Link to HTML with Microsoft and Publisher terms. + :vartype license_text_link: str + :ivar privacy_policy_link: Link to the privacy policy of the publisher. + :vartype privacy_policy_link: str + :ivar retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty if + Accepted is false. + :vartype retrieve_datetime: ~datetime.datetime + :ivar signature: Terms signature. + :vartype signature: str + :ivar accepted: If any version of the terms have been accepted, otherwise false. + :vartype accepted: bool """ _validation = { @@ -82,6 +82,25 @@ def __init__( accepted: Optional[bool] = None, **kwargs ): + """ + :keyword publisher: Publisher identifier string. + :paramtype publisher: str + :keyword product: Product identifier string. + :paramtype product: str + :keyword plan: Plan identifier string. + :paramtype plan: str + :keyword license_text_link: Link to HTML with Microsoft and Publisher terms. + :paramtype license_text_link: str + :keyword privacy_policy_link: Link to the privacy policy of the publisher. + :paramtype privacy_policy_link: str + :keyword retrieve_datetime: Date and time in UTC of when the terms were accepted. This is empty + if Accepted is false. + :paramtype retrieve_datetime: ~datetime.datetime + :keyword signature: Terms signature. + :paramtype signature: str + :keyword accepted: If any version of the terms have been accepted, otherwise false. + :paramtype accepted: bool + """ super(ConfluentAgreementResource, self).__init__(**kwargs) self.id = None self.name = None @@ -100,10 +119,10 @@ def __init__( class ConfluentAgreementResourceListResponse(msrest.serialization.Model): """Response of a list operation. - :param value: Results of a list operation. - :type value: list[~azure.mgmt.confluent.models.ConfluentAgreementResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Results of a list operation. + :vartype value: list[~azure.mgmt.confluent.models.ConfluentAgreementResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -118,6 +137,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Results of a list operation. + :paramtype value: list[~azure.mgmt.confluent.models.ConfluentAgreementResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(ConfluentAgreementResourceListResponse, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -156,6 +181,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorResponseBody, self).__init__(**kwargs) self.code = None self.message = None @@ -166,22 +193,24 @@ def __init__( class OfferDetail(msrest.serialization.Model): """Confluent Offer detail. + 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. - :param publisher_id: Required. Publisher Id. - :type publisher_id: str - :param id: Required. Offer Id. - :type id: str - :param plan_id: Required. Offer Plan Id. - :type plan_id: str - :param plan_name: Required. Offer Plan Name. - :type plan_name: str - :param term_unit: Required. Offer Plan Term unit. - :type term_unit: str - :param status: SaaS Offer Status. Possible values include: "Started", - "PendingFulfillmentStart", "InProgress", "Subscribed", "Suspended", "Reinstated", "Succeeded", - "Failed", "Unsubscribed", "Updating". - :type status: str or ~azure.mgmt.confluent.models.SaaSOfferStatus + :ivar publisher_id: Required. Publisher Id. + :vartype publisher_id: str + :ivar id: Required. Offer Id. + :vartype id: str + :ivar plan_id: Required. Offer Plan Id. + :vartype plan_id: str + :ivar plan_name: Required. Offer Plan Name. + :vartype plan_name: str + :ivar term_unit: Required. Offer Plan Term unit. + :vartype term_unit: str + :ivar status: SaaS Offer Status. Possible values include: "Started", "PendingFulfillmentStart", + "InProgress", "Subscribed", "Suspended", "Reinstated", "Succeeded", "Failed", "Unsubscribed", + "Updating". + :vartype status: str or ~azure.mgmt.confluent.models.SaaSOfferStatus """ _validation = { @@ -190,6 +219,7 @@ class OfferDetail(msrest.serialization.Model): 'plan_id': {'required': True, 'max_length': 50, 'min_length': 0}, 'plan_name': {'required': True, 'max_length': 50, 'min_length': 0}, 'term_unit': {'required': True, 'max_length': 25, 'min_length': 0}, + 'status': {'readonly': True}, } _attribute_map = { @@ -209,29 +239,40 @@ def __init__( plan_id: str, plan_name: str, term_unit: str, - status: Optional[Union[str, "SaaSOfferStatus"]] = None, **kwargs ): + """ + :keyword publisher_id: Required. Publisher Id. + :paramtype publisher_id: str + :keyword id: Required. Offer Id. + :paramtype id: str + :keyword plan_id: Required. Offer Plan Id. + :paramtype plan_id: str + :keyword plan_name: Required. Offer Plan Name. + :paramtype plan_name: str + :keyword term_unit: Required. Offer Plan Term unit. + :paramtype term_unit: str + """ super(OfferDetail, self).__init__(**kwargs) self.publisher_id = publisher_id self.id = id self.plan_id = plan_id self.plan_name = plan_name self.term_unit = term_unit - self.status = status + self.status = None class OperationDisplay(msrest.serialization.Model): """The object that represents the operation. - :param provider: Service provider: Microsoft.Confluent. - :type provider: str - :param resource: Type on which the operation is performed, e.g., 'clusters'. - :type resource: str - :param operation: Operation type, e.g., read, write, delete, etc. - :type operation: str - :param description: Description of the operation, e.g., 'Write confluent'. - :type description: str + :ivar provider: Service provider: Microsoft.Confluent. + :vartype provider: str + :ivar resource: Type on which the operation is performed, e.g., 'clusters'. + :vartype resource: str + :ivar operation: Operation type, e.g., read, write, delete, etc. + :vartype operation: str + :ivar description: Description of the operation, e.g., 'Write confluent'. + :vartype description: str """ _attribute_map = { @@ -250,6 +291,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft.Confluent. + :paramtype provider: str + :keyword resource: Type on which the operation is performed, e.g., 'clusters'. + :paramtype resource: str + :keyword operation: Operation type, e.g., read, write, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation, e.g., 'Write confluent'. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -260,10 +311,10 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of GET request to list Confluent operations. - :param value: List of Confluent operations supported by the Microsoft.Confluent provider. - :type value: list[~azure.mgmt.confluent.models.OperationResult] - :param next_link: URL to get the next set of operation list results if there are any. - :type next_link: str + :ivar value: List of Confluent operations supported by the Microsoft.Confluent provider. + :vartype value: list[~azure.mgmt.confluent.models.OperationResult] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { @@ -278,6 +329,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of Confluent operations supported by the Microsoft.Confluent provider. + :paramtype value: list[~azure.mgmt.confluent.models.OperationResult] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -286,12 +343,12 @@ def __init__( class OperationResult(msrest.serialization.Model): """An Confluent REST API operation. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: The object that represents the operation. - :type display: ~azure.mgmt.confluent.models.OperationDisplay - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.confluent.models.OperationDisplay + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool """ _attribute_map = { @@ -308,6 +365,14 @@ def __init__( is_data_action: Optional[bool] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that represents the operation. + :paramtype display: ~azure.mgmt.confluent.models.OperationDisplay + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + """ super(OperationResult, self).__init__(**kwargs) self.name = name self.display = display @@ -329,10 +394,10 @@ class OrganizationResource(msrest.serialization.Model): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.confluent.models.SystemData - :param tags: A set of tags. Organization resource tags. - :type tags: dict[str, str] - :param location: Location of Organization resource. - :type location: str + :ivar tags: A set of tags. Organization resource tags. + :vartype tags: dict[str, str] + :ivar location: Location of Organization resource. + :vartype location: str :ivar created_time: The creation time of the resource. :vartype created_time: ~datetime.datetime :ivar provisioning_state: Provision states for confluent RP. Possible values include: @@ -343,10 +408,10 @@ class OrganizationResource(msrest.serialization.Model): :vartype organization_id: str :ivar sso_url: SSO url for the Confluent organization. :vartype sso_url: str - :param offer_detail: Required. Confluent offer detail. - :type offer_detail: ~azure.mgmt.confluent.models.OfferDetail - :param user_detail: Required. Subscriber detail. - :type user_detail: ~azure.mgmt.confluent.models.UserDetail + :ivar offer_detail: Required. Confluent offer detail. + :vartype offer_detail: ~azure.mgmt.confluent.models.OfferDetail + :ivar user_detail: Required. Subscriber detail. + :vartype user_detail: ~azure.mgmt.confluent.models.UserDetail """ _validation = { @@ -386,6 +451,16 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. Organization resource tags. + :paramtype tags: dict[str, str] + :keyword location: Location of Organization resource. + :paramtype location: str + :keyword offer_detail: Required. Confluent offer detail. + :paramtype offer_detail: ~azure.mgmt.confluent.models.OfferDetail + :keyword user_detail: Required. Subscriber detail. + :paramtype user_detail: ~azure.mgmt.confluent.models.UserDetail + """ super(OrganizationResource, self).__init__(**kwargs) self.id = None self.name = None @@ -404,10 +479,10 @@ def __init__( class OrganizationResourceListResult(msrest.serialization.Model): """The response of a list operation. - :param value: Result of a list operation. - :type value: list[~azure.mgmt.confluent.models.OrganizationResource] - :param next_link: Link to the next set of results, if any. - :type next_link: str + :ivar value: Result of a list operation. + :vartype value: list[~azure.mgmt.confluent.models.OrganizationResource] + :ivar next_link: Link to the next set of results, if any. + :vartype next_link: str """ _attribute_map = { @@ -422,6 +497,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Result of a list operation. + :paramtype value: list[~azure.mgmt.confluent.models.OrganizationResource] + :keyword next_link: Link to the next set of results, if any. + :paramtype next_link: str + """ super(OrganizationResourceListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -430,8 +511,8 @@ def __init__( class OrganizationResourceUpdate(msrest.serialization.Model): """Organization Resource update. - :param tags: A set of tags. ARM resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. ARM resource tags. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -444,6 +525,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. ARM resource tags. + :paramtype tags: dict[str, str] + """ super(OrganizationResourceUpdate, self).__init__(**kwargs) self.tags = tags @@ -469,6 +554,8 @@ def __init__( self, **kwargs ): + """ + """ super(ResourceProviderDefaultErrorResponse, self).__init__(**kwargs) self.error = None @@ -476,20 +563,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.confluent.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.confluent.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.confluent.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.confluent.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -512,6 +599,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.confluent.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.confluent.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -526,12 +629,12 @@ class UserDetail(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param first_name: First name. - :type first_name: str - :param last_name: Last name. - :type last_name: str - :param email_address: Required. Email address. - :type email_address: str + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str + :ivar email_address: Required. Email address. + :vartype email_address: str """ _validation = { @@ -554,6 +657,14 @@ def __init__( last_name: Optional[str] = None, **kwargs ): + """ + :keyword first_name: First name. + :paramtype first_name: str + :keyword last_name: Last name. + :paramtype last_name: str + :keyword email_address: Required. Email address. + :paramtype email_address: str + """ super(UserDetail, self).__init__(**kwargs) self.first_name = first_name self.last_name = last_name diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_marketplace_agreements_operations.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_marketplace_agreements_operations.py index dfc6bd650456..292c8acb1ff8 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_marketplace_agreements_operations.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_marketplace_agreements_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class MarketplaceAgreementsOperations(object): """MarketplaceAgreementsOperations operations. @@ -45,18 +119,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ConfluentAgreementResourceListResponse"] + **kwargs: Any + ) -> Iterable["_models.ConfluentAgreementResourceListResponse"]: """List Confluent marketplace agreements in the subscription. List Confluent marketplace agreements in the subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ConfluentAgreementResourceListResponse or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.confluent.models.ConfluentAgreementResourceListResponse] + :return: An iterator like instance of either ConfluentAgreementResourceListResponse or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.confluent.models.ConfluentAgreementResourceListResponse] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ConfluentAgreementResourceListResponse"] @@ -64,34 +140,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ConfluentAgreementResourceListResponse', pipeline_response) + deserialized = self._deserialize("ConfluentAgreementResourceListResponse", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -104,23 +175,24 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements'} # type: ignore + @distributed_trace def create( self, - body=None, # type: Optional["_models.ConfluentAgreementResource"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ConfluentAgreementResource" + body: Optional["_models.ConfluentAgreementResource"] = None, + **kwargs: Any + ) -> "_models.ConfluentAgreementResource": """Create Confluent Marketplace agreement in the subscription. Create Confluent Marketplace agreement in the subscription. @@ -137,39 +209,29 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'ConfluentAgreementResource') + _json = self._serialize.body(body, 'ConfluentAgreementResource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ConfluentAgreementResource', pipeline_response) @@ -178,4 +240,6 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/agreements/default'} # type: ignore + diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations.py index a0053b6b7bf2..45be88f2b576 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations.py @@ -5,25 +5,250 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + organization_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "organizationName": _SERIALIZER.url("organization_name", organization_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + organization_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "organizationName": _SERIALIZER.url("organization_name", organization_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + organization_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "organizationName": _SERIALIZER.url("organization_name", organization_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + organization_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "organizationName": _SERIALIZER.url("organization_name", organization_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OrganizationOperations(object): """OrganizationOperations operations. @@ -47,18 +272,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OrganizationResourceListResult"] + **kwargs: Any + ) -> Iterable["_models.OrganizationResourceListResult"]: """List all organizations under the specified subscription. List all organizations under the specified subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OrganizationResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult] + :return: An iterator like instance of either OrganizationResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResourceListResult"] @@ -66,34 +293,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OrganizationResourceListResult', pipeline_response) + deserialized = self._deserialize("OrganizationResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,23 +328,24 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Confluent/organizations'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OrganizationResourceListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.OrganizationResourceListResult"]: """List all Organizations under the specified resource group. List all Organizations under the specified resource group. @@ -130,8 +353,10 @@ def list_by_resource_group( :param resource_group_name: Resource group name. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either OrganizationResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult] + :return: An iterator like instance of either OrganizationResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.confluent.models.OrganizationResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResourceListResult"] @@ -139,35 +364,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OrganizationResourceListResult', pipeline_response) + deserialized = self._deserialize("OrganizationResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -180,24 +401,25 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - organization_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OrganizationResource" + resource_group_name: str, + organization_name: str, + **kwargs: Any + ) -> "_models.OrganizationResource": """Get the properties of a specific Organization resource. Get the properties of a specific Organization resource. @@ -216,33 +438,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + organization_name=organization_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OrganizationResource', pipeline_response) @@ -251,57 +463,47 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - organization_name, # type: str - body=None, # type: Optional["_models.OrganizationResource"] - **kwargs # type: Any - ): - # type: (...) -> "_models.OrganizationResource" + resource_group_name: str, + organization_name: str, + body: Optional["_models.OrganizationResource"] = None, + **kwargs: Any + ) -> "_models.OrganizationResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'OrganizationResource') + _json = self._serialize.body(body, 'OrganizationResource') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + organization_name=organization_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('OrganizationResource', pipeline_response) @@ -313,16 +515,18 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - organization_name, # type: str - body=None, # type: Optional["_models.OrganizationResource"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.OrganizationResource"] + resource_group_name: str, + organization_name: str, + body: Optional["_models.OrganizationResource"] = None, + **kwargs: Any + ) -> LROPoller["_models.OrganizationResource"]: """Create Organization resource. Create Organization resource. @@ -335,15 +539,19 @@ def begin_create( :type body: ~azure.mgmt.confluent.models.OrganizationResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either OrganizationResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either OrganizationResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.confluent.models.OrganizationResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.OrganizationResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -355,27 +563,21 @@ def begin_create( resource_group_name=resource_group_name, organization_name=organization_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('OrganizationResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -387,16 +589,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - organization_name, # type: str - body=None, # type: Optional["_models.OrganizationResourceUpdate"] - **kwargs # type: Any - ): - # type: (...) -> "_models.OrganizationResource" + resource_group_name: str, + organization_name: str, + body: Optional["_models.OrganizationResourceUpdate"] = None, + **kwargs: Any + ) -> "_models.OrganizationResource": """Update Organization resource. Update Organization resource. @@ -417,41 +620,31 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'OrganizationResourceUpdate') + _json = self._serialize.body(body, 'OrganizationResourceUpdate') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + organization_name=organization_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OrganizationResource', pipeline_response) @@ -460,61 +653,52 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - organization_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + organization_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + organization_name=organization_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - organization_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + organization_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete Organization resource. Delete Organization resource. @@ -525,15 +709,17 @@ def begin_delete( :type organization_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -547,21 +733,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -573,4 +752,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/organizations/{organizationName}'} # type: ignore diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations_operations.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations_operations.py index f12f9c422f69..7b75a014ce0b 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations_operations.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_organization_operations_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Confluent/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class OrganizationOperationsOperations(object): """OrganizationOperationsOperations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """List all operations provided by Microsoft.Confluent. List all operations provided by Microsoft.Confluent. @@ -64,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,12 +124,13 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_validations_operations.py b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_validations_operations.py index 3b57f3bad282..3abafcfb8f6f 100644 --- a/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_validations_operations.py +++ b/sdk/confluent/azure-mgmt-confluent/azure/mgmt/confluent/operations/_validations_operations.py @@ -5,22 +5,69 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_validate_organization_request( + subscription_id: str, + resource_group_name: str, + organization_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-12-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/validations/{organizationName}/orgvalidate') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "organizationName": _SERIALIZER.url("organization_name", organization_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ValidationsOperations(object): """ValidationsOperations operations. @@ -44,14 +91,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def validate_organization( self, - resource_group_name, # type: str - organization_name, # type: str - body, # type: "_models.OrganizationResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.OrganizationResource" + resource_group_name: str, + organization_name: str, + body: "_models.OrganizationResource", + **kwargs: Any + ) -> "_models.OrganizationResource": """Organization Validate proxy resource. Organization Validate proxy resource. @@ -72,38 +119,28 @@ def validate_organization( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.validate_organization.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'organizationName': self._serialize.url("organization_name", organization_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'OrganizationResource') + + request = build_validate_organization_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + organization_name=organization_name, + content_type=content_type, + json=_json, + template_url=self.validate_organization.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'OrganizationResource') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ResourceProviderDefaultErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OrganizationResource', pipeline_response) @@ -112,4 +149,6 @@ def validate_organization( return cls(pipeline_response, deserialized, {}) return deserialized + validate_organization.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Confluent/validations/{organizationName}/orgvalidate'} # type: ignore +