diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/_meta.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/_meta.json index c8e12dd7279b..ac3c29c0c7b6 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/_meta.json +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "a136560c0771653154bace4384bdf45e0edcbb14", + "commit": "e8c6db17dc13a00155936dcaeacf4da0a1fabf77", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/kubernetesconfiguration/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/kubernetesconfiguration/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/kubernetesconfiguration/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_configuration.py index 6ecda0480c45..6cd5f3b0fb03 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_configuration.py @@ -12,7 +12,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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -68,4 +68,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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_source_control_configuration_client.py index 1743fa49f4db..6a524aa0ac02 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/_source_control_configuration_client.py @@ -23,7 +23,6 @@ from typing import Any, Optional from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse class _SDKClient(object): def __init__(self, *args, **kwargs): @@ -71,12 +70,10 @@ def __init__( credential, # type: "TokenCredential" subscription_id, # type: str api_version=None, # type: Optional[str] - base_url=None, # type: Optional[str] + base_url="https://management.azure.com", # type: str profile=KnownProfiles.default, # type: KnownProfiles **kwargs # type: Any ): - if not base_url: - base_url = 'https://management.azure.com' self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(SourceControlConfigurationClient, self).__init__( diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_configuration.py index e86e06bef71f..dfeb48eb057d 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_configuration.py @@ -12,7 +12,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 @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_source_control_configuration_client.py index 97f3e6688eb2..b7ab834d41ad 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/aio/_source_control_configuration_client.py @@ -11,7 +11,6 @@ from typing import Any, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -21,6 +20,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential from azure.core.credentials_async import AsyncTokenCredential class _SDKClient(object): @@ -69,12 +69,10 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", profile: KnownProfiles = KnownProfiles.default, **kwargs # type: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' self._config = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) super(SourceControlConfigurationClient, self).__init__( diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/__init__.py index f13062376d74..e90963036337 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_configuration.py index 89bdc90391da..a175e772c245 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_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,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(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(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_metadata.json index 8be176553db0..b34a4cb64d8e 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_metadata.json +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "SourceControlConfigurationClient", "filename": "_source_control_configuration_client", "description": "KubernetesConfiguration Client.", - "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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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": { "source_control_configurations": "SourceControlConfigurationsOperations", diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_source_control_configuration_client.py index 71f3974f3334..4a2066e60af2 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_source_control_configuration_client.py @@ -6,84 +6,88 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import ExtensionsOperations, Operations, SourceControlConfigurationsOperations + 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 SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from .operations import ExtensionsOperations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.Operations :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.operations.ExtensionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(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.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_version.py index c47f66669f1b..59deb8c7263b 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_version.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0" diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/__init__.py index ba52c91a7ba1..5f583276b4ed 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_configuration.py index e15dc551cae7..5d42c644d800 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/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,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_source_control_configuration_client.py index a03dc102973a..786354552c09 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/_source_control_configuration_client.py @@ -6,80 +6,88 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import ExtensionsOperations, Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from .operations import ExtensionsOperations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.Operations :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.aio.operations.ExtensionsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(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.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_extensions_operations.py index e92980035ad5..2cb12620a0e1 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_extensions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_extensions_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, 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.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._extensions_operations import build_create_request, build_delete_request, build_get_request, build_list_request, build_update_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_async async def create( self, resource_group_name: str, @@ -60,13 +66,15 @@ async def create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. :type extension_instance_name: str :param extension_instance: Properties necessary to Create an Extension Instance. - :type extension_instance: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance + :type extension_instance: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance :keyword callable cls: A custom type or function that will be passed the direct response :return: ExtensionInstance, or the result of cls(response) :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance @@ -77,41 +85,31 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_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(extension_instance, 'ExtensionInstance') - # 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_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_name, + content_type=content_type, + json=_json, + template_url=self.create.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(extension_instance, 'ExtensionInstance') - body_content_kwargs['content'] = body_content - request = self._client.put(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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionInstance', pipeline_response) @@ -120,8 +118,11 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -140,7 +141,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. @@ -155,36 +157,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionInstance', pipeline_response) @@ -193,8 +185,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -214,13 +209,15 @@ async def update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. :type extension_instance_name: str :param extension_instance: Properties to Update in the Extension Instance. - :type extension_instance: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate + :type extension_instance: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: ExtensionInstance, or the result of cls(response) :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance @@ -231,41 +228,31 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_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(extension_instance, 'ExtensionInstanceUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_instance, 'ExtensionInstanceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionInstance', pipeline_response) @@ -274,8 +261,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace_async async def delete( self, resource_group_name: str, @@ -295,7 +285,8 @@ async def delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. @@ -310,36 +301,26 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_name, + template_url=self.delete.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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -347,6 +328,8 @@ async def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -364,12 +347,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionInstancesList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstancesList] + :return: An iterator like instance of either ExtensionInstancesList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstancesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionInstancesList"] @@ -377,38 +363,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionInstancesList', pipeline_response) + deserialized = self._deserialize("ExtensionInstancesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -421,12 +406,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_operations.py index b9e2205f961a..15d34648a9cd 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/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._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 @@ -48,8 +54,10 @@ def list( """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_source_control_configurations_operations.py index 116ecb3713ec..540d16d33ae4 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_source_control_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/aio/operations/_source_control_configurations_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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_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_async async def get( self, resource_group_name: str, @@ -61,14 +67,16 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -76,36 +84,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -114,8 +112,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -135,16 +136,19 @@ async def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -152,41 +156,31 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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(source_control_configuration, 'SourceControlConfiguration') - # 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_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.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(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,8 +193,10 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -215,43 +211,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -271,22 +258,25 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_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', @@ -303,24 +293,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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,8 +312,10 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -351,12 +333,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -364,38 +349,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -408,12 +392,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/__init__.py index 5d3f8aea197e..70c78dcb2d46 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/__init__.py @@ -6,50 +6,28 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ComplianceStatus - from ._models_py3 import ConfigurationIdentity - from ._models_py3 import ErrorDefinition - from ._models_py3 import ErrorResponse - from ._models_py3 import ExtensionInstance - from ._models_py3 import ExtensionInstanceUpdate - from ._models_py3 import ExtensionInstancesList - from ._models_py3 import ExtensionStatus - from ._models_py3 import HelmOperatorProperties - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Result - from ._models_py3 import Scope - from ._models_py3 import ScopeCluster - from ._models_py3 import ScopeNamespace - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import ComplianceStatus # type: ignore - from ._models import ConfigurationIdentity # type: ignore - from ._models import ErrorDefinition # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import ExtensionInstance # type: ignore - from ._models import ExtensionInstanceUpdate # type: ignore - from ._models import ExtensionInstancesList # type: ignore - from ._models import ExtensionStatus # type: ignore - from ._models import HelmOperatorProperties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Result # type: ignore - from ._models import Scope # type: ignore - from ._models import ScopeCluster # type: ignore - from ._models import ScopeNamespace # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import ComplianceStatus +from ._models_py3 import ConfigurationIdentity +from ._models_py3 import ErrorDefinition +from ._models_py3 import ErrorResponse +from ._models_py3 import ExtensionInstance +from ._models_py3 import ExtensionInstanceUpdate +from ._models_py3 import ExtensionInstancesList +from ._models_py3 import ExtensionStatus +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Result +from ._models_py3 import Scope +from ._models_py3 import ScopeCluster +from ._models_py3 import ScopeNamespace +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( ComplianceStateType, diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_models.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_models.py deleted file mode 100644 index ef31b453ddc7..000000000000 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_models.py +++ /dev/null @@ -1,817 +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 ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.MessageLevelType - """ - - _validation = { - 'compliance_state': {'readonly': True}, - } - - _attribute_map = { - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'message_level': {'key': 'messageLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class ConfigurationIdentity(msrest.serialization.Model): - """Identity for the managed cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of the system assigned identity which is used by the - configuration. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the system assigned identity which is used by the - configuration. - :vartype tenant_id: str - :param type: The type of identity used for the configuration. Type 'SystemAssigned' will use an - implicitly created identity. Type 'None' will not use Managed Identity for the configuration. - Possible values include: "SystemAssigned", "None". - :type type: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceIdentityType - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ConfigurationIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class ErrorDefinition(msrest.serialization.Model): - """Error definition. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. Service specific error code which serves as the substatus for the HTTP - error code. - :type code: str - :param message: Required. Description of the error. - :type message: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDefinition, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - - -class ErrorResponse(msrest.serialization.Model): - """Error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Error definition. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ErrorDefinition - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = None - - -class Resource(msrest.serialization.Model): - """The Resource model definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = kwargs.get('system_data', None) - - -class ProxyResource(Resource): - """ARM proxy resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ExtensionInstance(ProxyResource): - """The Extension Instance object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the - Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this instance participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension instance participates in for auto-upgrade - (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension instance, if it is 'pinned' to a - specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension instance is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - instance of the extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this instance of the extension. - :type configuration_protected_settings: dict[str, str] - :ivar install_state: Status of installation of this instance of the extension. Possible values - include: "Pending", "Installed", "Failed". - :vartype install_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.InstallStateType - :param statuses: Status from this instance of the extension. - :type statuses: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionStatus] - :ivar creation_time: DateLiteral (per ISO8601) noting the time the resource was created by the - client (user). - :vartype creation_time: str - :ivar last_modified_time: DateLiteral (per ISO8601) noting the time the resource was modified - by the client (user). - :vartype last_modified_time: str - :ivar last_status_time: DateLiteral (per ISO8601) noting the time of last status from the - agent. - :vartype last_status_time: str - :ivar error_info: Error information from the Agent - e.g. errors during installation. - :vartype error_info: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ErrorDefinition - :param identity: The identity of the configuration. - :type identity: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ConfigurationIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'install_state': {'readonly': True}, - 'creation_time': {'readonly': True}, - 'last_modified_time': {'readonly': True}, - 'last_status_time': {'readonly': True}, - 'error_info': {'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'}, - 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'Scope'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'install_state': {'key': 'properties.installState', 'type': 'str'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, - 'creation_time': {'key': 'properties.creationTime', 'type': 'str'}, - 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'str'}, - 'last_status_time': {'key': 'properties.lastStatusTime', 'type': 'str'}, - 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDefinition'}, - 'identity': {'key': 'properties.identity', 'type': 'ConfigurationIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionInstance, self).__init__(**kwargs) - self.extension_type = kwargs.get('extension_type', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.scope = kwargs.get('scope', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.install_state = None - self.statuses = kwargs.get('statuses', None) - self.creation_time = None - self.last_modified_time = None - self.last_status_time = None - self.error_info = None - self.identity = kwargs.get('identity', None) - - -class ExtensionInstancesList(msrest.serialization.Model): - """Result of the request to list Extension Instances. It contains a list of ExtensionInstance objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Extension Instances within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance] - :ivar next_link: URL to get the next set of extension instance objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtensionInstance]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionInstancesList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExtensionInstanceUpdate(msrest.serialization.Model): - """Update Extension Instance request object. - - :param auto_upgrade_minor_version: Flag to note if this instance participates in Extension - Lifecycle Management or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension instance participates in for auto-upgrade - (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version number of extension, to 'pin' to a specific version. - autoUpgradeMinorVersion must be 'false'. - :type version: str - """ - - _attribute_map = { - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionInstanceUpdate, self).__init__(**kwargs) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - - -class ExtensionStatus(msrest.serialization.Model): - """Status from this instance of the extension. - - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of this instance of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". - Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension instance. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionStatus, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.display_status = kwargs.get('display_status', None) - self.level = kwargs.get('level', "Information") - self.message = kwargs.get('message', None) - self.time = kwargs.get('time', None) - - -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. - - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str - """ - - _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationDisplay - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - """ - - _validation = { - 'is_data_action': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :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(ResourceProviderOperationDisplay, 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 ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Result(msrest.serialization.Model): - """Sample result definition. - - :param sample_property: Sample property of type string. - :type sample_property: str - """ - - _attribute_map = { - 'sample_property': {'key': 'sampleProperty', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Result, self).__init__(**kwargs) - self.sample_property = kwargs.get('sample_property', None) - - -class Scope(msrest.serialization.Model): - """Scope of the extensionInstance. It can be either Cluster or Namespace; but not both. - - :param cluster: Specifies that the scope of the extensionInstance is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extensionInstance is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeNamespace - """ - - _attribute_map = { - 'cluster': {'key': 'cluster', 'type': 'ScopeCluster'}, - 'namespace': {'key': 'namespace', 'type': 'ScopeNamespace'}, - } - - def __init__( - self, - **kwargs - ): - super(Scope, self).__init__(**kwargs) - self.cluster = kwargs.get('cluster', None) - self.namespace = kwargs.get('namespace', None) - - -class ScopeCluster(msrest.serialization.Model): - """Specifies that the scope of the extensionInstance is Cluster. - - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster - scoped extensionInstance. If this namespace does not exist, it will be created. - :type release_namespace: str - """ - - _attribute_map = { - 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeCluster, self).__init__(**kwargs) - self.release_namespace = kwargs.get('release_namespace', None) - - -class ScopeNamespace(msrest.serialization.Model): - """Specifies that the scope of the extensionInstance is Namespace. - - :param target_namespace: Namespace where the extensionInstance will be created for an Namespace - scoped extensionInstance. If this namespace does not exist, it will be created. - :type target_namespace: str - """ - - _attribute_map = { - 'target_namespace': {'key': 'targetNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeNamespace, self).__init__(**kwargs) - self.target_namespace = kwargs.get('target_namespace', None) - - -class SourceControlConfiguration(ProxyResource): - """The SourceControl Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorScopeType - :ivar repository_public_key: Public Key associated with this SourceControl configuration - (either generated within the cluster or provided by the user). - :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'compliance_status': {'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'}, - 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, - 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, - 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, - 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, - 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, - 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, - 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.serialization.Model): - """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Source Control Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SystemData(msrest.serialization.Model): - """Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar created_by: A string identifier for the identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource: user, application, - managedIdentity, key. - :vartype created_by_type: str - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: A string identifier for 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: user, - application, managedIdentity, key. - :vartype last_modified_by_type: str - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _validation = { - 'created_by': {'readonly': True}, - 'created_by_type': {'readonly': True}, - 'created_at': {'readonly': True}, - 'last_modified_by': {'readonly': True}, - 'last_modified_by_type': {'readonly': True}, - 'last_modified_at': {'readonly': True}, - } - - _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 = None - self.created_by_type = None - self.created_at = None - self.last_modified_by = None - self.last_modified_by_type = None - self.last_modified_at = None diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_models_py3.py index 7d8c10c5306e..d28c93715ed6 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_models_py3.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_models_py3.py @@ -24,13 +24,13 @@ class ComplianceStatus(msrest.serialization.Model): "Pending", "Compliant", "Noncompliant", "Installed", "Failed". :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", "Information". - :type message_level: str or + :vartype message_level: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.MessageLevelType """ @@ -53,6 +53,16 @@ def __init__( message_level: Optional[Union[str, "MessageLevelType"]] = None, **kwargs ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.MessageLevelType + """ super(ComplianceStatus, self).__init__(**kwargs) self.compliance_state = None self.last_config_applied = last_config_applied @@ -71,10 +81,10 @@ class ConfigurationIdentity(msrest.serialization.Model): :ivar tenant_id: The tenant id of the system assigned identity which is used by the configuration. :vartype tenant_id: str - :param type: The type of identity used for the configuration. Type 'SystemAssigned' will use an + :ivar type: The type of identity used for the configuration. Type 'SystemAssigned' will use an implicitly created identity. Type 'None' will not use Managed Identity for the configuration. Possible values include: "SystemAssigned", "None". - :type type: str or + :vartype type: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceIdentityType """ @@ -95,6 +105,13 @@ def __init__( type: Optional[Union[str, "ResourceIdentityType"]] = None, **kwargs ): + """ + :keyword type: The type of identity used for the configuration. Type 'SystemAssigned' will use + an implicitly created identity. Type 'None' will not use Managed Identity for the + configuration. Possible values include: "SystemAssigned", "None". + :paramtype type: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceIdentityType + """ super(ConfigurationIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -106,11 +123,11 @@ class ErrorDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. Service specific error code which serves as the substatus for the HTTP + :ivar code: Required. Service specific error code which serves as the substatus for the HTTP error code. - :type code: str - :param message: Required. Description of the error. - :type message: str + :vartype code: str + :ivar message: Required. Description of the error. + :vartype message: str """ _validation = { @@ -130,6 +147,13 @@ def __init__( message: str, **kwargs ): + """ + :keyword code: Required. Service specific error code which serves as the substatus for the HTTP + error code. + :paramtype code: str + :keyword message: Required. Description of the error. + :paramtype message: str + """ super(ErrorDefinition, self).__init__(**kwargs) self.code = code self.message = message @@ -156,6 +180,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorResponse, self).__init__(**kwargs) self.error = None @@ -171,9 +197,9 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData """ _validation = { @@ -195,6 +221,12 @@ def __init__( system_data: Optional["SystemData"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -213,9 +245,9 @@ class ProxyResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData """ _validation = { @@ -237,6 +269,12 @@ def __init__( system_data: Optional["SystemData"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + """ super(ProxyResource, self).__init__(system_data=system_data, **kwargs) @@ -251,36 +289,36 @@ class ExtensionInstance(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :ivar extension_type: Type of the Extension, of which this resource is an instance of. It must + be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this instance participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension instance participates in for auto-upgrade + :vartype extension_type: str + :ivar auto_upgrade_minor_version: Flag to note if this instance participates in auto upgrade of + minor version, or not. + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension instance participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension instance, if it is 'pinned' to a + :vartype release_train: str + :ivar version: Version of the extension for this extension instance, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension instance is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar scope: Scope at which the extension instance is installed. + :vartype scope: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Scope + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this instance of the extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this instance of the extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] :ivar install_state: Status of installation of this instance of the extension. Possible values include: "Pending", "Installed", "Failed". :vartype install_state: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.InstallStateType - :param statuses: Status from this instance of the extension. - :type statuses: + :ivar statuses: Status from this instance of the extension. + :vartype statuses: list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionStatus] :ivar creation_time: DateLiteral (per ISO8601) noting the time the resource was created by the client (user). @@ -294,8 +332,8 @@ class ExtensionInstance(ProxyResource): :ivar error_info: Error information from the Agent - e.g. errors during installation. :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ErrorDefinition - :param identity: The identity of the configuration. - :type identity: + :ivar identity: The identity of the configuration. + :vartype identity: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ConfigurationIdentity """ @@ -346,6 +384,39 @@ def __init__( identity: Optional["ConfigurationIdentity"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :keyword extension_type: Type of the Extension, of which this resource is an instance of. It + must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :paramtype extension_type: str + :keyword auto_upgrade_minor_version: Flag to note if this instance participates in auto upgrade + of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension instance participates in for auto-upgrade + (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension instance, if it is 'pinned' to a + specific version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword scope: Scope at which the extension instance is installed. + :paramtype scope: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Scope + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this instance of the extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this instance of the extension. + :paramtype configuration_protected_settings: dict[str, str] + :keyword statuses: Status from this instance of the extension. + :paramtype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionStatus] + :keyword identity: The identity of the configuration. + :paramtype identity: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ConfigurationIdentity + """ super(ExtensionInstance, self).__init__(system_data=system_data, **kwargs) self.extension_type = extension_type self.auto_upgrade_minor_version = auto_upgrade_minor_version @@ -389,6 +460,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionInstancesList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -397,15 +470,15 @@ def __init__( class ExtensionInstanceUpdate(msrest.serialization.Model): """Update Extension Instance request object. - :param auto_upgrade_minor_version: Flag to note if this instance participates in Extension + :ivar auto_upgrade_minor_version: Flag to note if this instance participates in Extension Lifecycle Management or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension instance participates in for auto-upgrade + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension instance participates in for auto-upgrade (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version number of extension, to 'pin' to a specific version. + :vartype release_train: str + :ivar version: Version number of extension, to 'pin' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str + :vartype version: str """ _attribute_map = { @@ -422,6 +495,17 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword auto_upgrade_minor_version: Flag to note if this instance participates in Extension + Lifecycle Management or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension instance participates in for auto-upgrade + (e.g. Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version number of extension, to 'pin' to a specific version. + autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + """ super(ExtensionInstanceUpdate, self).__init__(**kwargs) self.auto_upgrade_minor_version = auto_upgrade_minor_version self.release_train = release_train @@ -431,17 +515,17 @@ def __init__( class ExtensionStatus(msrest.serialization.Model): """Status from this instance of the extension. - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of this instance of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". + :ivar code: Status code provided by the Extension. + :vartype code: str + :ivar display_status: Short description of status of this instance of the extension. + :vartype display_status: str + :ivar level: Level of the status. Possible values include: "Error", "Warning", "Information". Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension instance. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str + :vartype level: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.LevelType + :ivar message: Detailed message of the status from the Extension instance. + :vartype message: str + :ivar time: DateLiteral (per ISO8601) noting the time of installation status. + :vartype time: str """ _attribute_map = { @@ -462,6 +546,20 @@ def __init__( time: Optional[str] = None, **kwargs ): + """ + :keyword code: Status code provided by the Extension. + :paramtype code: str + :keyword display_status: Short description of status of this instance of the extension. + :paramtype display_status: str + :keyword level: Level of the status. Possible values include: "Error", "Warning", + "Information". Default value: "Information". + :paramtype level: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.LevelType + :keyword message: Detailed message of the status from the Extension instance. + :paramtype message: str + :keyword time: DateLiteral (per ISO8601) noting the time of installation status. + :paramtype time: str + """ super(ExtensionStatus, self).__init__(**kwargs) self.code = code self.display_status = display_status @@ -473,10 +571,10 @@ def __init__( class HelmOperatorProperties(msrest.serialization.Model): """Properties for Helm operator. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str """ _attribute_map = { @@ -491,6 +589,12 @@ def __init__( chart_values: Optional[str] = None, **kwargs ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ super(HelmOperatorProperties, self).__init__(**kwargs) self.chart_version = chart_version self.chart_values = chart_values @@ -501,10 +605,10 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationDisplay :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool @@ -527,6 +631,13 @@ def __init__( display: Optional["ResourceProviderOperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationDisplay + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -536,14 +647,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -562,6 +673,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -574,8 +695,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -596,6 +717,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -604,8 +730,8 @@ def __init__( class Result(msrest.serialization.Model): """Sample result definition. - :param sample_property: Sample property of type string. - :type sample_property: str + :ivar sample_property: Sample property of type string. + :vartype sample_property: str """ _attribute_map = { @@ -618,6 +744,10 @@ def __init__( sample_property: Optional[str] = None, **kwargs ): + """ + :keyword sample_property: Sample property of type string. + :paramtype sample_property: str + """ super(Result, self).__init__(**kwargs) self.sample_property = sample_property @@ -625,10 +755,11 @@ def __init__( class Scope(msrest.serialization.Model): """Scope of the extensionInstance. It can be either Cluster or Namespace; but not both. - :param cluster: Specifies that the scope of the extensionInstance is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extensionInstance is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeNamespace + :ivar cluster: Specifies that the scope of the extensionInstance is Cluster. + :vartype cluster: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeCluster + :ivar namespace: Specifies that the scope of the extensionInstance is Namespace. + :vartype namespace: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeNamespace """ _attribute_map = { @@ -643,6 +774,13 @@ def __init__( namespace: Optional["ScopeNamespace"] = None, **kwargs ): + """ + :keyword cluster: Specifies that the scope of the extensionInstance is Cluster. + :paramtype cluster: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeCluster + :keyword namespace: Specifies that the scope of the extensionInstance is Namespace. + :paramtype namespace: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ScopeNamespace + """ super(Scope, self).__init__(**kwargs) self.cluster = cluster self.namespace = namespace @@ -651,9 +789,9 @@ def __init__( class ScopeCluster(msrest.serialization.Model): """Specifies that the scope of the extensionInstance is Cluster. - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster + :ivar release_namespace: Namespace where the extension Release must be placed, for a Cluster scoped extensionInstance. If this namespace does not exist, it will be created. - :type release_namespace: str + :vartype release_namespace: str """ _attribute_map = { @@ -666,6 +804,11 @@ def __init__( release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extensionInstance. If this namespace does not exist, it will be created. + :paramtype release_namespace: str + """ super(ScopeCluster, self).__init__(**kwargs) self.release_namespace = release_namespace @@ -673,9 +816,9 @@ def __init__( class ScopeNamespace(msrest.serialization.Model): """Specifies that the scope of the extensionInstance is Namespace. - :param target_namespace: Namespace where the extensionInstance will be created for an Namespace + :ivar target_namespace: Namespace where the extensionInstance will be created for an Namespace scoped extensionInstance. If this namespace does not exist, it will be created. - :type target_namespace: str + :vartype target_namespace: str """ _attribute_map = { @@ -688,6 +831,11 @@ def __init__( target_namespace: Optional[str] = None, **kwargs ): + """ + :keyword target_namespace: Namespace where the extensionInstance will be created for an + Namespace scoped extensionInstance. If this namespace does not exist, it will be created. + :paramtype target_namespace: str + """ super(ScopeNamespace, self).__init__(**kwargs) self.target_namespace = target_namespace @@ -703,39 +851,39 @@ class SourceControlConfiguration(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or + :vartype operator_scope: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorScopeType :ivar repository_public_key: Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.HelmOperatorProperties :ivar provisioning_state: The provisioning state of the resource provider. Possible values include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". @@ -791,6 +939,40 @@ def __init__( helm_operator_properties: Optional["HelmOperatorProperties"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SystemData + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.HelmOperatorProperties + """ super(SourceControlConfiguration, self).__init__(system_data=system_data, **kwargs) self.repository_url = repository_url self.operator_namespace = operator_namespace @@ -833,6 +1015,8 @@ def __init__( self, **kwargs ): + """ + """ super(SourceControlConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -881,6 +1065,8 @@ def __init__( self, **kwargs ): + """ + """ super(SystemData, self).__init__(**kwargs) self.created_by = None self.created_by_type = None diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_source_control_configuration_client_enums.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_source_control_configuration_client_enums.py index 825cfccadd18..bae6382fbce5 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_source_control_configuration_client_enums.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/models/_source_control_configuration_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 ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compliance state of the configuration. """ @@ -36,17 +21,17 @@ class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class InstallStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InstallStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of installation of this instance of the extension. """ @@ -54,7 +39,7 @@ class InstallStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the status. """ @@ -62,7 +47,7 @@ class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the message. """ @@ -70,20 +55,20 @@ class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the operator will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the operator """ FLUX = "Flux" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource provider. """ @@ -93,7 +78,7 @@ class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) SUCCEEDED = "Succeeded" FAILED = "Failed" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity used for the configuration. Type 'SystemAssigned' will use an implicitly created identity. Type 'None' will not use Managed Identity for the configuration. """ diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_extensions_operations.py index c3e2b0cf5f46..f0a15e102ca4 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_extensions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_extensions_operations.py @@ -5,23 +5,247 @@ # 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.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, 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_create_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionInstanceName": _SERIALIZER.url("extension_instance_name", extension_instance_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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionInstanceName": _SERIALIZER.url("extension_instance_name", extension_instance_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_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionInstanceName": _SERIALIZER.url("extension_instance_name", extension_instance_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( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionInstanceName": _SERIALIZER.url("extension_instance_name", extension_instance_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 + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class ExtensionsOperations(object): """ExtensionsOperations operations. @@ -45,17 +269,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_instance_name, # type: str - extension_instance, # type: "_models.ExtensionInstance" - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionInstance" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + extension_instance: "_models.ExtensionInstance", + **kwargs: Any + ) -> "_models.ExtensionInstance": """Create a new Kubernetes Cluster Extension Instance. :param resource_group_name: The name of the resource group. @@ -65,13 +289,15 @@ def create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. :type extension_instance_name: str :param extension_instance: Properties necessary to Create an Extension Instance. - :type extension_instance: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance + :type extension_instance: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance :keyword callable cls: A custom type or function that will be passed the direct response :return: ExtensionInstance, or the result of cls(response) :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance @@ -82,41 +308,31 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_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(extension_instance, 'ExtensionInstance') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_name, + content_type=content_type, + json=_json, + template_url=self.create.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(extension_instance, 'ExtensionInstance') - body_content_kwargs['content'] = body_content - request = self._client.put(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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionInstance', pipeline_response) @@ -125,18 +341,20 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionInstance" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + **kwargs: Any + ) -> "_models.ExtensionInstance": """Gets details of the Kubernetes Cluster Extension Instance. :param resource_group_name: The name of the resource group. @@ -146,7 +364,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. @@ -161,36 +380,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionInstance', pipeline_response) @@ -199,19 +408,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_instance_name, # type: str - extension_instance, # type: "_models.ExtensionInstanceUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionInstance" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + extension_instance: "_models.ExtensionInstanceUpdate", + **kwargs: Any + ) -> "_models.ExtensionInstance": """Update an existing Kubernetes Cluster Extension Instance. :param resource_group_name: The name of the resource group. @@ -221,13 +432,15 @@ def update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. :type extension_instance_name: str :param extension_instance: Properties to Update in the Extension Instance. - :type extension_instance: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate + :type extension_instance: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstanceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :return: ExtensionInstance, or the result of cls(response) :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstance @@ -238,41 +451,31 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_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(extension_instance, 'ExtensionInstanceUpdate') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension_instance, 'ExtensionInstanceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionInstance', pipeline_response) @@ -281,18 +484,20 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace def delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_instance_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_instance_name: str, + **kwargs: Any + ) -> None: """Delete a Kubernetes Cluster Extension Instance. This will cause the Agent to Uninstall the extension instance from the cluster. @@ -303,7 +508,8 @@ def delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_instance_name: Name of an instance of the Extension. @@ -318,36 +524,26 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - accept = "application/json" - - # Construct URL - url = self.delete.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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionInstanceName': self._serialize.url("extension_instance_name", extension_instance_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( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_instance_name=extension_instance_name, + template_url=self.delete.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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: @@ -355,15 +551,16 @@ def delete( delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionInstanceName}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionInstancesList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionInstancesList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. @@ -373,12 +570,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionInstancesList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstancesList] + :return: An iterator like instance of either ExtensionInstancesList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ExtensionInstancesList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionInstancesList"] @@ -386,38 +586,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionInstancesList', pipeline_response) + deserialized = self._deserialize("ExtensionInstancesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -430,12 +629,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_operations.py index 1fe1fbf39b15..3e405e2ae48f 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/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 = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/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 Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_source_control_configurations_operations.py index d192efa6d03c..3a8636804488 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_source_control_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_07_01_preview/operations/_source_control_configurations_operations.py @@ -5,25 +5,199 @@ # 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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 + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-07-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class SourceControlConfigurationsOperations(object): """SourceControlConfigurationsOperations operations. @@ -47,16 +221,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Gets details of the Source Control Configuration. :param resource_group_name: The name of the resource group. @@ -66,14 +240,16 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -81,36 +257,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -119,19 +285,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - source_control_configuration, # type: "_models.SourceControlConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Create a new Kubernetes Source Control Configuration. :param resource_group_name: The name of the resource group. @@ -141,16 +309,19 @@ def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -158,41 +329,31 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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(source_control_configuration, 'SourceControlConfiguration') - # 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_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.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(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,70 +366,61 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_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 = "2020-07-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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. @@ -279,22 +431,25 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_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', @@ -311,24 +466,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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,17 +485,18 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SourceControlConfigurationList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. @@ -360,12 +506,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_07_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -373,38 +522,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-07-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -417,12 +565,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/__init__.py index f13062376d74..e90963036337 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_configuration.py index d5969e532126..7167f9bec314 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_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,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(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(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_metadata.json index b22880502983..3ad8203a6e50 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_metadata.json +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "SourceControlConfigurationClient", "filename": "_source_control_configuration_client", "description": "KubernetesConfiguration Client.", - "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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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": { "source_control_configurations": "SourceControlConfigurationsOperations", diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_source_control_configuration_client.py index c079c472da69..435ce16a3a2f 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_source_control_configuration_client.py @@ -6,79 +6,84 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import Operations, SourceControlConfigurationsOperations + 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 SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(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.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_version.py index c47f66669f1b..59deb8c7263b 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_version.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0" diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/__init__.py index ba52c91a7ba1..5f583276b4ed 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_configuration.py index 8002c1a9fbc3..2ea6b77035b0 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/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,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_source_control_configuration_client.py index 1e3021bd71a0..24c6800aa80f 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/_source_control_configuration_client.py @@ -6,75 +6,84 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.aio.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.aio.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.aio.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(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.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_operations.py index 3f70e7e1e81d..d10b2c945f21 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/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._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 @@ -48,8 +54,10 @@ def list( """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_source_control_configurations_operations.py index 52063acf78e4..1ff137c7cc06 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_source_control_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/aio/operations/_source_control_configurations_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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_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_async async def get( self, resource_group_name: str, @@ -61,14 +67,16 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -76,36 +84,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -114,8 +112,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -135,16 +136,19 @@ async def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -152,41 +156,31 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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(source_control_configuration, 'SourceControlConfiguration') - # 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_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.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(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,8 +193,10 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -215,43 +211,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -271,22 +258,25 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_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', @@ -303,24 +293,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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,8 +312,10 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -351,12 +333,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -364,38 +349,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -408,12 +392,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/__init__.py index b1e23c9e1d7a..f851a5fd8064 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/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 ComplianceStatus - from ._models_py3 import ErrorDefinition - from ._models_py3 import ErrorResponse - from ._models_py3 import HelmOperatorProperties - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Result - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import ComplianceStatus # type: ignore - from ._models import ErrorDefinition # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import HelmOperatorProperties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Result # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import ComplianceStatus +from ._models_py3 import ErrorDefinition +from ._models_py3 import ErrorResponse +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Result +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( ComplianceStateType, diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_models.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_models.py deleted file mode 100644 index 12ebfd16f6df..000000000000 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_models.py +++ /dev/null @@ -1,506 +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 ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.MessageLevelType - """ - - _validation = { - 'compliance_state': {'readonly': True}, - } - - _attribute_map = { - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'message_level': {'key': 'messageLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class ErrorDefinition(msrest.serialization.Model): - """Error definition. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. Service specific error code which serves as the substatus for the HTTP - error code. - :type code: str - :param message: Required. Description of the error. - :type message: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDefinition, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - - -class ErrorResponse(msrest.serialization.Model): - """Error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Error definition. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ErrorDefinition - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = None - - -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. - - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str - """ - - _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) - - -class Resource(msrest.serialization.Model): - """The Resource model definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = kwargs.get('system_data', None) - - -class ProxyResource(Resource): - """ARM proxy resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationDisplay - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - """ - - _validation = { - 'is_data_action': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :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(ResourceProviderOperationDisplay, 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 ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Result(msrest.serialization.Model): - """Sample result definition. - - :param sample_property: Sample property of type string. - :type sample_property: str - """ - - _attribute_map = { - 'sample_property': {'key': 'sampleProperty', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Result, self).__init__(**kwargs) - self.sample_property = kwargs.get('sample_property', None) - - -class SourceControlConfiguration(ProxyResource): - """The SourceControl Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.OperatorScopeType - :ivar repository_public_key: Public Key associated with this SourceControl configuration - (either generated within the cluster or provided by the user). - :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'compliance_status': {'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'}, - 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, - 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, - 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, - 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, - 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, - 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, - 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.serialization.Model): - """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Source Control Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SystemData(msrest.serialization.Model): - """Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar created_by: A string identifier for the identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource: user, application, - managedIdentity, key. - :vartype created_by_type: str - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: A string identifier for 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: user, - application, managedIdentity, key. - :vartype last_modified_by_type: str - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _validation = { - 'created_by': {'readonly': True}, - 'created_by_type': {'readonly': True}, - 'created_at': {'readonly': True}, - 'last_modified_by': {'readonly': True}, - 'last_modified_by_type': {'readonly': True}, - 'last_modified_at': {'readonly': True}, - } - - _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 = None - self.created_by_type = None - self.created_at = None - self.last_modified_by = None - self.last_modified_by_type = None - self.last_modified_at = None diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_models_py3.py index ed2e27c2b8f4..b3ea2a3dcc46 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_models_py3.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_models_py3.py @@ -24,13 +24,13 @@ class ComplianceStatus(msrest.serialization.Model): "Pending", "Compliant", "Noncompliant", "Installed", "Failed". :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", "Information". - :type message_level: str or + :vartype message_level: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.MessageLevelType """ @@ -53,6 +53,16 @@ def __init__( message_level: Optional[Union[str, "MessageLevelType"]] = None, **kwargs ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.MessageLevelType + """ super(ComplianceStatus, self).__init__(**kwargs) self.compliance_state = None self.last_config_applied = last_config_applied @@ -65,11 +75,11 @@ class ErrorDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. Service specific error code which serves as the substatus for the HTTP + :ivar code: Required. Service specific error code which serves as the substatus for the HTTP error code. - :type code: str - :param message: Required. Description of the error. - :type message: str + :vartype code: str + :ivar message: Required. Description of the error. + :vartype message: str """ _validation = { @@ -89,6 +99,13 @@ def __init__( message: str, **kwargs ): + """ + :keyword code: Required. Service specific error code which serves as the substatus for the HTTP + error code. + :paramtype code: str + :keyword message: Required. Description of the error. + :paramtype message: str + """ super(ErrorDefinition, self).__init__(**kwargs) self.code = code self.message = message @@ -115,6 +132,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorResponse, self).__init__(**kwargs) self.error = None @@ -122,10 +141,10 @@ def __init__( class HelmOperatorProperties(msrest.serialization.Model): """Properties for Helm operator. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str """ _attribute_map = { @@ -140,6 +159,12 @@ def __init__( chart_values: Optional[str] = None, **kwargs ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ super(HelmOperatorProperties, self).__init__(**kwargs) self.chart_version = chart_version self.chart_values = chart_values @@ -156,9 +181,9 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData """ _validation = { @@ -180,6 +205,12 @@ def __init__( system_data: Optional["SystemData"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -198,9 +229,9 @@ class ProxyResource(Resource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData """ _validation = { @@ -222,6 +253,12 @@ def __init__( system_data: Optional["SystemData"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData + """ super(ProxyResource, self).__init__(system_data=system_data, **kwargs) @@ -230,10 +267,10 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationDisplay :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool @@ -256,6 +293,13 @@ def __init__( display: Optional["ResourceProviderOperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationDisplay + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -265,14 +309,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -291,6 +335,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -303,8 +357,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -325,6 +379,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -333,8 +392,8 @@ def __init__( class Result(msrest.serialization.Model): """Sample result definition. - :param sample_property: Sample property of type string. - :type sample_property: str + :ivar sample_property: Sample property of type string. + :vartype sample_property: str """ _attribute_map = { @@ -347,6 +406,10 @@ def __init__( sample_property: Optional[str] = None, **kwargs ): + """ + :keyword sample_property: Sample property of type string. + :paramtype sample_property: str + """ super(Result, self).__init__(**kwargs) self.sample_property = sample_property @@ -362,39 +425,39 @@ class SourceControlConfiguration(ProxyResource): :vartype name: str :ivar type: Resource type. :vartype type: str - :param system_data: Top level metadata + :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :type system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or + :vartype operator_scope: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.OperatorScopeType :ivar repository_public_key: Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.HelmOperatorProperties :ivar provisioning_state: The provisioning state of the resource provider. Possible values include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". @@ -450,6 +513,40 @@ def __init__( helm_operator_properties: Optional["HelmOperatorProperties"] = None, **kwargs ): + """ + :keyword system_data: Top level metadata + https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. + :paramtype system_data: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SystemData + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.HelmOperatorProperties + """ super(SourceControlConfiguration, self).__init__(system_data=system_data, **kwargs) self.repository_url = repository_url self.operator_namespace = operator_namespace @@ -492,6 +589,8 @@ def __init__( self, **kwargs ): + """ + """ super(SourceControlConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -540,6 +639,8 @@ def __init__( self, **kwargs ): + """ + """ super(SystemData, self).__init__(**kwargs) self.created_by = None self.created_by_type = None diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_source_control_configuration_client_enums.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_source_control_configuration_client_enums.py index 3803d916bfdc..f15af9df3a01 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_source_control_configuration_client_enums.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/models/_source_control_configuration_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 ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compliance state of the configuration. """ @@ -36,17 +21,17 @@ class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the message. """ @@ -54,20 +39,20 @@ class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the operator will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the operator """ FLUX = "Flux" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource provider. """ diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_operations.py index 09bd96085f73..04f675b2f5e4 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/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 = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/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 Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_source_control_configurations_operations.py index fa9269000384..8eebc4837900 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_source_control_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2020_10_01_preview/operations/_source_control_configurations_operations.py @@ -5,25 +5,199 @@ # 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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 + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2020-10-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class SourceControlConfigurationsOperations(object): """SourceControlConfigurationsOperations operations. @@ -47,16 +221,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Gets details of the Source Control Configuration. :param resource_group_name: The name of the resource group. @@ -66,14 +240,16 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -81,36 +257,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -119,19 +285,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - source_control_configuration, # type: "_models.SourceControlConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Create a new Kubernetes Source Control Configuration. :param resource_group_name: The name of the resource group. @@ -141,16 +309,19 @@ def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -158,41 +329,31 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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(source_control_configuration, 'SourceControlConfiguration') - # 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_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.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(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,70 +366,61 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_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 = "2020-10-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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. @@ -279,22 +431,25 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_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', @@ -311,24 +466,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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,17 +485,18 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SourceControlConfigurationList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. @@ -360,12 +506,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2020_10_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -373,38 +522,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-10-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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -417,12 +565,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/__init__.py index f13062376d74..e90963036337 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_configuration.py index 645328abb1fd..d1e0dc4fffe1 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_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,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(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(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_metadata.json index 099699859283..324f873c032c 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_metadata.json +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_metadata.json @@ -5,13 +5,13 @@ "name": "SourceControlConfigurationClient", "filename": "_source_control_configuration_client", "description": "KubernetesConfiguration Client.", - "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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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": { "source_control_configurations": "SourceControlConfigurationsOperations", diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_source_control_configuration_client.py index 50b673797b5d..d88edd7b180c 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_source_control_configuration_client.py @@ -6,79 +6,83 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import Operations, SourceControlConfigurationsOperations + 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 SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_03_01.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2021_03_01.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_03_01.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(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.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_version.py index c47f66669f1b..59deb8c7263b 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_version.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0" diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/__init__.py index ba52c91a7ba1..5f583276b4ed 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_configuration.py index 682d27628930..6e8d28ce1acc 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/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,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_source_control_configuration_client.py index 2db9ca6cfeb4..ebbe4381c953 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/_source_control_configuration_client.py @@ -6,75 +6,83 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_03_01.aio.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2021_03_01.aio.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_03_01.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). + :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. + 00000000-0000-0000-0000-000000000000). :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(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.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_operations.py index 09d8376d1120..ced61c241997 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/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._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 @@ -48,8 +54,10 @@ def list( """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - 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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_source_control_configurations_operations.py index db8449803bdb..8ca4a2f361a8 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_source_control_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/aio/operations/_source_control_configurations_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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_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_async async def get( self, resource_group_name: str, @@ -61,7 +67,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. @@ -76,36 +83,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - 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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -114,8 +111,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -135,13 +135,15 @@ async def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration @@ -152,41 +154,31 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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(source_control_configuration, 'SourceControlConfiguration') - # 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_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.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(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,8 +191,10 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -215,43 +209,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - 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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -271,22 +256,25 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_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', @@ -303,24 +291,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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,8 +310,10 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -351,12 +331,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -364,38 +347,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -408,12 +390,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/__init__.py index 95574a9920bb..ec901c15835a 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/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 ComplianceStatus - from ._models_py3 import ErrorDefinition - from ._models_py3 import ErrorResponse - from ._models_py3 import HelmOperatorProperties - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Result - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import ComplianceStatus # type: ignore - from ._models import ErrorDefinition # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import HelmOperatorProperties # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Result # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import ComplianceStatus +from ._models_py3 import ErrorDefinition +from ._models_py3 import ErrorResponse +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Result +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( ComplianceStateType, diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_models.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_models.py deleted file mode 100644 index 00bd900ea10a..000000000000 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_models.py +++ /dev/null @@ -1,495 +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 ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.MessageLevelType - """ - - _validation = { - 'compliance_state': {'readonly': True}, - } - - _attribute_map = { - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'message_level': {'key': 'messageLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class ErrorDefinition(msrest.serialization.Model): - """Error definition. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. Service specific error code which serves as the substatus for the HTTP - error code. - :type code: str - :param message: Required. Description of the error. - :type message: str - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDefinition, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - - -class ErrorResponse(msrest.serialization.Model): - """Error response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar error: Error definition. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ErrorDefinition - """ - - _validation = { - 'error': {'readonly': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = None - - -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. - - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str - """ - - _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationDisplay - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - """ - - _validation = { - 'is_data_action': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :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(ResourceProviderOperationDisplay, 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 ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Result(msrest.serialization.Model): - """Sample result definition. - - :param sample_property: Sample property of type string. - :type sample_property: str - """ - - _attribute_map = { - 'sample_property': {'key': 'sampleProperty', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Result, self).__init__(**kwargs) - self.sample_property = kwargs.get('sample_property', None) - - -class SourceControlConfiguration(ProxyResource): - """The SourceControl Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorScopeType - :ivar repository_public_key: Public Key associated with this SourceControl configuration - (either generated within the cluster or provided by the user). - :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'compliance_status': {'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'}, - 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, - 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, - 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, - 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, - 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, - 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, - 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.system_data = None - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.serialization.Model): - """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Source Control Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = 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.kubernetesconfiguration.v2021_03_01.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.kubernetesconfiguration.v2021_03_01.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) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_models_py3.py index 259854d16de9..fb21995b82b7 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_models_py3.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_models_py3.py @@ -24,13 +24,13 @@ class ComplianceStatus(msrest.serialization.Model): "Pending", "Compliant", "Noncompliant", "Installed", "Failed". :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", "Information". - :type message_level: str or + :vartype message_level: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.MessageLevelType """ @@ -53,6 +53,16 @@ def __init__( message_level: Optional[Union[str, "MessageLevelType"]] = None, **kwargs ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.MessageLevelType + """ super(ComplianceStatus, self).__init__(**kwargs) self.compliance_state = None self.last_config_applied = last_config_applied @@ -65,11 +75,11 @@ class ErrorDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param code: Required. Service specific error code which serves as the substatus for the HTTP + :ivar code: Required. Service specific error code which serves as the substatus for the HTTP error code. - :type code: str - :param message: Required. Description of the error. - :type message: str + :vartype code: str + :ivar message: Required. Description of the error. + :vartype message: str """ _validation = { @@ -89,6 +99,13 @@ def __init__( message: str, **kwargs ): + """ + :keyword code: Required. Service specific error code which serves as the substatus for the HTTP + error code. + :paramtype code: str + :keyword message: Required. Description of the error. + :paramtype message: str + """ super(ErrorDefinition, self).__init__(**kwargs) self.code = code self.message = message @@ -115,6 +132,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorResponse, self).__init__(**kwargs) self.error = None @@ -122,10 +141,10 @@ def __init__( class HelmOperatorProperties(msrest.serialization.Model): """Properties for Helm operator. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str """ _attribute_map = { @@ -140,6 +159,12 @@ def __init__( chart_values: Optional[str] = None, **kwargs ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ super(HelmOperatorProperties, self).__init__(**kwargs) self.chart_version = chart_version self.chart_values = chart_values @@ -176,6 +201,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -213,6 +240,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -221,10 +250,10 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationDisplay :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool @@ -247,6 +276,13 @@ def __init__( display: Optional["ResourceProviderOperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationDisplay + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -256,14 +292,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -282,6 +318,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -294,8 +340,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -316,6 +362,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -324,8 +375,8 @@ def __init__( class Result(msrest.serialization.Model): """Sample result definition. - :param sample_property: Sample property of type string. - :type sample_property: str + :ivar sample_property: Sample property of type string. + :vartype sample_property: str """ _attribute_map = { @@ -338,6 +389,10 @@ def __init__( sample_property: Optional[str] = None, **kwargs ): + """ + :keyword sample_property: Sample property of type string. + :paramtype sample_property: str + """ super(Result, self).__init__(**kwargs) self.sample_property = sample_property @@ -358,35 +413,36 @@ class SourceControlConfiguration(ProxyResource): :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorType + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or + :vartype operator_scope: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorScopeType :ivar repository_public_key: Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.HelmOperatorProperties :ivar provisioning_state: The provisioning state of the resource provider. Possible values include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". @@ -442,6 +498,36 @@ def __init__( helm_operator_properties: Optional["HelmOperatorProperties"] = None, **kwargs ): + """ + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.HelmOperatorProperties + """ super(SourceControlConfiguration, self).__init__(**kwargs) self.system_data = None self.repository_url = repository_url @@ -485,6 +571,8 @@ def __init__( self, **kwargs ): + """ + """ super(SourceControlConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -493,22 +581,22 @@ 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 + :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.kubernetesconfiguration.v2021_03_01.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_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 + :vartype last_modified_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -531,6 +619,24 @@ 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.kubernetesconfiguration.v2021_03_01.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.kubernetesconfiguration.v2021_03_01.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 diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_source_control_configuration_client_enums.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_source_control_configuration_client_enums.py index be122639f51b..68b551afcbe1 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_source_control_configuration_client_enums.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/models/_source_control_configuration_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 ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compliance state of the configuration. """ @@ -36,7 +21,7 @@ class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -45,17 +30,17 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the message. """ @@ -63,20 +48,20 @@ class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the operator will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the operator """ FLUX = "Flux" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource provider. """ diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_operations.py index 4f46b3932056..284e6510ab74 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/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-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/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 Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - 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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_source_control_configurations_operations.py index 7808e3e5917c..a36d0e745c0f 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_source_control_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_03_01/operations/_source_control_configurations_operations.py @@ -5,25 +5,199 @@ # 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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 + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-03-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class SourceControlConfigurationsOperations(object): """SourceControlConfigurationsOperations operations. @@ -47,16 +221,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Gets details of the Source Control Configuration. :param resource_group_name: The name of the resource group. @@ -66,7 +240,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. @@ -81,36 +256,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - 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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -119,19 +284,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - source_control_configuration, # type: "_models.SourceControlConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Create a new Kubernetes Source Control Configuration. :param resource_group_name: The name of the resource group. @@ -141,13 +308,15 @@ def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfiguration @@ -158,41 +327,31 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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(source_control_configuration, 'SourceControlConfiguration') - # 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_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.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(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,70 +364,61 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_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" - 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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. @@ -279,22 +429,25 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_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', @@ -311,24 +464,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'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,17 +483,18 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SourceControlConfigurationList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. @@ -360,12 +504,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_03_01.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -373,38 +520,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-01" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -417,12 +563,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/__init__.py index f13062376d74..e90963036337 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_configuration.py index 65baac1ee829..e0d799c13103 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_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,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(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(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_metadata.json index ad77bd742f07..49325700ea44 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_metadata.json +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "SourceControlConfigurationClient", "filename": "_source_control_configuration_client", "description": "KubernetesConfiguration Client.", - "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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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": { "extensions": "ExtensionsOperations", diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_source_control_configuration_client.py index 9b275bd22adc..caa563f1320a 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_source_control_configuration_client.py @@ -6,109 +6,107 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import ClusterExtensionTypeOperations, ClusterExtensionTypesOperations, ExtensionTypeVersionsOperations, ExtensionsOperations, LocationExtensionTypesOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + 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 SourceControlConfigurationClientConfiguration -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import ClusterExtensionTypeOperations -from .operations import ClusterExtensionTypesOperations -from .operations import ExtensionTypeVersionsOperations -from .operations import LocationExtensionTypesOperations -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.OperationStatusOperations :ivar cluster_extension_type: ClusterExtensionTypeOperations operations - :vartype cluster_extension_type: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ClusterExtensionTypeOperations + :vartype cluster_extension_type: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ClusterExtensionTypeOperations :ivar cluster_extension_types: ClusterExtensionTypesOperations operations - :vartype cluster_extension_types: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ClusterExtensionTypesOperations + :vartype cluster_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ClusterExtensionTypesOperations :ivar extension_type_versions: ExtensionTypeVersionsOperations operations - :vartype extension_type_versions: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ExtensionTypeVersionsOperations + :vartype extension_type_versions: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.ExtensionTypeVersionsOperations :ivar location_extension_types: LocationExtensionTypesOperations operations - :vartype location_extension_types: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.LocationExtensionTypesOperations + :vartype location_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.LocationExtensionTypesOperations :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(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.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_type = ClusterExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_types = ClusterExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type_versions = ExtensionTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.location_extension_types = LocationExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_type = ClusterExtensionTypeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_types = ClusterExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extension_type_versions = ExtensionTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location_extension_types = LocationExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - 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', min_length=1), - } - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_version.py index c47f66669f1b..59deb8c7263b 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_version.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0" diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/__init__.py index ba52c91a7ba1..5f583276b4ed 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_configuration.py index 1f07c12f646f..d457ecaa9748 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/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,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_source_control_configuration_client.py index cf79cd786691..a2fbc1fdda50 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/_source_control_configuration_client.py @@ -6,105 +6,107 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import ClusterExtensionTypeOperations, ClusterExtensionTypesOperations, ExtensionTypeVersionsOperations, ExtensionsOperations, LocationExtensionTypesOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import ClusterExtensionTypeOperations -from .operations import ClusterExtensionTypesOperations -from .operations import ExtensionTypeVersionsOperations -from .operations import LocationExtensionTypesOperations -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.OperationStatusOperations :ivar cluster_extension_type: ClusterExtensionTypeOperations operations - :vartype cluster_extension_type: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ClusterExtensionTypeOperations + :vartype cluster_extension_type: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ClusterExtensionTypeOperations :ivar cluster_extension_types: ClusterExtensionTypesOperations operations - :vartype cluster_extension_types: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ClusterExtensionTypesOperations + :vartype cluster_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ClusterExtensionTypesOperations :ivar extension_type_versions: ExtensionTypeVersionsOperations operations - :vartype extension_type_versions: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ExtensionTypeVersionsOperations + :vartype extension_type_versions: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.ExtensionTypeVersionsOperations :ivar location_extension_types: LocationExtensionTypesOperations operations - :vartype location_extension_types: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.LocationExtensionTypesOperations + :vartype location_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.LocationExtensionTypesOperations :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(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.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_type = ClusterExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_types = ClusterExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type_versions = ExtensionTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.location_extension_types = LocationExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_type = ClusterExtensionTypeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_types = ClusterExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extension_type_versions = ExtensionTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location_extension_types = LocationExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - 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', min_length=1), - } - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_type_operations.py index 224059db3307..c77d6b319975 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_type_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_type_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, Union 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._cluster_extension_type_operations import build_get_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 get( self, resource_group_name: str, @@ -73,36 +78,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterType': self._serialize.url("cluster_type", cluster_type, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_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, + cluster_rp=cluster_rp, + cluster_type=cluster_type, + cluster_name=cluster_name, + extension_type_name=extension_type_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionType', pipeline_response) @@ -111,4 +106,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterType}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_types_operations.py index b0eaf6af2f6a..b99f307b6adb 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_types_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_cluster_extension_types_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, 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.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._cluster_extension_types_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, resource_group_name: str, @@ -59,7 +65,8 @@ def list( :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -67,37 +74,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_name=cluster_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('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,12 +115,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extension_type_versions_operations.py index bd9f2c220fc3..0fd76dd062aa 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extension_type_versions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extension_type_versions_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._extension_type_versions_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, location: str, @@ -54,8 +60,10 @@ def list( :param extension_type_name: Extension type name. :type extension_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionList] + :return: An iterator like instance of either ExtensionVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] @@ -63,36 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_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_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + 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, + location=location, + extension_type_name=extension_type_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('ExtensionVersionList', pipeline_response) + deserialized = self._deserialize("ExtensionVersionList", pipeline_response) list_of_elem = deserialized.versions if cls: list_of_elem = cls(list_of_elem) @@ -105,12 +110,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extensions_operations.py index a09b63b34754..65591042bb26 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extensions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_extensions_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._extensions_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,42 +63,31 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(extension, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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('Extension', pipeline_response) @@ -105,8 +99,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -126,7 +123,8 @@ async def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -135,15 +133,20 @@ async def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,30 +161,21 @@ async def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -193,8 +187,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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -213,7 +209,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -228,36 +225,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -266,8 +253,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -283,45 +272,35 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + 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.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -342,7 +321,8 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -352,15 +332,17 @@ async def begin_delete( :type force_delete: bool :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', @@ -378,24 +360,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -407,8 +379,10 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -426,12 +400,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -439,38 +415,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -483,12 +458,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_location_extension_types_operations.py index f435cdfdcb5d..024729f2f0f8 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_location_extension_types_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_location_extension_types_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._location_extension_types_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, location: str, @@ -52,7 +58,8 @@ def list( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -60,35 +67,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'location': self._serialize.url("location", location, '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, + location=location, + 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, + location=location, + 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('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,12 +104,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operation_status_operations.py index db90f6c66601..2d99d5e6b2f3 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operation_status_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operation_status_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, 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.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._operation_status_operations import build_get_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, resource_group_name: str, @@ -58,12 +64,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperationStatusList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -71,38 +79,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,17 +122,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -145,7 +154,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -162,37 +172,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -201,4 +201,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operations.py index 3c82397333fb..d62dc62020b1 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/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._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 @@ -48,8 +54,10 @@ def list( """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_source_control_configurations_operations.py index 05183fe90c13..d63c27542d25 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_source_control_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/aio/operations/_source_control_configurations_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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_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_async async def get( self, resource_group_name: str, @@ -61,14 +67,16 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -76,36 +84,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -114,8 +112,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -135,16 +136,19 @@ async def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -152,41 +156,31 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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(source_control_configuration, 'SourceControlConfiguration') - # 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_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.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(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,8 +193,10 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -215,43 +211,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -271,22 +258,25 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_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', @@ -303,24 +293,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,8 +312,10 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -351,12 +333,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -364,38 +349,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -408,12 +392,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/__init__.py index e97bdb991663..2b481eea8c90 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/__init__.py @@ -6,64 +6,35 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ClusterScopeSettings - from ._models_py3 import ComplianceStatus - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import Extension - from ._models_py3 import ExtensionStatus - from ._models_py3 import ExtensionType - from ._models_py3 import ExtensionTypeList - from ._models_py3 import ExtensionVersionList - from ._models_py3 import ExtensionVersionListVersionsItem - from ._models_py3 import ExtensionsList - from ._models_py3 import HelmOperatorProperties - from ._models_py3 import Identity - from ._models_py3 import OperationStatusList - from ._models_py3 import OperationStatusResult - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Scope - from ._models_py3 import ScopeCluster - from ._models_py3 import ScopeNamespace - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList - from ._models_py3 import SupportedScopes - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import ClusterScopeSettings # type: ignore - from ._models import ComplianceStatus # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Extension # type: ignore - from ._models import ExtensionStatus # type: ignore - from ._models import ExtensionType # type: ignore - from ._models import ExtensionTypeList # type: ignore - from ._models import ExtensionVersionList # type: ignore - from ._models import ExtensionVersionListVersionsItem # type: ignore - from ._models import ExtensionsList # type: ignore - from ._models import HelmOperatorProperties # type: ignore - from ._models import Identity # type: ignore - from ._models import OperationStatusList # type: ignore - from ._models import OperationStatusResult # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Scope # type: ignore - from ._models import ScopeCluster # type: ignore - from ._models import ScopeNamespace # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore - from ._models import SupportedScopes # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import ClusterScopeSettings +from ._models_py3 import ComplianceStatus +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Extension +from ._models_py3 import ExtensionStatus +from ._models_py3 import ExtensionType +from ._models_py3 import ExtensionTypeList +from ._models_py3 import ExtensionVersionList +from ._models_py3 import ExtensionVersionListVersionsItem +from ._models_py3 import ExtensionsList +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import Identity +from ._models_py3 import OperationStatusList +from ._models_py3 import OperationStatusResult +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Scope +from ._models_py3 import ScopeCluster +from ._models_py3 import ScopeNamespace +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SupportedScopes +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( ClusterTypes, diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_models.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_models.py deleted file mode 100644 index 9a722f97fbb5..000000000000 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_models.py +++ /dev/null @@ -1,1056 +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 Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ClusterScopeSettings(ProxyResource): - """Extension scope settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param allow_multiple_instances: Describes if multiple instances of the extension are allowed. - :type allow_multiple_instances: bool - :param default_release_namespace: Default extension release namespace. - :type default_release_namespace: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'allow_multiple_instances': {'key': 'properties.allowMultipleInstances', 'type': 'bool'}, - 'default_release_namespace': {'key': 'properties.defaultReleaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterScopeSettings, self).__init__(**kwargs) - self.allow_multiple_instances = kwargs.get('allow_multiple_instances', None) - self.default_release_namespace = kwargs.get('default_release_namespace', None) - - -class ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.MessageLevelType - """ - - _validation = { - 'compliance_state': {'readonly': True}, - } - - _attribute_map = { - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'message_level': {'key': 'messageLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class Extension(ProxyResource): - """The Extension object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Identity - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the - Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - :ivar provisioning_state: Status of installation of this extension. Possible values include: - "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionStatus] - :ivar error_info: Error information from the Agent - e.g. errors during installation. - :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail - :ivar custom_location_settings: Custom Location settings properties. - :vartype custom_location_settings: dict[str, str] - :ivar package_uri: Uri of the Helm package. - :vartype package_uri: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'error_info': {'readonly': True}, - 'custom_location_settings': {'readonly': True}, - 'package_uri': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'Scope'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, - 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDetail'}, - 'custom_location_settings': {'key': 'properties.customLocationSettings', 'type': '{str}'}, - 'package_uri': {'key': 'properties.packageUri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Extension, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.extension_type = kwargs.get('extension_type', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.scope = kwargs.get('scope', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.provisioning_state = None - self.statuses = kwargs.get('statuses', None) - self.error_info = None - self.custom_location_settings = None - self.package_uri = None - - -class ExtensionsList(msrest.serialization.Model): - """Result of the request to list Extensions. It contains a list of Extension objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Extensions within a Kubernetes cluster. - :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension] - :ivar next_link: URL to get the next set of extension objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Extension]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExtensionStatus(msrest.serialization.Model): - """Status from the extension. - - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". - Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionStatus, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.display_status = kwargs.get('display_status', None) - self.level = kwargs.get('level', "Information") - self.message = kwargs.get('message', None) - self.time = kwargs.get('time', None) - - -class ExtensionType(msrest.serialization.Model): - """Represents an Extension Type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData - :ivar release_trains: Extension release train: preview or stable. - :vartype release_trains: list[str] - :ivar cluster_types: Cluster types. Possible values include: "connectedClusters", - "managedClusters". - :vartype cluster_types: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ClusterTypes - :ivar supported_scopes: Extension scopes. - :vartype supported_scopes: - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SupportedScopes - """ - - _validation = { - 'system_data': {'readonly': True}, - 'release_trains': {'readonly': True}, - 'cluster_types': {'readonly': True}, - 'supported_scopes': {'readonly': True}, - } - - _attribute_map = { - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'release_trains': {'key': 'properties.releaseTrains', 'type': '[str]'}, - 'cluster_types': {'key': 'properties.clusterTypes', 'type': 'str'}, - 'supported_scopes': {'key': 'properties.supportedScopes', 'type': 'SupportedScopes'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionType, self).__init__(**kwargs) - self.system_data = None - self.release_trains = None - self.cluster_types = None - self.supported_scopes = None - - -class ExtensionTypeList(msrest.serialization.Model): - """List Extension Types. - - :param value: The list of Extension Types. - :type value: list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtensionType]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionTypeList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ExtensionVersionList(msrest.serialization.Model): - """List versions for an Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param versions: Versions available for this Extension Type. - :type versions: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionListVersionsItem] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData - """ - - _validation = { - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'versions': {'key': 'versions', 'type': '[ExtensionVersionListVersionsItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionVersionList, self).__init__(**kwargs) - self.versions = kwargs.get('versions', None) - self.next_link = kwargs.get('next_link', None) - self.system_data = None - - -class ExtensionVersionListVersionsItem(msrest.serialization.Model): - """ExtensionVersionListVersionsItem. - - :param release_train: The release train for this Extension Type. - :type release_train: str - :param versions: Versions available for this Extension Type and release train. - :type versions: list[str] - """ - - _attribute_map = { - 'release_train': {'key': 'releaseTrain', 'type': 'str'}, - 'versions': {'key': 'versions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionVersionListVersionsItem, self).__init__(**kwargs) - self.release_train = kwargs.get('release_train', None) - self.versions = kwargs.get('versions', None) - - -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. - - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str - """ - - _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class OperationStatusList(msrest.serialization.Model): - """The async operations in progress, in the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of async operations in progress, in the cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperationStatusResult] - :ivar next_link: URL to get the next set of Operation Result objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationStatusResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OperationStatusResult(msrest.serialization.Model): - """The current status of an async operation. - - 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 id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] - :ivar error: If present, details of the operation error. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail - """ - - _validation = { - 'status': {'required': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResult, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.status = kwargs['status'] - self.properties = kwargs.get('properties', None) - self.error = None - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationDisplay - :param origin: The intended executor of the operation;governs the display of the operation in - the RBAC UX and the audit logs UX. - :type origin: str - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - """ - - _validation = { - 'is_data_action': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.is_data_action = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :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(ResourceProviderOperationDisplay, 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 ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Scope(msrest.serialization.Model): - """Scope of the extension. It can be either Cluster or Namespace; but not both. - - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeNamespace - """ - - _attribute_map = { - 'cluster': {'key': 'cluster', 'type': 'ScopeCluster'}, - 'namespace': {'key': 'namespace', 'type': 'ScopeNamespace'}, - } - - def __init__( - self, - **kwargs - ): - super(Scope, self).__init__(**kwargs) - self.cluster = kwargs.get('cluster', None) - self.namespace = kwargs.get('namespace', None) - - -class ScopeCluster(msrest.serialization.Model): - """Specifies that the scope of the extension is Cluster. - - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster - scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str - """ - - _attribute_map = { - 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeCluster, self).__init__(**kwargs) - self.release_namespace = kwargs.get('release_namespace', None) - - -class ScopeNamespace(msrest.serialization.Model): - """Specifies that the scope of the extension is Namespace. - - :param target_namespace: Namespace where the extension will be created for an Namespace scoped - extension. If this namespace does not exist, it will be created. - :type target_namespace: str - """ - - _attribute_map = { - 'target_namespace': {'key': 'targetNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeNamespace, self).__init__(**kwargs) - self.target_namespace = kwargs.get('target_namespace', None) - - -class SourceControlConfiguration(ProxyResource): - """The SourceControl Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperatorScopeType - :ivar repository_public_key: Public Key associated with this SourceControl configuration - (either generated within the cluster or provided by the user). - :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'compliance_status': {'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'}, - 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, - 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, - 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, - 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, - 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, - 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, - 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.system_data = None - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.serialization.Model): - """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Source Control Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SupportedScopes(msrest.serialization.Model): - """Extension scopes. - - :param default_scope: Default extension scopes: cluster or namespace. - :type default_scope: str - :param cluster_scope_settings: Scope settings. - :type cluster_scope_settings: - ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ClusterScopeSettings - """ - - _attribute_map = { - 'default_scope': {'key': 'defaultScope', 'type': 'str'}, - 'cluster_scope_settings': {'key': 'clusterScopeSettings', 'type': 'ClusterScopeSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedScopes, self).__init__(**kwargs) - self.default_scope = kwargs.get('default_scope', None) - self.cluster_scope_settings = kwargs.get('cluster_scope_settings', 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.kubernetesconfiguration.v2021_05_01_preview.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.kubernetesconfiguration.v2021_05_01_preview.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) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_models_py3.py index 50ef8c899cd6..975976069789 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_models_py3.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_models_py3.py @@ -46,6 +46,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -83,6 +85,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -99,10 +103,10 @@ class ClusterScopeSettings(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param allow_multiple_instances: Describes if multiple instances of the extension are allowed. - :type allow_multiple_instances: bool - :param default_release_namespace: Default extension release namespace. - :type default_release_namespace: str + :ivar allow_multiple_instances: Describes if multiple instances of the extension are allowed. + :vartype allow_multiple_instances: bool + :ivar default_release_namespace: Default extension release namespace. + :vartype default_release_namespace: str """ _validation = { @@ -126,6 +130,13 @@ def __init__( default_release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword allow_multiple_instances: Describes if multiple instances of the extension are + allowed. + :paramtype allow_multiple_instances: bool + :keyword default_release_namespace: Default extension release namespace. + :paramtype default_release_namespace: str + """ super(ClusterScopeSettings, self).__init__(**kwargs) self.allow_multiple_instances = allow_multiple_instances self.default_release_namespace = default_release_namespace @@ -140,13 +151,13 @@ class ComplianceStatus(msrest.serialization.Model): "Pending", "Compliant", "Noncompliant", "Installed", "Failed". :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", "Information". - :type message_level: str or + :vartype message_level: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.MessageLevelType """ @@ -169,6 +180,16 @@ def __init__( message_level: Optional[Union[str, "MessageLevelType"]] = None, **kwargs ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.MessageLevelType + """ super(ComplianceStatus, self).__init__(**kwargs) self.compliance_state = None self.last_config_applied = last_config_applied @@ -201,6 +222,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -245,6 +268,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -256,8 +281,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail """ _attribute_map = { @@ -270,6 +295,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -287,38 +316,38 @@ class Extension(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Identity + :ivar identity: Identity of the Extension resource. + :vartype identity: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Identity :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + :ivar extension_type: Type of the Extension, of which this resource is an instance of. It must + be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :vartype extension_type: str + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar scope: Scope at which the extension is installed. + :vartype scope: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Scope + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] :ivar provisioning_state: Status of installation of this extension. Possible values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: + :ivar statuses: Status from this extension. + :vartype statuses: list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionStatus] :ivar error_info: Error information from the Agent - e.g. errors during installation. :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail @@ -373,6 +402,34 @@ def __init__( statuses: Optional[List["ExtensionStatus"]] = None, **kwargs ): + """ + :keyword identity: Identity of the Extension resource. + :paramtype identity: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Identity + :keyword extension_type: Type of the Extension, of which this resource is an instance of. It + must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :paramtype extension_type: str + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword scope: Scope at which the extension is installed. + :paramtype scope: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Scope + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + :keyword statuses: Status from this extension. + :paramtype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionStatus] + """ super(Extension, self).__init__(**kwargs) self.identity = identity self.system_data = None @@ -415,6 +472,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -423,17 +482,17 @@ def __init__( class ExtensionStatus(msrest.serialization.Model): """Status from the extension. - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". + :ivar code: Status code provided by the Extension. + :vartype code: str + :ivar display_status: Short description of status of the extension. + :vartype display_status: str + :ivar level: Level of the status. Possible values include: "Error", "Warning", "Information". Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str + :vartype level: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.LevelType + :ivar message: Detailed message of the status from the Extension. + :vartype message: str + :ivar time: DateLiteral (per ISO8601) noting the time of installation status. + :vartype time: str """ _attribute_map = { @@ -454,6 +513,20 @@ def __init__( time: Optional[str] = None, **kwargs ): + """ + :keyword code: Status code provided by the Extension. + :paramtype code: str + :keyword display_status: Short description of status of the extension. + :paramtype display_status: str + :keyword level: Level of the status. Possible values include: "Error", "Warning", + "Information". Default value: "Information". + :paramtype level: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.LevelType + :keyword message: Detailed message of the status from the Extension. + :paramtype message: str + :keyword time: DateLiteral (per ISO8601) noting the time of installation status. + :paramtype time: str + """ super(ExtensionStatus, self).__init__(**kwargs) self.code = code self.display_status = display_status @@ -498,6 +571,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionType, self).__init__(**kwargs) self.system_data = None self.release_trains = None @@ -508,10 +583,11 @@ def __init__( class ExtensionTypeList(msrest.serialization.Model): """List Extension Types. - :param value: The list of Extension Types. - :type value: list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str + :ivar value: The list of Extension Types. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType] + :ivar next_link: The link to fetch the next page of Extension Types. + :vartype next_link: str """ _attribute_map = { @@ -526,6 +602,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of Extension Types. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionType] + :keyword next_link: The link to fetch the next page of Extension Types. + :paramtype next_link: str + """ super(ExtensionTypeList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -536,11 +619,11 @@ class ExtensionVersionList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param versions: Versions available for this Extension Type. - :type versions: + :ivar versions: Versions available for this Extension Type. + :vartype versions: list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionListVersionsItem] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str + :ivar next_link: The link to fetch the next page of Extension Types. + :vartype next_link: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData """ @@ -562,6 +645,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword versions: Versions available for this Extension Type. + :paramtype versions: + list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionListVersionsItem] + :keyword next_link: The link to fetch the next page of Extension Types. + :paramtype next_link: str + """ super(ExtensionVersionList, self).__init__(**kwargs) self.versions = versions self.next_link = next_link @@ -571,10 +661,10 @@ def __init__( class ExtensionVersionListVersionsItem(msrest.serialization.Model): """ExtensionVersionListVersionsItem. - :param release_train: The release train for this Extension Type. - :type release_train: str - :param versions: Versions available for this Extension Type and release train. - :type versions: list[str] + :ivar release_train: The release train for this Extension Type. + :vartype release_train: str + :ivar versions: Versions available for this Extension Type and release train. + :vartype versions: list[str] """ _attribute_map = { @@ -589,6 +679,12 @@ def __init__( versions: Optional[List[str]] = None, **kwargs ): + """ + :keyword release_train: The release train for this Extension Type. + :paramtype release_train: str + :keyword versions: Versions available for this Extension Type and release train. + :paramtype versions: list[str] + """ super(ExtensionVersionListVersionsItem, self).__init__(**kwargs) self.release_train = release_train self.versions = versions @@ -597,10 +693,10 @@ def __init__( class HelmOperatorProperties(msrest.serialization.Model): """Properties for Helm operator. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str """ _attribute_map = { @@ -615,6 +711,12 @@ def __init__( chart_values: Optional[str] = None, **kwargs ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ super(HelmOperatorProperties, self).__init__(**kwargs) self.chart_version = chart_version self.chart_values = chart_values @@ -629,9 +731,9 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -651,6 +753,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -683,6 +790,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -695,14 +804,14 @@ class OperationStatusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Required. Operation status. + :vartype status: str + :ivar properties: Additional information, if available. + :vartype properties: dict[str, str] :ivar error: If present, details of the operation error. :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ErrorDetail """ @@ -729,6 +838,16 @@ def __init__( properties: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Required. Operation status. + :paramtype status: str + :keyword properties: Additional information, if available. + :paramtype properties: dict[str, str] + """ super(OperationStatusResult, self).__init__(**kwargs) self.id = id self.name = name @@ -742,14 +861,14 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationDisplay - :param origin: The intended executor of the operation;governs the display of the operation in + :ivar origin: The intended executor of the operation;governs the display of the operation in the RBAC UX and the audit logs UX. - :type origin: str + :vartype origin: str :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool """ @@ -773,6 +892,16 @@ def __init__( origin: Optional[str] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationDisplay + :keyword origin: The intended executor of the operation;governs the display of the operation in + the RBAC UX and the audit logs UX. + :paramtype origin: str + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -783,14 +912,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -809,6 +938,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -821,8 +960,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -843,6 +982,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -851,10 +995,11 @@ def __init__( class Scope(msrest.serialization.Model): """Scope of the extension. It can be either Cluster or Namespace; but not both. - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeNamespace + :ivar cluster: Specifies that the scope of the extension is Cluster. + :vartype cluster: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeCluster + :ivar namespace: Specifies that the scope of the extension is Namespace. + :vartype namespace: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeNamespace """ _attribute_map = { @@ -869,6 +1014,13 @@ def __init__( namespace: Optional["ScopeNamespace"] = None, **kwargs ): + """ + :keyword cluster: Specifies that the scope of the extension is Cluster. + :paramtype cluster: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeCluster + :keyword namespace: Specifies that the scope of the extension is Namespace. + :paramtype namespace: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ScopeNamespace + """ super(Scope, self).__init__(**kwargs) self.cluster = cluster self.namespace = namespace @@ -877,9 +1029,9 @@ def __init__( class ScopeCluster(msrest.serialization.Model): """Specifies that the scope of the extension is Cluster. - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster + :ivar release_namespace: Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str + :vartype release_namespace: str """ _attribute_map = { @@ -892,6 +1044,11 @@ def __init__( release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extension. If this namespace does not exist, it will be created. + :paramtype release_namespace: str + """ super(ScopeCluster, self).__init__(**kwargs) self.release_namespace = release_namespace @@ -899,9 +1056,9 @@ def __init__( class ScopeNamespace(msrest.serialization.Model): """Specifies that the scope of the extension is Namespace. - :param target_namespace: Namespace where the extension will be created for an Namespace scoped + :ivar target_namespace: Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created. - :type target_namespace: str + :vartype target_namespace: str """ _attribute_map = { @@ -914,6 +1071,11 @@ def __init__( target_namespace: Optional[str] = None, **kwargs ): + """ + :keyword target_namespace: Namespace where the extension will be created for an Namespace + scoped extension. If this namespace does not exist, it will be created. + :paramtype target_namespace: str + """ super(ScopeNamespace, self).__init__(**kwargs) self.target_namespace = target_namespace @@ -934,36 +1096,36 @@ class SourceControlConfiguration(ProxyResource): :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or + :vartype operator_scope: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperatorScopeType :ivar repository_public_key: Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.HelmOperatorProperties :ivar provisioning_state: The provisioning state of the resource provider. Possible values include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". @@ -1019,6 +1181,36 @@ def __init__( helm_operator_properties: Optional["HelmOperatorProperties"] = None, **kwargs ): + """ + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.HelmOperatorProperties + """ super(SourceControlConfiguration, self).__init__(**kwargs) self.system_data = None self.repository_url = repository_url @@ -1062,6 +1254,8 @@ def __init__( self, **kwargs ): + """ + """ super(SourceControlConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1070,10 +1264,10 @@ def __init__( class SupportedScopes(msrest.serialization.Model): """Extension scopes. - :param default_scope: Default extension scopes: cluster or namespace. - :type default_scope: str - :param cluster_scope_settings: Scope settings. - :type cluster_scope_settings: + :ivar default_scope: Default extension scopes: cluster or namespace. + :vartype default_scope: str + :ivar cluster_scope_settings: Scope settings. + :vartype cluster_scope_settings: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ClusterScopeSettings """ @@ -1089,6 +1283,13 @@ def __init__( cluster_scope_settings: Optional["ClusterScopeSettings"] = None, **kwargs ): + """ + :keyword default_scope: Default extension scopes: cluster or namespace. + :paramtype default_scope: str + :keyword cluster_scope_settings: Scope settings. + :paramtype cluster_scope_settings: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ClusterScopeSettings + """ super(SupportedScopes, self).__init__(**kwargs) self.default_scope = default_scope self.cluster_scope_settings = cluster_scope_settings @@ -1097,22 +1298,22 @@ 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 + :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.kubernetesconfiguration.v2021_05_01_preview.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_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 + :vartype last_modified_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1135,6 +1336,24 @@ 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.kubernetesconfiguration.v2021_05_01_preview.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.kubernetesconfiguration.v2021_05_01_preview.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 diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_source_control_configuration_client_enums.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_source_control_configuration_client_enums.py index d25cb04abdc3..bd58c28c2790 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_source_control_configuration_client_enums.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/models/_source_control_configuration_client_enums.py @@ -6,34 +6,19 @@ # 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 ClusterTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Cluster types """ CONNECTED_CLUSTERS = "connectedClusters" MANAGED_CLUSTERS = "managedClusters" -class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compliance state of the configuration. """ @@ -43,7 +28,7 @@ class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -52,22 +37,22 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class Enum5(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum5(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the status. """ @@ -75,7 +60,7 @@ class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the message. """ @@ -83,20 +68,20 @@ class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the operator will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the operator """ FLUX = "Flux" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the extension resource. """ @@ -107,7 +92,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" DELETING = "Deleting" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource provider. """ diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_type_operations.py index f845b5d719ae..a9e523f7ed1e 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_type_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_type_operations.py @@ -5,22 +5,65 @@ # 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, Union 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, 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_type: Union[str, "_models.Enum5"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterType}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterType": _SERIALIZER.url("cluster_type", cluster_type, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionTypeName": _SERIALIZER.url("extension_type_name", extension_type_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 + ) class ClusterExtensionTypeOperations(object): """ClusterExtensionTypeOperations operations. @@ -44,16 +87,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_type, # type: Union[str, "_models.Enum5"] - cluster_name, # type: str - extension_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionType" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_type: Union[str, "_models.Enum5"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any + ) -> "_models.ExtensionType": """Get Extension Type details. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -78,36 +121,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterType': self._serialize.url("cluster_type", cluster_type, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_type=cluster_type, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionType', pipeline_response) @@ -116,4 +149,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterType}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_types_operations.py index 2991257b530e..210d4945423c 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_types_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_cluster_extension_types_operations.py @@ -5,23 +5,62 @@ # 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.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, 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') +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, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/connectedClusters/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class ClusterExtensionTypesOperations(object): """ClusterExtensionTypesOperations operations. @@ -45,14 +84,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionTypeList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeList"]: """Get Extension Types. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -64,7 +103,8 @@ def list( :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -72,37 +112,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_name=cluster_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('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,12 +153,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extension_type_versions_operations.py index bca368e16702..c978497cf589 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extension_type_versions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extension_type_versions_operations.py @@ -5,23 +5,60 @@ # 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') +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, + location: str, + extension_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + "extensionTypeName": _SERIALIZER.url("extension_type_name", extension_type_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 + ) class ExtensionTypeVersionsOperations(object): """ExtensionTypeVersionsOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - extension_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionVersionList"] + location: str, + extension_type_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionVersionList"]: """List available versions for an Extension Type. :param location: extension location. @@ -59,8 +96,10 @@ def list( :param extension_type_name: Extension type name. :type extension_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionList] + :return: An iterator like instance of either ExtensionVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] @@ -68,36 +107,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_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_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + 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, + location=location, + extension_type_name=extension_type_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('ExtensionVersionList', pipeline_response) + deserialized = self._deserialize("ExtensionVersionList", pipeline_response) list_of_elem = deserialized.versions if cls: list_of_elem = cls(list_of_elem) @@ -110,12 +146,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extensions_operations.py index 580a564a7cbb..36fca482e884 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extensions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_extensions_operations.py @@ -5,25 +5,203 @@ # 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_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # 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 + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class ExtensionsOperations(object): """ExtensionsOperations operations. @@ -49,56 +227,44 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(extension, 'Extension') - # 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_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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('Extension', pipeline_response) @@ -110,19 +276,21 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Create a new Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -132,7 +300,8 @@ def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -141,15 +310,19 @@ def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,30 +337,21 @@ def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -199,18 +363,19 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> "_models.Extension": """Gets Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -220,7 +385,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -235,36 +401,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -273,74 +429,64 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **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-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + 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.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. @@ -351,7 +497,8 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -361,15 +508,17 @@ def begin_delete( :type force_delete: bool :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', @@ -387,24 +536,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -416,17 +555,18 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionsList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionsList"]: """List all Extensions in the cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -436,12 +576,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionsList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -449,38 +591,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -493,12 +634,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_location_extension_types_operations.py index 15282cd28e0b..5a8c204da5e8 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_location_extension_types_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_location_extension_types_operations.py @@ -5,23 +5,58 @@ # 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') +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, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, '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 + ) class LocationExtensionTypesOperations(object): """LocationExtensionTypesOperations operations. @@ -45,19 +80,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionTypeList"] + location: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeList"]: """List all Extension Types. :param location: extension location. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -65,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'location': self._serialize.url("location", location, '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, + location=location, + 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, + location=location, + 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('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,12 +138,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operation_status_operations.py index 46f3330b7299..c1cdf65ac6d7 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operation_status_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operation_status_operations.py @@ -5,23 +5,107 @@ # 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.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 +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_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 + ) class OperationStatusOperations(object): """OperationStatusOperations operations. @@ -45,15 +129,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationStatusList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.OperationStatusList"]: """List Async Operations, currently in progress, in a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,12 +147,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperationStatusList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -76,38 +162,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,28 +205,29 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResult" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": """Get Async Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -151,7 +237,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -168,37 +255,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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') - - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -207,4 +284,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operations.py index 147a262ef475..6fd3ea82cea0 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/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-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/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 Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_source_control_configurations_operations.py index 0a71453758b3..f79edc229968 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_source_control_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_05_01_preview/operations/_source_control_configurations_operations.py @@ -5,25 +5,199 @@ # 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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 + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-05-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class SourceControlConfigurationsOperations(object): """SourceControlConfigurationsOperations operations. @@ -47,16 +221,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Gets details of the Source Control Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,14 +240,16 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -81,36 +257,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -119,19 +285,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - source_control_configuration, # type: "_models.SourceControlConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Create a new Kubernetes Source Control Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,16 +309,19 @@ def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -158,41 +329,31 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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(source_control_configuration, 'SourceControlConfiguration') - # 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_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.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(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,70 +366,61 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_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-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. @@ -279,22 +431,25 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_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', @@ -311,24 +466,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,17 +485,18 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SourceControlConfigurationList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -360,12 +506,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_05_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -373,38 +522,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -417,12 +565,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/__init__.py index f13062376d74..e90963036337 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_configuration.py index abc45d206461..b83d2cdd71b5 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_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,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(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(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_metadata.json index 01a86003f7ea..54bcbac73239 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_metadata.json +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_metadata.json @@ -5,13 +5,13 @@ "name": "SourceControlConfigurationClient", "filename": "_source_control_configuration_client", "description": "KubernetesConfiguration Client.", - "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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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": { "extensions": "ExtensionsOperations", diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_source_control_configuration_client.py index c53deb2d4cde..537f5bba3259 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_source_control_configuration_client.py @@ -6,84 +6,86 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import ExtensionsOperations, OperationStatusOperations, Operations + 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 SourceControlConfigurationClientConfiguration -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import Operations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2021_09_01.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2021_09_01.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2021_09_01.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2021_09_01.operations.OperationStatusOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_09_01.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(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.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - 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', min_length=1), - } - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_version.py index c47f66669f1b..59deb8c7263b 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_version.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0" diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/__init__.py index ba52c91a7ba1..5f583276b4ed 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_configuration.py index 3f22841a0503..710846e073d3 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/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,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_source_control_configuration_client.py index 4b520f9c48c1..96bdeb10bc78 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/_source_control_configuration_client.py @@ -6,80 +6,86 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import ExtensionsOperations, OperationStatusOperations, Operations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import Operations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2021_09_01.aio.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2021_09_01.aio.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2021_09_01.aio.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2021_09_01.aio.operations.OperationStatusOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_09_01.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(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.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - 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', min_length=1), - } - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_extensions_operations.py index c6c3c4f9d162..46475d98ddf9 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_extensions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_extensions_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._extensions_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,42 +63,31 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(extension, 'Extension') - # 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_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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('Extension', pipeline_response) @@ -105,8 +99,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -126,7 +123,8 @@ async def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -135,15 +133,20 @@ async def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,30 +161,21 @@ async def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -193,8 +187,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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -213,7 +209,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -228,36 +225,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -266,8 +253,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -283,45 +272,35 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + 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.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -342,7 +321,8 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -352,15 +332,17 @@ async def begin_delete( :type force_delete: bool :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', @@ -378,24 +360,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -407,6 +379,7 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore async def _update_initial( @@ -421,47 +394,34 @@ async def _update_initial( ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(patch_extension, 'PatchExtension') - # 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_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.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(patch_extension, 'PatchExtension') - body_content_kwargs['content'] = body_content - request = self._client.patch(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 [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -469,8 +429,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -490,7 +453,8 @@ async def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -499,15 +463,20 @@ async def begin_update( :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.PatchExtension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -522,30 +491,21 @@ async def begin_update( cluster_name=cluster_name, extension_name=extension_name, patch_extension=patch_extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -557,8 +517,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -576,12 +538,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -589,38 +553,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -633,12 +596,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operation_status_operations.py index 61fca2984db6..0d2cb035b00d 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operation_status_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operation_status_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, 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.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._operation_status_operations import build_get_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, resource_group_name: str, @@ -58,12 +64,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.OperationStatusList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -71,38 +79,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,17 +122,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -145,7 +154,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -162,37 +172,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -201,4 +201,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operations.py index 103c895ff59d..2113e3798fec 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/aio/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._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 @@ -49,8 +55,10 @@ def list( this api-version. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -58,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -94,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/__init__.py index 2bcf3a10bde1..01a45e76c937 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/__init__.py @@ -6,48 +6,27 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import Extension - from ._models_py3 import ExtensionPropertiesAksAssignedIdentity - from ._models_py3 import ExtensionStatus - from ._models_py3 import ExtensionsList - from ._models_py3 import Identity - from ._models_py3 import OperationStatusList - from ._models_py3 import OperationStatusResult - from ._models_py3 import PatchExtension - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Scope - from ._models_py3 import ScopeCluster - from ._models_py3 import ScopeNamespace - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Extension # type: ignore - from ._models import ExtensionPropertiesAksAssignedIdentity # type: ignore - from ._models import ExtensionStatus # type: ignore - from ._models import ExtensionsList # type: ignore - from ._models import Identity # type: ignore - from ._models import OperationStatusList # type: ignore - from ._models import OperationStatusResult # type: ignore - from ._models import PatchExtension # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Scope # type: ignore - from ._models import ScopeCluster # type: ignore - from ._models import ScopeNamespace # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Extension +from ._models_py3 import ExtensionPropertiesAksAssignedIdentity +from ._models_py3 import ExtensionStatus +from ._models_py3 import ExtensionsList +from ._models_py3 import Identity +from ._models_py3 import OperationStatusList +from ._models_py3 import OperationStatusResult +from ._models_py3 import PatchExtension +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Scope +from ._models_py3 import ScopeCluster +from ._models_py3 import ScopeNamespace +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( CreatedByType, diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_models.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_models.py deleted file mode 100644 index 82ac361f3a23..000000000000 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_models.py +++ /dev/null @@ -1,739 +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 ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class Extension(ProxyResource): - """The Extension object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Identity - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the - Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - :ivar provisioning_state: The provisioning state of the extension resource. Possible values - include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionStatus] - :param error_info: The error detail. - :type error_info: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail - :ivar custom_location_settings: Custom Location settings properties. - :vartype custom_location_settings: dict[str, str] - :ivar package_uri: Uri of the Helm package. - :vartype package_uri: str - :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. - :type aks_assigned_identity: - ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionPropertiesAksAssignedIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'custom_location_settings': {'readonly': True}, - 'package_uri': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'Scope'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, - 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDetail'}, - 'custom_location_settings': {'key': 'properties.customLocationSettings', 'type': '{str}'}, - 'package_uri': {'key': 'properties.packageUri', 'type': 'str'}, - 'aks_assigned_identity': {'key': 'properties.aksAssignedIdentity', 'type': 'ExtensionPropertiesAksAssignedIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(Extension, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.extension_type = kwargs.get('extension_type', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.scope = kwargs.get('scope', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.provisioning_state = None - self.statuses = kwargs.get('statuses', None) - self.error_info = kwargs.get('error_info', None) - self.custom_location_settings = None - self.package_uri = None - self.aks_assigned_identity = kwargs.get('aks_assigned_identity', None) - - -class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): - """Identity of the Extension resource in an AKS cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class ExtensionsList(msrest.serialization.Model): - """Result of the request to list Extensions. It contains a list of Extension objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Extensions within a Kubernetes cluster. - :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] - :ivar next_link: URL to get the next set of extension objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Extension]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExtensionStatus(msrest.serialization.Model): - """Status from the extension. - - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". - Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionStatus, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.display_status = kwargs.get('display_status', None) - self.level = kwargs.get('level', "Information") - self.message = kwargs.get('message', None) - self.time = kwargs.get('time', None) - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class OperationStatusList(msrest.serialization.Model): - """The async operations in progress, in the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of async operations in progress, in the cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.OperationStatusResult] - :ivar next_link: URL to get the next set of Operation Result objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationStatusResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OperationStatusResult(msrest.serialization.Model): - """The current status of an async operation. - - All required parameters must be populated in order to send to Azure. - - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] - :param error: The error detail. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail - """ - - _validation = { - 'status': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResult, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.status = kwargs['status'] - self.properties = kwargs.get('properties', None) - self.error = kwargs.get('error', None) - - -class PatchExtension(msrest.serialization.Model): - """The Extension Patch Request object. - - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - """ - - _attribute_map = { - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(PatchExtension, self).__init__(**kwargs) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationDisplay - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - :ivar origin: Origin of the operation. - :vartype origin: str - """ - - _validation = { - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = None - self.origin = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :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(ResourceProviderOperationDisplay, 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 ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Scope(msrest.serialization.Model): - """Scope of the extension. It can be either Cluster or Namespace; but not both. - - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeNamespace - """ - - _attribute_map = { - 'cluster': {'key': 'cluster', 'type': 'ScopeCluster'}, - 'namespace': {'key': 'namespace', 'type': 'ScopeNamespace'}, - } - - def __init__( - self, - **kwargs - ): - super(Scope, self).__init__(**kwargs) - self.cluster = kwargs.get('cluster', None) - self.namespace = kwargs.get('namespace', None) - - -class ScopeCluster(msrest.serialization.Model): - """Specifies that the scope of the extension is Cluster. - - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster - scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str - """ - - _attribute_map = { - 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeCluster, self).__init__(**kwargs) - self.release_namespace = kwargs.get('release_namespace', None) - - -class ScopeNamespace(msrest.serialization.Model): - """Specifies that the scope of the extension is Namespace. - - :param target_namespace: Namespace where the extension will be created for an Namespace scoped - extension. If this namespace does not exist, it will be created. - :type target_namespace: str - """ - - _attribute_map = { - 'target_namespace': {'key': 'targetNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeNamespace, self).__init__(**kwargs) - self.target_namespace = kwargs.get('target_namespace', 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.kubernetesconfiguration.v2021_09_01.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.kubernetesconfiguration.v2021_09_01.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) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_models_py3.py index dfc2c01aab63..e60feb178697 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_models_py3.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_models_py3.py @@ -40,6 +40,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -83,6 +85,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -94,8 +98,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail """ _attribute_map = { @@ -108,6 +112,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -143,6 +151,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -180,6 +190,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -196,46 +208,46 @@ class Extension(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Identity + :ivar identity: Identity of the Extension resource. + :vartype identity: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Identity :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + :ivar extension_type: Type of the Extension, of which this resource is an instance of. It must + be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :vartype extension_type: str + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar scope: Scope at which the extension is installed. + :vartype scope: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Scope + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] :ivar provisioning_state: The provisioning state of the extension resource. Possible values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionStatus] - :param error_info: The error detail. - :type error_info: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail + :ivar statuses: Status from this extension. + :vartype statuses: list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionStatus] + :ivar error_info: The error detail. + :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail :ivar custom_location_settings: Custom Location settings properties. :vartype custom_location_settings: dict[str, str] :ivar package_uri: Uri of the Helm package. :vartype package_uri: str - :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. - :type aks_assigned_identity: + :ivar aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :vartype aks_assigned_identity: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionPropertiesAksAssignedIdentity """ @@ -286,6 +298,39 @@ def __init__( aks_assigned_identity: Optional["ExtensionPropertiesAksAssignedIdentity"] = None, **kwargs ): + """ + :keyword identity: Identity of the Extension resource. + :paramtype identity: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Identity + :keyword extension_type: Type of the Extension, of which this resource is an instance of. It + must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :paramtype extension_type: str + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword scope: Scope at which the extension is installed. + :paramtype scope: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Scope + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + :keyword statuses: Status from this extension. + :paramtype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionStatus] + :keyword error_info: The error detail. + :paramtype error_info: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail + :keyword aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :paramtype aks_assigned_identity: + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionPropertiesAksAssignedIdentity + """ super(Extension, self).__init__(**kwargs) self.identity = identity self.system_data = None @@ -313,9 +358,9 @@ class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -335,6 +380,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -366,6 +416,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -374,17 +426,17 @@ def __init__( class ExtensionStatus(msrest.serialization.Model): """Status from the extension. - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". + :ivar code: Status code provided by the Extension. + :vartype code: str + :ivar display_status: Short description of status of the extension. + :vartype display_status: str + :ivar level: Level of the status. Possible values include: "Error", "Warning", "Information". Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str + :vartype level: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.LevelType + :ivar message: Detailed message of the status from the Extension. + :vartype message: str + :ivar time: DateLiteral (per ISO8601) noting the time of installation status. + :vartype time: str """ _attribute_map = { @@ -405,6 +457,19 @@ def __init__( time: Optional[str] = None, **kwargs ): + """ + :keyword code: Status code provided by the Extension. + :paramtype code: str + :keyword display_status: Short description of status of the extension. + :paramtype display_status: str + :keyword level: Level of the status. Possible values include: "Error", "Warning", + "Information". Default value: "Information". + :paramtype level: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.LevelType + :keyword message: Detailed message of the status from the Extension. + :paramtype message: str + :keyword time: DateLiteral (per ISO8601) noting the time of installation status. + :paramtype time: str + """ super(ExtensionStatus, self).__init__(**kwargs) self.code = code self.display_status = display_status @@ -422,9 +487,9 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -444,6 +509,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -476,6 +546,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -486,16 +558,16 @@ class OperationStatusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] - :param error: The error detail. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Required. Operation status. + :vartype status: str + :ivar properties: Additional information, if available. + :vartype properties: dict[str, str] + :ivar error: The error detail. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail """ _validation = { @@ -520,6 +592,18 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Required. Operation status. + :paramtype status: str + :keyword properties: Additional information, if available. + :paramtype properties: dict[str, str] + :keyword error: The error detail. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ErrorDetail + """ super(OperationStatusResult, self).__init__(**kwargs) self.id = id self.name = name @@ -531,21 +615,21 @@ def __init__( class PatchExtension(msrest.serialization.Model): """The Extension Patch Request object. - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] """ _attribute_map = { @@ -566,6 +650,23 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + """ super(PatchExtension, self).__init__(**kwargs) self.auto_upgrade_minor_version = auto_upgrade_minor_version self.release_train = release_train @@ -579,10 +680,10 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationDisplay :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool @@ -609,6 +710,13 @@ def __init__( display: Optional["ResourceProviderOperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationDisplay + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -619,14 +727,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -645,6 +753,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -657,8 +775,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -679,6 +797,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -687,10 +810,10 @@ def __init__( class Scope(msrest.serialization.Model): """Scope of the extension. It can be either Cluster or Namespace; but not both. - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeNamespace + :ivar cluster: Specifies that the scope of the extension is Cluster. + :vartype cluster: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeCluster + :ivar namespace: Specifies that the scope of the extension is Namespace. + :vartype namespace: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeNamespace """ _attribute_map = { @@ -705,6 +828,12 @@ def __init__( namespace: Optional["ScopeNamespace"] = None, **kwargs ): + """ + :keyword cluster: Specifies that the scope of the extension is Cluster. + :paramtype cluster: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeCluster + :keyword namespace: Specifies that the scope of the extension is Namespace. + :paramtype namespace: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ScopeNamespace + """ super(Scope, self).__init__(**kwargs) self.cluster = cluster self.namespace = namespace @@ -713,9 +842,9 @@ def __init__( class ScopeCluster(msrest.serialization.Model): """Specifies that the scope of the extension is Cluster. - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster + :ivar release_namespace: Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str + :vartype release_namespace: str """ _attribute_map = { @@ -728,6 +857,11 @@ def __init__( release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extension. If this namespace does not exist, it will be created. + :paramtype release_namespace: str + """ super(ScopeCluster, self).__init__(**kwargs) self.release_namespace = release_namespace @@ -735,9 +869,9 @@ def __init__( class ScopeNamespace(msrest.serialization.Model): """Specifies that the scope of the extension is Namespace. - :param target_namespace: Namespace where the extension will be created for an Namespace scoped + :ivar target_namespace: Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created. - :type target_namespace: str + :vartype target_namespace: str """ _attribute_map = { @@ -750,6 +884,11 @@ def __init__( target_namespace: Optional[str] = None, **kwargs ): + """ + :keyword target_namespace: Namespace where the extension will be created for an Namespace + scoped extension. If this namespace does not exist, it will be created. + :paramtype target_namespace: str + """ super(ScopeNamespace, self).__init__(**kwargs) self.target_namespace = target_namespace @@ -757,22 +896,22 @@ 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 + :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.kubernetesconfiguration.v2021_09_01.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_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 + :vartype last_modified_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -795,6 +934,24 @@ 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.kubernetesconfiguration.v2021_09_01.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.kubernetesconfiguration.v2021_09_01.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 diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_source_control_configuration_client_enums.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_source_control_configuration_client_enums.py index 19b127e8cd4c..48f19c25f2cf 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_source_control_configuration_client_enums.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/models/_source_control_configuration_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,17 +20,17 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the status. """ @@ -53,7 +38,7 @@ class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the extension resource. """ diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_extensions_operations.py index 7517bdd8cd29..4e718b52671a 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_extensions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_extensions_operations.py @@ -5,25 +5,253 @@ # 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_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # 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 + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class ExtensionsOperations(object): """ExtensionsOperations operations. @@ -49,56 +277,44 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(extension, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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('Extension', pipeline_response) @@ -110,19 +326,21 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Create a new Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -132,7 +350,8 @@ def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -141,15 +360,19 @@ def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,30 +387,21 @@ def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -199,18 +413,19 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> "_models.Extension": """Gets Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -220,7 +435,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -235,36 +451,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -273,74 +479,64 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **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-09-01" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + 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.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. @@ -351,7 +547,8 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -361,15 +558,17 @@ def begin_delete( :type force_delete: bool :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', @@ -387,24 +586,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -416,62 +605,49 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - patch_extension, # type: "_models.PatchExtension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(patch_extension, 'PatchExtension') - # 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_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.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(patch_extension, 'PatchExtension') - body_content_kwargs['content'] = body_content - request = self._client.patch(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 [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -479,19 +655,21 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - patch_extension, # type: "_models.PatchExtension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Patch an existing Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -501,7 +679,8 @@ def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -510,15 +689,19 @@ def begin_update( :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.PatchExtension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -533,30 +716,21 @@ def begin_update( cluster_name=cluster_name, extension_name=extension_name, patch_extension=patch_extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -568,17 +742,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionsList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionsList"]: """List all Extensions in the cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -588,12 +763,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionsList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -601,38 +778,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -645,12 +821,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operation_status_operations.py index 1343bf366415..c418a705a301 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operation_status_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operation_status_operations.py @@ -5,23 +5,107 @@ # 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.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 +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_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 + ) class OperationStatusOperations(object): """OperationStatusOperations operations. @@ -45,15 +129,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationStatusList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.OperationStatusList"]: """List Async Operations, currently in progress, in a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,12 +147,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.OperationStatusList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -76,38 +162,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,28 +205,29 @@ def get_next(next_link=None): response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResult" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": """Get Async Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -151,7 +237,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -168,37 +255,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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') - - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -207,4 +284,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operations.py index 1cb21812c9b8..e18d70e2222e 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_09_01/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-09-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/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 Operations(object): """Operations operations. @@ -45,17 +72,19 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports, in this api-version. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_09_01.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -63,30 +92,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-01" - 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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -99,12 +125,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/__init__.py index f13062376d74..e90963036337 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_configuration.py index bfc7dcb3271f..b822e7bc3188 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_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,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(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(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_metadata.json index f8ba9eaaf203..01d314d2c497 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_metadata.json +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "SourceControlConfigurationClient", "filename": "_source_control_configuration_client", "description": "KubernetesConfiguration Client.", - "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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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": { "extensions": "ExtensionsOperations", diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_source_control_configuration_client.py index 83ffa08737e0..7a4739e5d02d 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_source_control_configuration_client.py @@ -6,119 +6,115 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import ClusterExtensionTypeOperations, ClusterExtensionTypesOperations, ExtensionTypeVersionsOperations, ExtensionsOperations, FluxConfigOperationStatusOperations, FluxConfigurationsOperations, LocationExtensionTypesOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + 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 SourceControlConfigurationClientConfiguration -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import ClusterExtensionTypeOperations -from .operations import ClusterExtensionTypesOperations -from .operations import ExtensionTypeVersionsOperations -from .operations import LocationExtensionTypesOperations -from .operations import SourceControlConfigurationsOperations -from .operations import FluxConfigurationsOperations -from .operations import FluxConfigOperationStatusOperations -from .operations import Operations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.OperationStatusOperations :ivar cluster_extension_type: ClusterExtensionTypeOperations operations - :vartype cluster_extension_type: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ClusterExtensionTypeOperations + :vartype cluster_extension_type: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ClusterExtensionTypeOperations :ivar cluster_extension_types: ClusterExtensionTypesOperations operations - :vartype cluster_extension_types: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ClusterExtensionTypesOperations + :vartype cluster_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ClusterExtensionTypesOperations :ivar extension_type_versions: ExtensionTypeVersionsOperations operations - :vartype extension_type_versions: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ExtensionTypeVersionsOperations + :vartype extension_type_versions: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.ExtensionTypeVersionsOperations :ivar location_extension_types: LocationExtensionTypesOperations operations - :vartype location_extension_types: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.LocationExtensionTypesOperations + :vartype location_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.LocationExtensionTypesOperations :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.SourceControlConfigurationsOperations :ivar flux_configurations: FluxConfigurationsOperations operations - :vartype flux_configurations: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.FluxConfigurationsOperations + :vartype flux_configurations: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.FluxConfigurationsOperations :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations - :vartype flux_config_operation_status: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.FluxConfigOperationStatusOperations + :vartype flux_config_operation_status: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.FluxConfigOperationStatusOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(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.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_type = ClusterExtensionTypeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_types = ClusterExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extension_type_versions = ExtensionTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location_extension_types = LocationExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_configurations = FluxConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_config_operation_status = FluxConfigOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_type = ClusterExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_types = ClusterExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type_versions = ExtensionTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.location_extension_types = LocationExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_configurations = FluxConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_config_operation_status = FluxConfigOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + + 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', min_length=1), - } - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_version.py index c47f66669f1b..59deb8c7263b 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_version.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0" diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/__init__.py index ba52c91a7ba1..5f583276b4ed 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_configuration.py index bce1f6a3c169..b86d839a94e6 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/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,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_source_control_configuration_client.py index dbc71d712f5d..e46bfe1b8855 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/_source_control_configuration_client.py @@ -6,115 +6,115 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import ClusterExtensionTypeOperations, ClusterExtensionTypesOperations, ExtensionTypeVersionsOperations, ExtensionsOperations, FluxConfigOperationStatusOperations, FluxConfigurationsOperations, LocationExtensionTypesOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import ClusterExtensionTypeOperations -from .operations import ClusterExtensionTypesOperations -from .operations import ExtensionTypeVersionsOperations -from .operations import LocationExtensionTypesOperations -from .operations import SourceControlConfigurationsOperations -from .operations import FluxConfigurationsOperations -from .operations import FluxConfigOperationStatusOperations -from .operations import Operations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.OperationStatusOperations :ivar cluster_extension_type: ClusterExtensionTypeOperations operations - :vartype cluster_extension_type: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ClusterExtensionTypeOperations + :vartype cluster_extension_type: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ClusterExtensionTypeOperations :ivar cluster_extension_types: ClusterExtensionTypesOperations operations - :vartype cluster_extension_types: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ClusterExtensionTypesOperations + :vartype cluster_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ClusterExtensionTypesOperations :ivar extension_type_versions: ExtensionTypeVersionsOperations operations - :vartype extension_type_versions: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ExtensionTypeVersionsOperations + :vartype extension_type_versions: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.ExtensionTypeVersionsOperations :ivar location_extension_types: LocationExtensionTypesOperations operations - :vartype location_extension_types: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.LocationExtensionTypesOperations + :vartype location_extension_types: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.LocationExtensionTypesOperations :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.SourceControlConfigurationsOperations :ivar flux_configurations: FluxConfigurationsOperations operations - :vartype flux_configurations: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.FluxConfigurationsOperations + :vartype flux_configurations: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.FluxConfigurationsOperations :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations - :vartype flux_config_operation_status: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.FluxConfigOperationStatusOperations + :vartype flux_config_operation_status: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.FluxConfigOperationStatusOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(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.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_type = ClusterExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_types = ClusterExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type_versions = ExtensionTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.location_extension_types = LocationExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_configurations = FluxConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_config_operation_status = FluxConfigOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_type = ClusterExtensionTypeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_types = ClusterExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extension_type_versions = ExtensionTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location_extension_types = LocationExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_configurations = FluxConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_config_operation_status = FluxConfigOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - 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', min_length=1), - } - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_type_operations.py index a18843f70716..0f6ebc8b36af 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_type_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_type_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, Union 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._cluster_extension_type_operations import build_get_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 get( self, resource_group_name: str, @@ -58,7 +63,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_type_name: Extension type name. @@ -73,36 +79,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionType', pipeline_response) @@ -111,4 +107,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_types_operations.py index 3c3bf55c4adb..ddeddcf87c6c 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_types_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_cluster_extension_types_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, 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.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._cluster_extension_types_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, resource_group_name: str, @@ -58,12 +64,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -71,38 +79,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,12 +122,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extension_type_versions_operations.py index 851eaef220ca..2fb6a487db61 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extension_type_versions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extension_type_versions_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._extension_type_versions_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, location: str, @@ -54,8 +60,10 @@ def list( :param extension_type_name: Extension type name. :type extension_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionList] + :return: An iterator like instance of either ExtensionVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] @@ -63,36 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_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_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + 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, + location=location, + extension_type_name=extension_type_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('ExtensionVersionList', pipeline_response) + deserialized = self._deserialize("ExtensionVersionList", pipeline_response) list_of_elem = deserialized.versions if cls: list_of_elem = cls(list_of_elem) @@ -105,12 +110,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extensions_operations.py index c791c42c6243..a80a7a43909c 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extensions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_extensions_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._extensions_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,42 +63,31 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(extension, 'Extension') - # 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_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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('Extension', pipeline_response) @@ -105,8 +99,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -126,7 +123,8 @@ async def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -135,15 +133,20 @@ async def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,30 +161,21 @@ async def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -193,8 +187,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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -213,7 +209,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -228,36 +225,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -266,8 +253,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -283,45 +272,35 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + 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.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -342,7 +321,8 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -352,15 +332,17 @@ async def begin_delete( :type force_delete: bool :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', @@ -378,24 +360,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -407,6 +379,7 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore async def _update_initial( @@ -421,47 +394,34 @@ async def _update_initial( ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(patch_extension, 'PatchExtension') - # 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_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.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(patch_extension, 'PatchExtension') - body_content_kwargs['content'] = body_content - request = self._client.patch(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 [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -469,8 +429,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -490,24 +453,31 @@ async def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. :type extension_name: str :param patch_extension: Properties to Patch in an existing Extension. - :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.PatchExtension + :type patch_extension: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.PatchExtension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -522,30 +492,21 @@ async def begin_update( cluster_name=cluster_name, extension_name=extension_name, patch_extension=patch_extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -557,8 +518,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -576,12 +539,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -589,38 +554,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -633,12 +597,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_config_operation_status_operations.py index bc1c6c9bc76f..278055cbaf8d 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_config_operation_status_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_config_operation_status_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, Union 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._flux_config_operation_status_operations import build_get_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 get( self, resource_group_name: str, @@ -59,7 +64,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -76,37 +82,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + operation_id=operation_id, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -115,4 +111,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_configurations_operations.py index 73134513fb39..75827d96b95d 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_flux_configurations_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._flux_configurations_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial 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_async async def get( self, resource_group_name: str, @@ -61,7 +67,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -76,36 +83,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -114,8 +111,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -128,47 +127,34 @@ async def _create_or_update_initial( ) -> "_models.FluxConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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(flux_configuration, 'FluxConfiguration') - # 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_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.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(flux_configuration, 'FluxConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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('FluxConfiguration', pipeline_response) @@ -180,8 +166,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -201,24 +190,31 @@ async def begin_create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration: Properties necessary to Create a FluxConfiguration. - :type flux_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] + :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.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -233,30 +229,21 @@ async def begin_create_or_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration=flux_configuration, + 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('FluxConfiguration', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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: @@ -268,6 +255,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore async def _update_initial( @@ -282,47 +270,34 @@ async def _update_initial( ) -> "_models.FluxConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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(flux_configuration_patch, 'FluxConfigurationPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.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(flux_configuration_patch, 'FluxConfigurationPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(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 [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -330,8 +305,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -351,24 +329,31 @@ async def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. - :type flux_configuration_patch: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationPatch + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationPatch :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] + :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.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -383,30 +368,21 @@ async def begin_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration_patch=flux_configuration_patch, + 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('FluxConfiguration', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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: @@ -418,6 +394,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore async def _delete_initial( @@ -435,45 +412,35 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + 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.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -494,7 +461,8 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -504,15 +472,17 @@ async def begin_delete( :type force_delete: bool :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', @@ -530,24 +500,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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: @@ -559,8 +519,10 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -578,12 +540,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FluxConfigurationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationsList] + :return: An iterator like instance of either FluxConfigurationsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfigurationsList"] @@ -591,38 +556,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('FluxConfigurationsList', pipeline_response) + deserialized = self._deserialize("FluxConfigurationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -635,12 +599,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_location_extension_types_operations.py index a77c4936e7b0..4dfb3b692cd2 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_location_extension_types_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_location_extension_types_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._location_extension_types_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, location: str, @@ -52,7 +58,8 @@ def list( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -60,35 +67,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'location': self._serialize.url("location", location, '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, + location=location, + 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, + location=location, + 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('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,12 +104,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operation_status_operations.py index 4369806defa6..ca83ab69e8d7 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operation_status_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operation_status_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, 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.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._operation_status_operations import build_get_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_async async def get( self, resource_group_name: str, @@ -60,7 +66,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -77,37 +84,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -116,8 +113,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -135,12 +135,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -148,38 +150,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,12 +193,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operations.py index a56f63e27878..bff33128e433 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/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._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 @@ -48,8 +54,10 @@ def list( """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_source_control_configurations_operations.py index faf725104dfb..9e25d1d37963 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_source_control_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/aio/operations/_source_control_configurations_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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_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_async async def get( self, resource_group_name: str, @@ -61,14 +67,16 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -76,36 +84,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -114,8 +112,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -135,16 +136,19 @@ async def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -152,41 +156,31 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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(source_control_configuration, 'SourceControlConfiguration') - # 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_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.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(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,8 +193,10 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -215,43 +211,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -271,22 +258,25 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_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', @@ -303,24 +293,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,8 +312,10 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -351,12 +333,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -364,38 +349,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -408,12 +392,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/__init__.py index f69d190854ae..b83d70226f0b 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/__init__.py @@ -6,90 +6,48 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ClusterScopeSettings - from ._models_py3 import ComplianceStatus - from ._models_py3 import DependsOnDefinition - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import Extension - from ._models_py3 import ExtensionPropertiesAksAssignedIdentity - from ._models_py3 import ExtensionStatus - from ._models_py3 import ExtensionType - from ._models_py3 import ExtensionTypeList - from ._models_py3 import ExtensionVersionList - from ._models_py3 import ExtensionVersionListVersionsItem - from ._models_py3 import ExtensionsList - from ._models_py3 import FluxConfiguration - from ._models_py3 import FluxConfigurationPatch - from ._models_py3 import FluxConfigurationsList - from ._models_py3 import GitRepositoryDefinition - from ._models_py3 import HelmOperatorProperties - from ._models_py3 import HelmReleasePropertiesDefinition - from ._models_py3 import Identity - from ._models_py3 import KustomizationDefinition - from ._models_py3 import ObjectReferenceDefinition - from ._models_py3 import ObjectStatusConditionDefinition - from ._models_py3 import ObjectStatusDefinition - from ._models_py3 import OperationStatusList - from ._models_py3 import OperationStatusResult - from ._models_py3 import PatchExtension - from ._models_py3 import ProxyResource - from ._models_py3 import RepositoryRefDefinition - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Scope - from ._models_py3 import ScopeCluster - from ._models_py3 import ScopeNamespace - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList - from ._models_py3 import SupportedScopes - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import ClusterScopeSettings # type: ignore - from ._models import ComplianceStatus # type: ignore - from ._models import DependsOnDefinition # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Extension # type: ignore - from ._models import ExtensionPropertiesAksAssignedIdentity # type: ignore - from ._models import ExtensionStatus # type: ignore - from ._models import ExtensionType # type: ignore - from ._models import ExtensionTypeList # type: ignore - from ._models import ExtensionVersionList # type: ignore - from ._models import ExtensionVersionListVersionsItem # type: ignore - from ._models import ExtensionsList # type: ignore - from ._models import FluxConfiguration # type: ignore - from ._models import FluxConfigurationPatch # type: ignore - from ._models import FluxConfigurationsList # type: ignore - from ._models import GitRepositoryDefinition # type: ignore - from ._models import HelmOperatorProperties # type: ignore - from ._models import HelmReleasePropertiesDefinition # type: ignore - from ._models import Identity # type: ignore - from ._models import KustomizationDefinition # type: ignore - from ._models import ObjectReferenceDefinition # type: ignore - from ._models import ObjectStatusConditionDefinition # type: ignore - from ._models import ObjectStatusDefinition # type: ignore - from ._models import OperationStatusList # type: ignore - from ._models import OperationStatusResult # type: ignore - from ._models import PatchExtension # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RepositoryRefDefinition # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Scope # type: ignore - from ._models import ScopeCluster # type: ignore - from ._models import ScopeNamespace # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore - from ._models import SupportedScopes # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import ClusterScopeSettings +from ._models_py3 import ComplianceStatus +from ._models_py3 import DependsOnDefinition +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Extension +from ._models_py3 import ExtensionPropertiesAksAssignedIdentity +from ._models_py3 import ExtensionStatus +from ._models_py3 import ExtensionType +from ._models_py3 import ExtensionTypeList +from ._models_py3 import ExtensionVersionList +from ._models_py3 import ExtensionVersionListVersionsItem +from ._models_py3 import ExtensionsList +from ._models_py3 import FluxConfiguration +from ._models_py3 import FluxConfigurationPatch +from ._models_py3 import FluxConfigurationsList +from ._models_py3 import GitRepositoryDefinition +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import HelmReleasePropertiesDefinition +from ._models_py3 import Identity +from ._models_py3 import KustomizationDefinition +from ._models_py3 import ObjectReferenceDefinition +from ._models_py3 import ObjectStatusConditionDefinition +from ._models_py3 import ObjectStatusDefinition +from ._models_py3 import OperationStatusList +from ._models_py3 import OperationStatusResult +from ._models_py3 import PatchExtension +from ._models_py3 import ProxyResource +from ._models_py3 import RepositoryRefDefinition +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Scope +from ._models_py3 import ScopeCluster +from ._models_py3 import ScopeNamespace +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SupportedScopes +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( ClusterTypes, diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_models.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_models.py deleted file mode 100644 index c47ff7c1cdeb..000000000000 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_models.py +++ /dev/null @@ -1,1639 +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 Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ClusterScopeSettings(ProxyResource): - """Extension scope settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param allow_multiple_instances: Describes if multiple instances of the extension are allowed. - :type allow_multiple_instances: bool - :param default_release_namespace: Default extension release namespace. - :type default_release_namespace: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'allow_multiple_instances': {'key': 'properties.allowMultipleInstances', 'type': 'bool'}, - 'default_release_namespace': {'key': 'properties.defaultReleaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterScopeSettings, self).__init__(**kwargs) - self.allow_multiple_instances = kwargs.get('allow_multiple_instances', None) - self.default_release_namespace = kwargs.get('default_release_namespace', None) - - -class ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.MessageLevelType - """ - - _validation = { - 'compliance_state': {'readonly': True}, - } - - _attribute_map = { - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'message_level': {'key': 'messageLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class DependsOnDefinition(msrest.serialization.Model): - """Specify which kustomizations must succeed reconciliation on the cluster prior to reconciling this kustomization. - - :param kustomization_name: Name of the kustomization to claim dependency on. - :type kustomization_name: str - """ - - _attribute_map = { - 'kustomization_name': {'key': 'kustomizationName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DependsOnDefinition, self).__init__(**kwargs) - self.kustomization_name = kwargs.get('kustomization_name', None) - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class Extension(ProxyResource): - """The Extension object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Identity - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the - Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - :ivar provisioning_state: Status of installation of this extension. Possible values include: - "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionStatus] - :ivar error_info: Error information from the Agent - e.g. errors during installation. - :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail - :ivar custom_location_settings: Custom Location settings properties. - :vartype custom_location_settings: dict[str, str] - :ivar package_uri: Uri of the Helm package. - :vartype package_uri: str - :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. - :type aks_assigned_identity: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionPropertiesAksAssignedIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'error_info': {'readonly': True}, - 'custom_location_settings': {'readonly': True}, - 'package_uri': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'Scope'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, - 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDetail'}, - 'custom_location_settings': {'key': 'properties.customLocationSettings', 'type': '{str}'}, - 'package_uri': {'key': 'properties.packageUri', 'type': 'str'}, - 'aks_assigned_identity': {'key': 'properties.aksAssignedIdentity', 'type': 'ExtensionPropertiesAksAssignedIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(Extension, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.extension_type = kwargs.get('extension_type', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.scope = kwargs.get('scope', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.provisioning_state = None - self.statuses = kwargs.get('statuses', None) - self.error_info = None - self.custom_location_settings = None - self.package_uri = None - self.aks_assigned_identity = kwargs.get('aks_assigned_identity', None) - - -class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): - """Identity of the Extension resource in an AKS cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class ExtensionsList(msrest.serialization.Model): - """Result of the request to list Extensions. It contains a list of Extension objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Extensions within a Kubernetes cluster. - :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] - :ivar next_link: URL to get the next set of extension objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Extension]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExtensionStatus(msrest.serialization.Model): - """Status from the extension. - - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". - Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionStatus, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.display_status = kwargs.get('display_status', None) - self.level = kwargs.get('level', "Information") - self.message = kwargs.get('message', None) - self.time = kwargs.get('time', None) - - -class ExtensionType(msrest.serialization.Model): - """Represents an Extension Type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :ivar release_trains: Extension release train: preview or stable. - :vartype release_trains: list[str] - :ivar cluster_types: Cluster types. Possible values include: "connectedClusters", - "managedClusters". - :vartype cluster_types: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ClusterTypes - :ivar supported_scopes: Extension scopes. - :vartype supported_scopes: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SupportedScopes - """ - - _validation = { - 'system_data': {'readonly': True}, - 'release_trains': {'readonly': True}, - 'cluster_types': {'readonly': True}, - 'supported_scopes': {'readonly': True}, - } - - _attribute_map = { - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'release_trains': {'key': 'properties.releaseTrains', 'type': '[str]'}, - 'cluster_types': {'key': 'properties.clusterTypes', 'type': 'str'}, - 'supported_scopes': {'key': 'properties.supportedScopes', 'type': 'SupportedScopes'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionType, self).__init__(**kwargs) - self.system_data = None - self.release_trains = None - self.cluster_types = None - self.supported_scopes = None - - -class ExtensionTypeList(msrest.serialization.Model): - """List Extension Types. - - :param value: The list of Extension Types. - :type value: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtensionType]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionTypeList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ExtensionVersionList(msrest.serialization.Model): - """List versions for an Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param versions: Versions available for this Extension Type. - :type versions: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionListVersionsItem] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - """ - - _validation = { - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'versions': {'key': 'versions', 'type': '[ExtensionVersionListVersionsItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionVersionList, self).__init__(**kwargs) - self.versions = kwargs.get('versions', None) - self.next_link = kwargs.get('next_link', None) - self.system_data = None - - -class ExtensionVersionListVersionsItem(msrest.serialization.Model): - """ExtensionVersionListVersionsItem. - - :param release_train: The release train for this Extension Type. - :type release_train: str - :param versions: Versions available for this Extension Type and release train. - :type versions: list[str] - """ - - _attribute_map = { - 'release_train': {'key': 'releaseTrain', 'type': 'str'}, - 'versions': {'key': 'versions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionVersionListVersionsItem, self).__init__(**kwargs) - self.release_train = kwargs.get('release_train', None) - self.versions = kwargs.get('versions', None) - - -class FluxConfiguration(ProxyResource): - """The Flux Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :param scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type scope: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeType - :param namespace: The namespace to which this configuration is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type namespace: str - :param source_kind: Source Kind to pull the configuration data from. Possible values include: - "GitRepository". - :type source_kind: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its - kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.GitRepositoryDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the - source type on the cluster. - :type kustomizations: dict[str, - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :ivar statuses: Statuses of the Flux Kubernetes resources created by the fluxConfiguration or - created by the managed objects provisioned by the fluxConfiguration. - :vartype statuses: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectStatusDefinition] - :ivar repository_public_key: Public Key associated with this fluxConfiguration (either - generated within the cluster or provided by the user). - :vartype repository_public_key: str - :ivar last_source_synced_commit_id: Branch and SHA of the last source commit synced with the - cluster. - :vartype last_source_synced_commit_id: str - :ivar last_source_synced_at: Datetime the fluxConfiguration last synced its source on the - cluster. - :vartype last_source_synced_at: ~datetime.datetime - :ivar compliance_state: Combined status of the Flux Kubernetes resources created by the - fluxConfiguration or created by the managed objects. Possible values include: "Compliant", - "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxComplianceState - :ivar provisioning_state: Status of the creation of the fluxConfiguration. Possible values - include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ProvisioningState - :ivar error_message: Error message returned to the user in the case of provisioning failure. - :vartype error_message: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'statuses': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'last_source_synced_commit_id': {'readonly': True}, - 'last_source_synced_at': {'readonly': True}, - 'compliance_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'error_message': {'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'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'namespace': {'key': 'properties.namespace', 'type': 'str'}, - 'source_kind': {'key': 'properties.sourceKind', 'type': 'str'}, - 'suspend': {'key': 'properties.suspend', 'type': 'bool'}, - 'git_repository': {'key': 'properties.gitRepository', 'type': 'GitRepositoryDefinition'}, - 'kustomizations': {'key': 'properties.kustomizations', 'type': '{KustomizationDefinition}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ObjectStatusDefinition]'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'last_source_synced_commit_id': {'key': 'properties.lastSourceSyncedCommitId', 'type': 'str'}, - 'last_source_synced_at': {'key': 'properties.lastSourceSyncedAt', 'type': 'iso-8601'}, - 'compliance_state': {'key': 'properties.complianceState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FluxConfiguration, self).__init__(**kwargs) - self.system_data = None - self.scope = kwargs.get('scope', "cluster") - self.namespace = kwargs.get('namespace', "default") - self.source_kind = kwargs.get('source_kind', None) - self.suspend = kwargs.get('suspend', False) - self.git_repository = kwargs.get('git_repository', None) - self.kustomizations = kwargs.get('kustomizations', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.statuses = None - self.repository_public_key = None - self.last_source_synced_commit_id = None - self.last_source_synced_at = None - self.compliance_state = None - self.provisioning_state = None - self.error_message = None - - -class FluxConfigurationPatch(msrest.serialization.Model): - """The Flux Configuration Patch Request object. - - :param source_kind: Source Kind to pull the configuration data from. Possible values include: - "GitRepository". - :type source_kind: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its - kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.GitRepositoryDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the - source type on the cluster. - :type kustomizations: dict[str, - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - """ - - _attribute_map = { - 'source_kind': {'key': 'properties.sourceKind', 'type': 'str'}, - 'suspend': {'key': 'properties.suspend', 'type': 'bool'}, - 'git_repository': {'key': 'properties.gitRepository', 'type': 'GitRepositoryDefinition'}, - 'kustomizations': {'key': 'properties.kustomizations', 'type': '{KustomizationDefinition}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(FluxConfigurationPatch, self).__init__(**kwargs) - self.source_kind = kwargs.get('source_kind', None) - self.suspend = kwargs.get('suspend', False) - self.git_repository = kwargs.get('git_repository', None) - self.kustomizations = kwargs.get('kustomizations', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - - -class FluxConfigurationsList(msrest.serialization.Model): - """Result of the request to list Flux Configurations. It contains a list of FluxConfiguration objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Flux Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FluxConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FluxConfigurationsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class GitRepositoryDefinition(msrest.serialization.Model): - """Parameters to reconcile to the GitRepository source kind type. - - :param url: The URL to sync for the flux configuration git repository. - :type url: str - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository - source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git - repository source with the remote. - :type sync_interval_in_seconds: long - :param repository_ref: The source reference for the GitRepository object. - :type repository_ref: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.RepositoryRefDefinition - :param ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to - access private git repositories over SSH. - :type ssh_known_hosts: str - :param https_user: Base64-encoded HTTPS username used to access private git repositories over - HTTPS. - :type https_user: str - :param https_ca_file: Base64-encoded HTTPS certificate authority contents used to access git - private git repositories over HTTPS. - :type https_ca_file: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the - authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'repository_ref': {'key': 'repositoryRef', 'type': 'RepositoryRefDefinition'}, - 'ssh_known_hosts': {'key': 'sshKnownHosts', 'type': 'str'}, - 'https_user': {'key': 'httpsUser', 'type': 'str'}, - 'https_ca_file': {'key': 'httpsCAFile', 'type': 'str'}, - 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GitRepositoryDefinition, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', 600) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', 600) - self.repository_ref = kwargs.get('repository_ref', None) - self.ssh_known_hosts = kwargs.get('ssh_known_hosts', None) - self.https_user = kwargs.get('https_user', None) - self.https_ca_file = kwargs.get('https_ca_file', None) - self.local_auth_ref = kwargs.get('local_auth_ref', None) - - -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. - - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str - """ - - _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) - - -class HelmReleasePropertiesDefinition(msrest.serialization.Model): - """HelmReleasePropertiesDefinition. - - :param last_revision_applied: The revision number of the last released object change. - :type last_revision_applied: long - :param helm_chart_ref: The reference to the HelmChart object used as the source to this - HelmRelease. - :type helm_chart_ref: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectReferenceDefinition - :param failure_count: Total number of times that the HelmRelease failed to install or upgrade. - :type failure_count: long - :param install_failure_count: Number of times that the HelmRelease failed to install. - :type install_failure_count: long - :param upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. - :type upgrade_failure_count: long - """ - - _attribute_map = { - 'last_revision_applied': {'key': 'lastRevisionApplied', 'type': 'long'}, - 'helm_chart_ref': {'key': 'helmChartRef', 'type': 'ObjectReferenceDefinition'}, - 'failure_count': {'key': 'failureCount', 'type': 'long'}, - 'install_failure_count': {'key': 'installFailureCount', 'type': 'long'}, - 'upgrade_failure_count': {'key': 'upgradeFailureCount', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmReleasePropertiesDefinition, self).__init__(**kwargs) - self.last_revision_applied = kwargs.get('last_revision_applied', None) - self.helm_chart_ref = kwargs.get('helm_chart_ref', None) - self.failure_count = kwargs.get('failure_count', None) - self.install_failure_count = kwargs.get('install_failure_count', None) - self.upgrade_failure_count = kwargs.get('upgrade_failure_count', None) - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class KustomizationDefinition(msrest.serialization.Model): - """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. - - :param path: The path in the source reference to reconcile on the cluster. - :type path: str - :param depends_on: Specifies other Kustomizations that this Kustomization depends on. This - Kustomization will not reconcile until all dependencies have completed their reconciliation. - :type depends_on: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.DependsOnDefinition] - :param timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the - cluster. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the - cluster. - :type sync_interval_in_seconds: long - :param retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on - the cluster in the event of failure on reconciliation. - :type retry_interval_in_seconds: long - :param prune: Enable/disable garbage collections of Kubernetes objects created by this - Kustomization. - :type prune: bool - :param validation: Specify whether to validate the Kubernetes objects referenced in the - Kustomization before applying them to the cluster. Possible values include: "none", "client", - "server". Default value: "none". - :type validation: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationValidationType - :param force: Enable/disable re-creating Kubernetes resources on the cluster when patching - fails due to an immutable field change. - :type force: bool - """ - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'depends_on': {'key': 'dependsOn', 'type': '[DependsOnDefinition]'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'retry_interval_in_seconds': {'key': 'retryIntervalInSeconds', 'type': 'long'}, - 'prune': {'key': 'prune', 'type': 'bool'}, - 'validation': {'key': 'validation', 'type': 'str'}, - 'force': {'key': 'force', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(KustomizationDefinition, self).__init__(**kwargs) - self.path = kwargs.get('path', "") - self.depends_on = kwargs.get('depends_on', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', 600) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', 600) - self.retry_interval_in_seconds = kwargs.get('retry_interval_in_seconds', None) - self.prune = kwargs.get('prune', False) - self.validation = kwargs.get('validation', "none") - self.force = kwargs.get('force', False) - - -class ObjectReferenceDefinition(msrest.serialization.Model): - """Object reference to a Kubernetes object on a cluster. - - :param name: Name of the object. - :type name: str - :param namespace: Namespace of the object. - :type namespace: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReferenceDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.namespace = kwargs.get('namespace', None) - - -class ObjectStatusConditionDefinition(msrest.serialization.Model): - """Status condition of Kubernetes object. - - :param last_transition_time: Last time this status condition has changed. - :type last_transition_time: ~datetime.datetime - :param message: A more verbose description of the object status condition. - :type message: str - :param reason: Reason for the specified status condition type status. - :type reason: str - :param status: Status of the Kubernetes object condition type. - :type status: str - :param type: Object status condition type for this object. - :type type: str - """ - - _attribute_map = { - 'last_transition_time': {'key': 'lastTransitionTime', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectStatusConditionDefinition, self).__init__(**kwargs) - self.last_transition_time = kwargs.get('last_transition_time', None) - self.message = kwargs.get('message', None) - self.reason = kwargs.get('reason', None) - self.status = kwargs.get('status', None) - self.type = kwargs.get('type', None) - - -class ObjectStatusDefinition(msrest.serialization.Model): - """Statuses of objects deployed by the user-specified kustomizations from the git repository. - - :param name: Name of the applied object. - :type name: str - :param namespace: Namespace of the applied object. - :type namespace: str - :param kind: Kind of the applied object. - :type kind: str - :param compliance_state: Compliance state of the applied object showing whether the applied - object has come into a ready state on the cluster. Possible values include: "Compliant", - "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". - :type compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxComplianceState - :param applied_by: Object reference to the Kustomization that applied this object. - :type applied_by: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectReferenceDefinition - :param status_conditions: List of Kubernetes object status conditions present on the cluster. - :type status_conditions: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectStatusConditionDefinition] - :param helm_release_properties: Additional properties that are provided from objects of the - HelmRelease kind. - :type helm_release_properties: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.HelmReleasePropertiesDefinition - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'applied_by': {'key': 'appliedBy', 'type': 'ObjectReferenceDefinition'}, - 'status_conditions': {'key': 'statusConditions', 'type': '[ObjectStatusConditionDefinition]'}, - 'helm_release_properties': {'key': 'helmReleaseProperties', 'type': 'HelmReleasePropertiesDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectStatusDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.namespace = kwargs.get('namespace', None) - self.kind = kwargs.get('kind', None) - self.compliance_state = kwargs.get('compliance_state', "Unknown") - self.applied_by = kwargs.get('applied_by', None) - self.status_conditions = kwargs.get('status_conditions', None) - self.helm_release_properties = kwargs.get('helm_release_properties', None) - - -class OperationStatusList(msrest.serialization.Model): - """The async operations in progress, in the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of async operations in progress, in the cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusResult] - :ivar next_link: URL to get the next set of Operation Result objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationStatusResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OperationStatusResult(msrest.serialization.Model): - """The current status of an async operation. - - 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 id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] - :ivar error: If present, details of the operation error. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail - """ - - _validation = { - 'status': {'required': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResult, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.status = kwargs['status'] - self.properties = kwargs.get('properties', None) - self.error = None - - -class PatchExtension(msrest.serialization.Model): - """The Extension Patch Request object. - - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - """ - - _attribute_map = { - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(PatchExtension, self).__init__(**kwargs) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - - -class RepositoryRefDefinition(msrest.serialization.Model): - """The source reference for the GitRepository object. - - :param branch: The git repository branch name to checkout. - :type branch: str - :param tag: The git repository tag name to checkout. This takes precedence over branch. - :type tag: str - :param semver: The semver range used to match against git repository tags. This takes - precedence over tag. - :type semver: str - :param commit: The commit SHA to checkout. This value must be combined with the branch name to - be valid. This takes precedence over semver. - :type commit: str - """ - - _attribute_map = { - 'branch': {'key': 'branch', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'semver': {'key': 'semver', 'type': 'str'}, - 'commit': {'key': 'commit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RepositoryRefDefinition, self).__init__(**kwargs) - self.branch = kwargs.get('branch', None) - self.tag = kwargs.get('tag', None) - self.semver = kwargs.get('semver', None) - self.commit = kwargs.get('commit', None) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationDisplay - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - :ivar origin: Origin of the operation. - :vartype origin: str - """ - - _validation = { - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = None - self.origin = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :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(ResourceProviderOperationDisplay, 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 ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Scope(msrest.serialization.Model): - """Scope of the extension. It can be either Cluster or Namespace; but not both. - - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeNamespace - """ - - _attribute_map = { - 'cluster': {'key': 'cluster', 'type': 'ScopeCluster'}, - 'namespace': {'key': 'namespace', 'type': 'ScopeNamespace'}, - } - - def __init__( - self, - **kwargs - ): - super(Scope, self).__init__(**kwargs) - self.cluster = kwargs.get('cluster', None) - self.namespace = kwargs.get('namespace', None) - - -class ScopeCluster(msrest.serialization.Model): - """Specifies that the scope of the extension is Cluster. - - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster - scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str - """ - - _attribute_map = { - 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeCluster, self).__init__(**kwargs) - self.release_namespace = kwargs.get('release_namespace', None) - - -class ScopeNamespace(msrest.serialization.Model): - """Specifies that the scope of the extension is Namespace. - - :param target_namespace: Namespace where the extension will be created for an Namespace scoped - extension. If this namespace does not exist, it will be created. - :type target_namespace: str - """ - - _attribute_map = { - 'target_namespace': {'key': 'targetNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeNamespace, self).__init__(**kwargs) - self.target_namespace = kwargs.get('target_namespace', None) - - -class SourceControlConfiguration(ProxyResource): - """The SourceControl Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperatorScopeType - :ivar repository_public_key: Public Key associated with this SourceControl configuration - (either generated within the cluster or provided by the user). - :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'compliance_status': {'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'}, - 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, - 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, - 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, - 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, - 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, - 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, - 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.system_data = None - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.serialization.Model): - """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Source Control Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SupportedScopes(msrest.serialization.Model): - """Extension scopes. - - :param default_scope: Default extension scopes: cluster or namespace. - :type default_scope: str - :param cluster_scope_settings: Scope settings. - :type cluster_scope_settings: - ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ClusterScopeSettings - """ - - _attribute_map = { - 'default_scope': {'key': 'defaultScope', 'type': 'str'}, - 'cluster_scope_settings': {'key': 'clusterScopeSettings', 'type': 'ClusterScopeSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedScopes, self).__init__(**kwargs) - self.default_scope = kwargs.get('default_scope', None) - self.cluster_scope_settings = kwargs.get('cluster_scope_settings', 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.kubernetesconfiguration.v2021_11_01_preview.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.kubernetesconfiguration.v2021_11_01_preview.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) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_models_py3.py index fa18f2b46c9f..b7d98fd1b6d0 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_models_py3.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_models_py3.py @@ -46,6 +46,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -83,6 +85,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -99,10 +103,10 @@ class ClusterScopeSettings(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param allow_multiple_instances: Describes if multiple instances of the extension are allowed. - :type allow_multiple_instances: bool - :param default_release_namespace: Default extension release namespace. - :type default_release_namespace: str + :ivar allow_multiple_instances: Describes if multiple instances of the extension are allowed. + :vartype allow_multiple_instances: bool + :ivar default_release_namespace: Default extension release namespace. + :vartype default_release_namespace: str """ _validation = { @@ -126,6 +130,13 @@ def __init__( default_release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword allow_multiple_instances: Describes if multiple instances of the extension are + allowed. + :paramtype allow_multiple_instances: bool + :keyword default_release_namespace: Default extension release namespace. + :paramtype default_release_namespace: str + """ super(ClusterScopeSettings, self).__init__(**kwargs) self.allow_multiple_instances = allow_multiple_instances self.default_release_namespace = default_release_namespace @@ -140,13 +151,13 @@ class ComplianceStatus(msrest.serialization.Model): "Pending", "Compliant", "Noncompliant", "Installed", "Failed". :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", "Information". - :type message_level: str or + :vartype message_level: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.MessageLevelType """ @@ -169,6 +180,16 @@ def __init__( message_level: Optional[Union[str, "MessageLevelType"]] = None, **kwargs ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.MessageLevelType + """ super(ComplianceStatus, self).__init__(**kwargs) self.compliance_state = None self.last_config_applied = last_config_applied @@ -179,8 +200,8 @@ def __init__( class DependsOnDefinition(msrest.serialization.Model): """Specify which kustomizations must succeed reconciliation on the cluster prior to reconciling this kustomization. - :param kustomization_name: Name of the kustomization to claim dependency on. - :type kustomization_name: str + :ivar kustomization_name: Name of the kustomization to claim dependency on. + :vartype kustomization_name: str """ _attribute_map = { @@ -193,6 +214,10 @@ def __init__( kustomization_name: Optional[str] = None, **kwargs ): + """ + :keyword kustomization_name: Name of the kustomization to claim dependency on. + :paramtype kustomization_name: str + """ super(DependsOnDefinition, self).__init__(**kwargs) self.kustomization_name = kustomization_name @@ -222,6 +247,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -266,6 +293,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -277,8 +306,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail """ _attribute_map = { @@ -291,6 +320,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -308,38 +341,38 @@ class Extension(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Identity + :ivar identity: Identity of the Extension resource. + :vartype identity: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Identity :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + :ivar extension_type: Type of the Extension, of which this resource is an instance of. It must + be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :vartype extension_type: str + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar scope: Scope at which the extension is installed. + :vartype scope: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Scope + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] :ivar provisioning_state: Status of installation of this extension. Possible values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: + :ivar statuses: Status from this extension. + :vartype statuses: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionStatus] :ivar error_info: Error information from the Agent - e.g. errors during installation. :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail @@ -347,8 +380,8 @@ class Extension(ProxyResource): :vartype custom_location_settings: dict[str, str] :ivar package_uri: Uri of the Helm package. :vartype package_uri: str - :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. - :type aks_assigned_identity: + :ivar aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :vartype aks_assigned_identity: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionPropertiesAksAssignedIdentity """ @@ -399,6 +432,37 @@ def __init__( aks_assigned_identity: Optional["ExtensionPropertiesAksAssignedIdentity"] = None, **kwargs ): + """ + :keyword identity: Identity of the Extension resource. + :paramtype identity: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Identity + :keyword extension_type: Type of the Extension, of which this resource is an instance of. It + must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :paramtype extension_type: str + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword scope: Scope at which the extension is installed. + :paramtype scope: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Scope + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + :keyword statuses: Status from this extension. + :paramtype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionStatus] + :keyword aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :paramtype aks_assigned_identity: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionPropertiesAksAssignedIdentity + """ super(Extension, self).__init__(**kwargs) self.identity = identity self.system_data = None @@ -426,9 +490,9 @@ class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -448,6 +512,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -479,6 +548,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -487,17 +558,17 @@ def __init__( class ExtensionStatus(msrest.serialization.Model): """Status from the extension. - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". + :ivar code: Status code provided by the Extension. + :vartype code: str + :ivar display_status: Short description of status of the extension. + :vartype display_status: str + :ivar level: Level of the status. Possible values include: "Error", "Warning", "Information". Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str + :vartype level: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.LevelType + :ivar message: Detailed message of the status from the Extension. + :vartype message: str + :ivar time: DateLiteral (per ISO8601) noting the time of installation status. + :vartype time: str """ _attribute_map = { @@ -518,6 +589,20 @@ def __init__( time: Optional[str] = None, **kwargs ): + """ + :keyword code: Status code provided by the Extension. + :paramtype code: str + :keyword display_status: Short description of status of the extension. + :paramtype display_status: str + :keyword level: Level of the status. Possible values include: "Error", "Warning", + "Information". Default value: "Information". + :paramtype level: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.LevelType + :keyword message: Detailed message of the status from the Extension. + :paramtype message: str + :keyword time: DateLiteral (per ISO8601) noting the time of installation status. + :paramtype time: str + """ super(ExtensionStatus, self).__init__(**kwargs) self.code = code self.display_status = display_status @@ -562,6 +647,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionType, self).__init__(**kwargs) self.system_data = None self.release_trains = None @@ -572,10 +659,11 @@ def __init__( class ExtensionTypeList(msrest.serialization.Model): """List Extension Types. - :param value: The list of Extension Types. - :type value: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str + :ivar value: The list of Extension Types. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType] + :ivar next_link: The link to fetch the next page of Extension Types. + :vartype next_link: str """ _attribute_map = { @@ -590,6 +678,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of Extension Types. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionType] + :keyword next_link: The link to fetch the next page of Extension Types. + :paramtype next_link: str + """ super(ExtensionTypeList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -600,11 +695,11 @@ class ExtensionVersionList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param versions: Versions available for this Extension Type. - :type versions: + :ivar versions: Versions available for this Extension Type. + :vartype versions: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionListVersionsItem] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str + :ivar next_link: The link to fetch the next page of Extension Types. + :vartype next_link: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData """ @@ -626,6 +721,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword versions: Versions available for this Extension Type. + :paramtype versions: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionListVersionsItem] + :keyword next_link: The link to fetch the next page of Extension Types. + :paramtype next_link: str + """ super(ExtensionVersionList, self).__init__(**kwargs) self.versions = versions self.next_link = next_link @@ -635,10 +737,10 @@ def __init__( class ExtensionVersionListVersionsItem(msrest.serialization.Model): """ExtensionVersionListVersionsItem. - :param release_train: The release train for this Extension Type. - :type release_train: str - :param versions: Versions available for this Extension Type and release train. - :type versions: list[str] + :ivar release_train: The release train for this Extension Type. + :vartype release_train: str + :ivar versions: Versions available for this Extension Type and release train. + :vartype versions: list[str] """ _attribute_map = { @@ -653,6 +755,12 @@ def __init__( versions: Optional[List[str]] = None, **kwargs ): + """ + :keyword release_train: The release train for this Extension Type. + :paramtype release_train: str + :keyword versions: Versions available for this Extension Type and release train. + :paramtype versions: list[str] + """ super(ExtensionVersionListVersionsItem, self).__init__(**kwargs) self.release_train = release_train self.versions = versions @@ -674,29 +782,29 @@ class FluxConfiguration(ProxyResource): :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :param scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type scope: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeType - :param namespace: The namespace to which this configuration is installed to. Maximum of 253 + :ivar scope: Scope at which the operator will be installed. Possible values include: "cluster", + "namespace". Default value: "cluster". + :vartype scope: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeType + :ivar namespace: The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type namespace: str - :param source_kind: Source Kind to pull the configuration data from. Possible values include: + :vartype namespace: str + :ivar source_kind: Source Kind to pull the configuration data from. Possible values include: "GitRepository". - :type source_kind: str or + :vartype source_kind: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its + :ivar suspend: Whether this configuration should suspend its reconciliation of its kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: + :vartype suspend: bool + :ivar git_repository: Parameters to reconcile to the GitRepository source kind type. + :vartype git_repository: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.GitRepositoryDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. - :type kustomizations: dict[str, + :vartype kustomizations: dict[str, ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] + :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for + the configuration. + :vartype configuration_protected_settings: dict[str, str] :ivar statuses: Statuses of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects provisioned by the fluxConfiguration. :vartype statuses: @@ -770,6 +878,32 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword scope: Scope at which the operator will be installed. Possible values include: + "cluster", "namespace". Default value: "cluster". + :paramtype scope: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeType + :keyword namespace: The namespace to which this configuration is installed to. Maximum of 253 + lower case alphanumeric characters, hyphen and period only. + :paramtype namespace: str + :keyword source_kind: Source Kind to pull the configuration data from. Possible values include: + "GitRepository". + :paramtype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceKindType + :keyword suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :paramtype suspend: bool + :keyword git_repository: Parameters to reconcile to the GitRepository source kind type. + :paramtype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.GitRepositoryDefinition + :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :paramtype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationDefinition] + :keyword configuration_protected_settings: Key-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + """ super(FluxConfiguration, self).__init__(**kwargs) self.system_data = None self.scope = scope @@ -791,23 +925,23 @@ def __init__( class FluxConfigurationPatch(msrest.serialization.Model): """The Flux Configuration Patch Request object. - :param source_kind: Source Kind to pull the configuration data from. Possible values include: + :ivar source_kind: Source Kind to pull the configuration data from. Possible values include: "GitRepository". - :type source_kind: str or + :vartype source_kind: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its + :ivar suspend: Whether this configuration should suspend its reconciliation of its kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: + :vartype suspend: bool + :ivar git_repository: Parameters to reconcile to the GitRepository source kind type. + :vartype git_repository: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.GitRepositoryDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. - :type kustomizations: dict[str, + :vartype kustomizations: dict[str, ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] + :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for + the configuration. + :vartype configuration_protected_settings: dict[str, str] """ _attribute_map = { @@ -828,6 +962,25 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword source_kind: Source Kind to pull the configuration data from. Possible values include: + "GitRepository". + :paramtype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceKindType + :keyword suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :paramtype suspend: bool + :keyword git_repository: Parameters to reconcile to the GitRepository source kind type. + :paramtype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.GitRepositoryDefinition + :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :paramtype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationDefinition] + :keyword configuration_protected_settings: Key-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + """ super(FluxConfigurationPatch, self).__init__(**kwargs) self.source_kind = source_kind self.suspend = suspend @@ -862,6 +1015,8 @@ def __init__( self, **kwargs ): + """ + """ super(FluxConfigurationsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -870,29 +1025,29 @@ def __init__( class GitRepositoryDefinition(msrest.serialization.Model): """Parameters to reconcile to the GitRepository source kind type. - :param url: The URL to sync for the flux configuration git repository. - :type url: str - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + :ivar url: The URL to sync for the flux configuration git repository. + :vartype url: str + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git repository source with the remote. - :type sync_interval_in_seconds: long - :param repository_ref: The source reference for the GitRepository object. - :type repository_ref: + :vartype sync_interval_in_seconds: long + :ivar repository_ref: The source reference for the GitRepository object. + :vartype repository_ref: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.RepositoryRefDefinition - :param ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to + :ivar ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH. - :type ssh_known_hosts: str - :param https_user: Base64-encoded HTTPS username used to access private git repositories over + :vartype ssh_known_hosts: str + :ivar https_user: Base64-encoded HTTPS username used to access private git repositories over HTTPS. - :type https_user: str - :param https_ca_file: Base64-encoded HTTPS certificate authority contents used to access git + :vartype https_user: str + :ivar https_ca_file: Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS. - :type https_ca_file: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + :vartype https_ca_file: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str + :vartype local_auth_ref: str """ _attribute_map = { @@ -919,6 +1074,31 @@ def __init__( local_auth_ref: Optional[str] = None, **kwargs ): + """ + :keyword url: The URL to sync for the flux configuration git repository. + :paramtype url: str + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword repository_ref: The source reference for the GitRepository object. + :paramtype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.RepositoryRefDefinition + :keyword ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required + to access private git repositories over SSH. + :paramtype ssh_known_hosts: str + :keyword https_user: Base64-encoded HTTPS username used to access private git repositories over + HTTPS. + :paramtype https_user: str + :keyword https_ca_file: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :paramtype https_ca_file: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ super(GitRepositoryDefinition, self).__init__(**kwargs) self.url = url self.timeout_in_seconds = timeout_in_seconds @@ -933,10 +1113,10 @@ def __init__( class HelmOperatorProperties(msrest.serialization.Model): """Properties for Helm operator. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str """ _attribute_map = { @@ -951,6 +1131,12 @@ def __init__( chart_values: Optional[str] = None, **kwargs ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ super(HelmOperatorProperties, self).__init__(**kwargs) self.chart_version = chart_version self.chart_values = chart_values @@ -959,18 +1145,18 @@ def __init__( class HelmReleasePropertiesDefinition(msrest.serialization.Model): """HelmReleasePropertiesDefinition. - :param last_revision_applied: The revision number of the last released object change. - :type last_revision_applied: long - :param helm_chart_ref: The reference to the HelmChart object used as the source to this + :ivar last_revision_applied: The revision number of the last released object change. + :vartype last_revision_applied: long + :ivar helm_chart_ref: The reference to the HelmChart object used as the source to this HelmRelease. - :type helm_chart_ref: + :vartype helm_chart_ref: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectReferenceDefinition - :param failure_count: Total number of times that the HelmRelease failed to install or upgrade. - :type failure_count: long - :param install_failure_count: Number of times that the HelmRelease failed to install. - :type install_failure_count: long - :param upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. - :type upgrade_failure_count: long + :ivar failure_count: Total number of times that the HelmRelease failed to install or upgrade. + :vartype failure_count: long + :ivar install_failure_count: Number of times that the HelmRelease failed to install. + :vartype install_failure_count: long + :ivar upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. + :vartype upgrade_failure_count: long """ _attribute_map = { @@ -991,6 +1177,21 @@ def __init__( upgrade_failure_count: Optional[int] = None, **kwargs ): + """ + :keyword last_revision_applied: The revision number of the last released object change. + :paramtype last_revision_applied: long + :keyword helm_chart_ref: The reference to the HelmChart object used as the source to this + HelmRelease. + :paramtype helm_chart_ref: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectReferenceDefinition + :keyword failure_count: Total number of times that the HelmRelease failed to install or + upgrade. + :paramtype failure_count: long + :keyword install_failure_count: Number of times that the HelmRelease failed to install. + :paramtype install_failure_count: long + :keyword upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. + :paramtype upgrade_failure_count: long + """ super(HelmReleasePropertiesDefinition, self).__init__(**kwargs) self.last_revision_applied = last_revision_applied self.helm_chart_ref = helm_chart_ref @@ -1008,9 +1209,9 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -1030,6 +1231,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -1039,32 +1245,32 @@ def __init__( class KustomizationDefinition(msrest.serialization.Model): """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. - :param path: The path in the source reference to reconcile on the cluster. - :type path: str - :param depends_on: Specifies other Kustomizations that this Kustomization depends on. This + :ivar path: The path in the source reference to reconcile on the cluster. + :vartype path: str + :ivar depends_on: Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. - :type depends_on: + :vartype depends_on: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.DependsOnDefinition] - :param timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the cluster. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the cluster. - :type sync_interval_in_seconds: long - :param retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on - the cluster in the event of failure on reconciliation. - :type retry_interval_in_seconds: long - :param prune: Enable/disable garbage collections of Kubernetes objects created by this + :vartype sync_interval_in_seconds: long + :ivar retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster in the event of failure on reconciliation. + :vartype retry_interval_in_seconds: long + :ivar prune: Enable/disable garbage collections of Kubernetes objects created by this Kustomization. - :type prune: bool - :param validation: Specify whether to validate the Kubernetes objects referenced in the + :vartype prune: bool + :ivar validation: Specify whether to validate the Kubernetes objects referenced in the Kustomization before applying them to the cluster. Possible values include: "none", "client", "server". Default value: "none". - :type validation: str or + :vartype validation: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationValidationType - :param force: Enable/disable re-creating Kubernetes resources on the cluster when patching - fails due to an immutable field change. - :type force: bool + :ivar force: Enable/disable re-creating Kubernetes resources on the cluster when patching fails + due to an immutable field change. + :vartype force: bool """ _attribute_map = { @@ -1091,6 +1297,34 @@ def __init__( force: Optional[bool] = False, **kwargs ): + """ + :keyword path: The path in the source reference to reconcile on the cluster. + :paramtype path: str + :keyword depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :paramtype depends_on: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.DependsOnDefinition] + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster. + :paramtype sync_interval_in_seconds: long + :keyword retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster in the event of failure on reconciliation. + :paramtype retry_interval_in_seconds: long + :keyword prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :paramtype prune: bool + :keyword validation: Specify whether to validate the Kubernetes objects referenced in the + Kustomization before applying them to the cluster. Possible values include: "none", "client", + "server". Default value: "none". + :paramtype validation: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.KustomizationValidationType + :keyword force: Enable/disable re-creating Kubernetes resources on the cluster when patching + fails due to an immutable field change. + :paramtype force: bool + """ super(KustomizationDefinition, self).__init__(**kwargs) self.path = path self.depends_on = depends_on @@ -1105,10 +1339,10 @@ def __init__( class ObjectReferenceDefinition(msrest.serialization.Model): """Object reference to a Kubernetes object on a cluster. - :param name: Name of the object. - :type name: str - :param namespace: Namespace of the object. - :type namespace: str + :ivar name: Name of the object. + :vartype name: str + :ivar namespace: Namespace of the object. + :vartype namespace: str """ _attribute_map = { @@ -1123,6 +1357,12 @@ def __init__( namespace: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the object. + :paramtype name: str + :keyword namespace: Namespace of the object. + :paramtype namespace: str + """ super(ObjectReferenceDefinition, self).__init__(**kwargs) self.name = name self.namespace = namespace @@ -1131,16 +1371,16 @@ def __init__( class ObjectStatusConditionDefinition(msrest.serialization.Model): """Status condition of Kubernetes object. - :param last_transition_time: Last time this status condition has changed. - :type last_transition_time: ~datetime.datetime - :param message: A more verbose description of the object status condition. - :type message: str - :param reason: Reason for the specified status condition type status. - :type reason: str - :param status: Status of the Kubernetes object condition type. - :type status: str - :param type: Object status condition type for this object. - :type type: str + :ivar last_transition_time: Last time this status condition has changed. + :vartype last_transition_time: ~datetime.datetime + :ivar message: A more verbose description of the object status condition. + :vartype message: str + :ivar reason: Reason for the specified status condition type status. + :vartype reason: str + :ivar status: Status of the Kubernetes object condition type. + :vartype status: str + :ivar type: Object status condition type for this object. + :vartype type: str """ _attribute_map = { @@ -1161,6 +1401,18 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword last_transition_time: Last time this status condition has changed. + :paramtype last_transition_time: ~datetime.datetime + :keyword message: A more verbose description of the object status condition. + :paramtype message: str + :keyword reason: Reason for the specified status condition type status. + :paramtype reason: str + :keyword status: Status of the Kubernetes object condition type. + :paramtype status: str + :keyword type: Object status condition type for this object. + :paramtype type: str + """ super(ObjectStatusConditionDefinition, self).__init__(**kwargs) self.last_transition_time = last_transition_time self.message = message @@ -1172,26 +1424,26 @@ def __init__( class ObjectStatusDefinition(msrest.serialization.Model): """Statuses of objects deployed by the user-specified kustomizations from the git repository. - :param name: Name of the applied object. - :type name: str - :param namespace: Namespace of the applied object. - :type namespace: str - :param kind: Kind of the applied object. - :type kind: str - :param compliance_state: Compliance state of the applied object showing whether the applied + :ivar name: Name of the applied object. + :vartype name: str + :ivar namespace: Namespace of the applied object. + :vartype namespace: str + :ivar kind: Kind of the applied object. + :vartype kind: str + :ivar compliance_state: Compliance state of the applied object showing whether the applied object has come into a ready state on the cluster. Possible values include: "Compliant", "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". - :type compliance_state: str or + :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxComplianceState - :param applied_by: Object reference to the Kustomization that applied this object. - :type applied_by: + :ivar applied_by: Object reference to the Kustomization that applied this object. + :vartype applied_by: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectReferenceDefinition - :param status_conditions: List of Kubernetes object status conditions present on the cluster. - :type status_conditions: + :ivar status_conditions: List of Kubernetes object status conditions present on the cluster. + :vartype status_conditions: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectStatusConditionDefinition] - :param helm_release_properties: Additional properties that are provided from objects of the + :ivar helm_release_properties: Additional properties that are provided from objects of the HelmRelease kind. - :type helm_release_properties: + :vartype helm_release_properties: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.HelmReleasePropertiesDefinition """ @@ -1217,6 +1469,29 @@ def __init__( helm_release_properties: Optional["HelmReleasePropertiesDefinition"] = None, **kwargs ): + """ + :keyword name: Name of the applied object. + :paramtype name: str + :keyword namespace: Namespace of the applied object. + :paramtype namespace: str + :keyword kind: Kind of the applied object. + :paramtype kind: str + :keyword compliance_state: Compliance state of the applied object showing whether the applied + object has come into a ready state on the cluster. Possible values include: "Compliant", + "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". + :paramtype compliance_state: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxComplianceState + :keyword applied_by: Object reference to the Kustomization that applied this object. + :paramtype applied_by: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectReferenceDefinition + :keyword status_conditions: List of Kubernetes object status conditions present on the cluster. + :paramtype status_conditions: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ObjectStatusConditionDefinition] + :keyword helm_release_properties: Additional properties that are provided from objects of the + HelmRelease kind. + :paramtype helm_release_properties: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.HelmReleasePropertiesDefinition + """ super(ObjectStatusDefinition, self).__init__(**kwargs) self.name = name self.namespace = namespace @@ -1253,6 +1528,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1265,14 +1542,14 @@ class OperationStatusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Required. Operation status. + :vartype status: str + :ivar properties: Additional information, if available. + :vartype properties: dict[str, str] :ivar error: If present, details of the operation error. :vartype error: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ErrorDetail """ @@ -1299,6 +1576,16 @@ def __init__( properties: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Required. Operation status. + :paramtype status: str + :keyword properties: Additional information, if available. + :paramtype properties: dict[str, str] + """ super(OperationStatusResult, self).__init__(**kwargs) self.id = id self.name = name @@ -1310,21 +1597,21 @@ def __init__( class PatchExtension(msrest.serialization.Model): """The Extension Patch Request object. - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] """ _attribute_map = { @@ -1345,6 +1632,23 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + """ super(PatchExtension, self).__init__(**kwargs) self.auto_upgrade_minor_version = auto_upgrade_minor_version self.release_train = release_train @@ -1356,16 +1660,16 @@ def __init__( class RepositoryRefDefinition(msrest.serialization.Model): """The source reference for the GitRepository object. - :param branch: The git repository branch name to checkout. - :type branch: str - :param tag: The git repository tag name to checkout. This takes precedence over branch. - :type tag: str - :param semver: The semver range used to match against git repository tags. This takes - precedence over tag. - :type semver: str - :param commit: The commit SHA to checkout. This value must be combined with the branch name to + :ivar branch: The git repository branch name to checkout. + :vartype branch: str + :ivar tag: The git repository tag name to checkout. This takes precedence over branch. + :vartype tag: str + :ivar semver: The semver range used to match against git repository tags. This takes precedence + over tag. + :vartype semver: str + :ivar commit: The commit SHA to checkout. This value must be combined with the branch name to be valid. This takes precedence over semver. - :type commit: str + :vartype commit: str """ _attribute_map = { @@ -1384,6 +1688,18 @@ def __init__( commit: Optional[str] = None, **kwargs ): + """ + :keyword branch: The git repository branch name to checkout. + :paramtype branch: str + :keyword tag: The git repository tag name to checkout. This takes precedence over branch. + :paramtype tag: str + :keyword semver: The semver range used to match against git repository tags. This takes + precedence over tag. + :paramtype semver: str + :keyword commit: The commit SHA to checkout. This value must be combined with the branch name + to be valid. This takes precedence over semver. + :paramtype commit: str + """ super(RepositoryRefDefinition, self).__init__(**kwargs) self.branch = branch self.tag = tag @@ -1396,10 +1712,10 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationDisplay :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool @@ -1426,6 +1742,13 @@ def __init__( display: Optional["ResourceProviderOperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationDisplay + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -1436,14 +1759,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -1462,6 +1785,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1474,8 +1807,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -1496,6 +1829,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1504,10 +1842,11 @@ def __init__( class Scope(msrest.serialization.Model): """Scope of the extension. It can be either Cluster or Namespace; but not both. - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeNamespace + :ivar cluster: Specifies that the scope of the extension is Cluster. + :vartype cluster: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeCluster + :ivar namespace: Specifies that the scope of the extension is Namespace. + :vartype namespace: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeNamespace """ _attribute_map = { @@ -1522,6 +1861,13 @@ def __init__( namespace: Optional["ScopeNamespace"] = None, **kwargs ): + """ + :keyword cluster: Specifies that the scope of the extension is Cluster. + :paramtype cluster: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeCluster + :keyword namespace: Specifies that the scope of the extension is Namespace. + :paramtype namespace: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ScopeNamespace + """ super(Scope, self).__init__(**kwargs) self.cluster = cluster self.namespace = namespace @@ -1530,9 +1876,9 @@ def __init__( class ScopeCluster(msrest.serialization.Model): """Specifies that the scope of the extension is Cluster. - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster + :ivar release_namespace: Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str + :vartype release_namespace: str """ _attribute_map = { @@ -1545,6 +1891,11 @@ def __init__( release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extension. If this namespace does not exist, it will be created. + :paramtype release_namespace: str + """ super(ScopeCluster, self).__init__(**kwargs) self.release_namespace = release_namespace @@ -1552,9 +1903,9 @@ def __init__( class ScopeNamespace(msrest.serialization.Model): """Specifies that the scope of the extension is Namespace. - :param target_namespace: Namespace where the extension will be created for an Namespace scoped + :ivar target_namespace: Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created. - :type target_namespace: str + :vartype target_namespace: str """ _attribute_map = { @@ -1567,6 +1918,11 @@ def __init__( target_namespace: Optional[str] = None, **kwargs ): + """ + :keyword target_namespace: Namespace where the extension will be created for an Namespace + scoped extension. If this namespace does not exist, it will be created. + :paramtype target_namespace: str + """ super(ScopeNamespace, self).__init__(**kwargs) self.target_namespace = target_namespace @@ -1587,36 +1943,36 @@ class SourceControlConfiguration(ProxyResource): :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or + :vartype operator_scope: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperatorScopeType :ivar repository_public_key: Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.HelmOperatorProperties :ivar provisioning_state: The provisioning state of the resource provider. Possible values include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". @@ -1672,6 +2028,36 @@ def __init__( helm_operator_properties: Optional["HelmOperatorProperties"] = None, **kwargs ): + """ + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.HelmOperatorProperties + """ super(SourceControlConfiguration, self).__init__(**kwargs) self.system_data = None self.repository_url = repository_url @@ -1715,6 +2101,8 @@ def __init__( self, **kwargs ): + """ + """ super(SourceControlConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1723,10 +2111,10 @@ def __init__( class SupportedScopes(msrest.serialization.Model): """Extension scopes. - :param default_scope: Default extension scopes: cluster or namespace. - :type default_scope: str - :param cluster_scope_settings: Scope settings. - :type cluster_scope_settings: + :ivar default_scope: Default extension scopes: cluster or namespace. + :vartype default_scope: str + :ivar cluster_scope_settings: Scope settings. + :vartype cluster_scope_settings: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ClusterScopeSettings """ @@ -1742,6 +2130,13 @@ def __init__( cluster_scope_settings: Optional["ClusterScopeSettings"] = None, **kwargs ): + """ + :keyword default_scope: Default extension scopes: cluster or namespace. + :paramtype default_scope: str + :keyword cluster_scope_settings: Scope settings. + :paramtype cluster_scope_settings: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ClusterScopeSettings + """ super(SupportedScopes, self).__init__(**kwargs) self.default_scope = default_scope self.cluster_scope_settings = cluster_scope_settings @@ -1750,22 +2145,22 @@ 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 + :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.kubernetesconfiguration.v2021_11_01_preview.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_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 + :vartype last_modified_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1788,6 +2183,24 @@ 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.kubernetesconfiguration.v2021_11_01_preview.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.kubernetesconfiguration.v2021_11_01_preview.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 diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_source_control_configuration_client_enums.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_source_control_configuration_client_enums.py index 7b724fe947b0..544b13b91c22 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_source_control_configuration_client_enums.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/models/_source_control_configuration_client_enums.py @@ -6,34 +6,19 @@ # 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 ClusterTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Cluster types """ CONNECTED_CLUSTERS = "connectedClusters" MANAGED_CLUSTERS = "managedClusters" -class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compliance state of the configuration. """ @@ -43,7 +28,7 @@ class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -52,17 +37,17 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class FluxComplianceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FluxComplianceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Compliance state of the cluster object. """ @@ -72,7 +57,7 @@ class FluxComplianceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUSPENDED = "Suspended" UNKNOWN = "Unknown" -class KustomizationValidationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KustomizationValidationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify whether to validate the Kubernetes objects referenced in the Kustomization before applying them to the cluster. """ @@ -81,7 +66,7 @@ class KustomizationValidationType(with_metaclass(_CaseInsensitiveEnumMeta, str, CLIENT = "client" SERVER = "server" -class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the status. """ @@ -89,7 +74,7 @@ class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the message. """ @@ -97,20 +82,20 @@ class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the operator will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the operator """ FLUX = "Flux" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource. """ @@ -121,7 +106,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" DELETING = "Deleting" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource provider. """ @@ -131,14 +116,14 @@ class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) SUCCEEDED = "Succeeded" FAILED = "Failed" -class ScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the configuration will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class SourceKindType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceKindType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Source Kind to pull the configuration data from. """ diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_type_operations.py index 116d991666f7..3521f8a75735 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_type_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_type_operations.py @@ -5,22 +5,65 @@ # 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, Union 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, 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionTypeName": _SERIALIZER.url("extension_type_name", extension_type_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 + ) class ClusterExtensionTypeOperations(object): """ClusterExtensionTypeOperations operations. @@ -44,16 +87,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionType" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any + ) -> "_models.ExtensionType": """Get Extension Type details. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,7 +106,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_type_name: Extension type name. @@ -78,36 +122,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionType', pipeline_response) @@ -116,4 +150,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_types_operations.py index 9a59fe9f602b..7d7e58989f91 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_types_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_cluster_extension_types_operations.py @@ -5,23 +5,64 @@ # 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.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, 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') +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, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class ClusterExtensionTypesOperations(object): """ClusterExtensionTypesOperations operations. @@ -45,15 +86,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionTypeList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeList"]: """Get Extension Types. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,12 +104,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -76,38 +119,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,12 +162,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extension_type_versions_operations.py index a9db32fce8b0..b9e4fd842eeb 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extension_type_versions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extension_type_versions_operations.py @@ -5,23 +5,60 @@ # 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') +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, + location: str, + extension_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + "extensionTypeName": _SERIALIZER.url("extension_type_name", extension_type_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 + ) class ExtensionTypeVersionsOperations(object): """ExtensionTypeVersionsOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - extension_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionVersionList"] + location: str, + extension_type_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionVersionList"]: """List available versions for an Extension Type. :param location: extension location. @@ -59,8 +96,10 @@ def list( :param extension_type_name: Extension type name. :type extension_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionList] + :return: An iterator like instance of either ExtensionVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] @@ -68,36 +107,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_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_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + 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, + location=location, + extension_type_name=extension_type_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('ExtensionVersionList', pipeline_response) + deserialized = self._deserialize("ExtensionVersionList", pipeline_response) list_of_elem = deserialized.versions if cls: list_of_elem = cls(list_of_elem) @@ -110,12 +146,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extensions_operations.py index b9a4aa6a9173..0531c0003855 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extensions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_extensions_operations.py @@ -5,25 +5,253 @@ # 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_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # 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 + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class ExtensionsOperations(object): """ExtensionsOperations operations. @@ -49,56 +277,44 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(extension, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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('Extension', pipeline_response) @@ -110,19 +326,21 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Create a new Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -132,7 +350,8 @@ def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -141,15 +360,19 @@ def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,30 +387,21 @@ def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -199,18 +413,19 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> "_models.Extension": """Gets Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -220,7 +435,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -235,36 +451,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -273,74 +479,64 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **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-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + 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.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. @@ -351,7 +547,8 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -361,15 +558,17 @@ def begin_delete( :type force_delete: bool :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', @@ -387,24 +586,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -416,62 +605,49 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - patch_extension, # type: "_models.PatchExtension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(patch_extension, 'PatchExtension') - # 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_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.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(patch_extension, 'PatchExtension') - body_content_kwargs['content'] = body_content - request = self._client.patch(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 [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -479,19 +655,21 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - patch_extension, # type: "_models.PatchExtension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Patch an existing Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -501,24 +679,30 @@ def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. :type extension_name: str :param patch_extension: Properties to Patch in an existing Extension. - :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.PatchExtension + :type patch_extension: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.PatchExtension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -533,30 +717,21 @@ def begin_update( cluster_name=cluster_name, extension_name=extension_name, patch_extension=patch_extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -568,17 +743,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionsList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionsList"]: """List all Extensions in the cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -588,12 +764,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionsList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -601,38 +779,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -645,12 +822,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_config_operation_status_operations.py index 4bd346a003fc..dea63e7dac35 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_config_operation_status_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_config_operation_status_operations.py @@ -5,22 +5,67 @@ # 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, Union 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, 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_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 + ) class FluxConfigOperationStatusOperations(object): """FluxConfigOperationStatusOperations operations. @@ -44,17 +89,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResult" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": """Get Async Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -64,7 +109,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -81,37 +127,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -120,4 +156,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_configurations_operations.py index 0b8e72b45735..c3d3cf613baf 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_flux_configurations_operations.py @@ -5,25 +5,253 @@ # 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_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_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_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_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_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, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_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') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # 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 + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class FluxConfigurationsOperations(object): """FluxConfigurationsOperations operations. @@ -47,16 +275,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FluxConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any + ) -> "_models.FluxConfiguration": """Gets details of the Flux Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,7 +294,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -81,36 +310,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -119,62 +338,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration, # type: "_models.FluxConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.FluxConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration: "_models.FluxConfiguration", + **kwargs: Any + ) -> "_models.FluxConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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(flux_configuration, 'FluxConfiguration') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.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(flux_configuration, 'FluxConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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('FluxConfiguration', pipeline_response) @@ -186,19 +393,21 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration, # type: "_models.FluxConfiguration" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FluxConfiguration"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration: "_models.FluxConfiguration", + **kwargs: Any + ) -> LROPoller["_models.FluxConfiguration"]: """Create a new Kubernetes Flux Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -208,24 +417,31 @@ def begin_create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration: Properties necessary to Create a FluxConfiguration. - :type flux_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] + :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.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -240,30 +456,21 @@ def begin_create_or_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration=flux_configuration, + 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('FluxConfiguration', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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: @@ -275,62 +482,49 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration_patch, # type: "_models.FluxConfigurationPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.FluxConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: "_models.FluxConfigurationPatch", + **kwargs: Any + ) -> "_models.FluxConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: lambda response: ResourceExistsError(response=response, model=self._deserialize(_models.ErrorResponse, response), error_format=ARMErrorFormat), + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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(flux_configuration_patch, 'FluxConfigurationPatch') - # 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_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.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(flux_configuration_patch, 'FluxConfigurationPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(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 [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -338,19 +532,21 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration_patch, # type: "_models.FluxConfigurationPatch" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FluxConfiguration"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: "_models.FluxConfigurationPatch", + **kwargs: Any + ) -> LROPoller["_models.FluxConfiguration"]: """Update an existing Kubernetes Flux Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -360,24 +556,31 @@ def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. - :type flux_configuration_patch: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationPatch + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationPatch :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfiguration] + :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.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -392,30 +595,21 @@ def begin_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration_patch=flux_configuration_patch, + 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('FluxConfiguration', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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: @@ -427,74 +621,63 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **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-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + 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.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Flux Configuration, thus stopping future sync from the source repo. @@ -505,7 +688,8 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -515,15 +699,17 @@ def begin_delete( :type force_delete: bool :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', @@ -541,24 +727,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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: @@ -570,17 +746,18 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FluxConfigurationsList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.FluxConfigurationsList"]: """List all Flux Configurations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -590,12 +767,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FluxConfigurationsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationsList] + :return: An iterator like instance of either FluxConfigurationsList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.FluxConfigurationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfigurationsList"] @@ -603,38 +783,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('FluxConfigurationsList', pipeline_response) + deserialized = self._deserialize("FluxConfigurationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -647,12 +826,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_location_extension_types_operations.py index 7e4e5eb165eb..6e8be79c0612 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_location_extension_types_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_location_extension_types_operations.py @@ -5,23 +5,58 @@ # 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') +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, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, '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 + ) class LocationExtensionTypesOperations(object): """LocationExtensionTypesOperations operations. @@ -45,19 +80,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionTypeList"] + location: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeList"]: """List all Extension Types. :param location: extension location. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -65,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'location': self._serialize.url("location", location, '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, + location=location, + 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, + location=location, + 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('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,12 +138,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operation_status_operations.py index 9cd277b30f3f..99b73b720389 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operation_status_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operation_status_operations.py @@ -5,23 +5,107 @@ # 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.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 +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_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_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class OperationStatusOperations(object): """OperationStatusOperations operations. @@ -45,17 +129,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResult" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": """Get Async Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,7 +149,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -82,37 +167,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -121,17 +196,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationStatusList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.OperationStatusList"]: """List Async Operations, currently in progress, in a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,12 +218,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -154,38 +233,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -198,12 +276,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operations.py index 35394f508093..c047a8d76ca0 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/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-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/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 Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_source_control_configurations_operations.py index 3233f416ca07..4fe01af82205 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_source_control_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2021_11_01_preview/operations/_source_control_configurations_operations.py @@ -5,25 +5,199 @@ # 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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 + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-11-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class SourceControlConfigurationsOperations(object): """SourceControlConfigurationsOperations operations. @@ -47,16 +221,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Gets details of the Source Control Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,14 +240,16 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -81,36 +257,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -119,19 +285,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - source_control_configuration, # type: "_models.SourceControlConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Create a new Kubernetes Source Control Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,16 +309,19 @@ def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -158,41 +329,31 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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(source_control_configuration, 'SourceControlConfiguration') - # 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_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.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(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,70 +366,61 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_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-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. @@ -279,22 +431,25 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_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', @@ -311,24 +466,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,17 +485,18 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SourceControlConfigurationList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -360,12 +506,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2021_11_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -373,38 +522,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-11-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -417,12 +565,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/__init__.py index f13062376d74..e90963036337 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['SourceControlConfigurationClient'] -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_configuration.py index b75a1084ebcd..79ca1e2de574 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_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,16 +33,15 @@ class SourceControlConfigurationClientConfiguration(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(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_metadata.json b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_metadata.json index e2bebcafbacb..24b43e0c3e46 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_metadata.json +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "SourceControlConfigurationClient", "filename": "_source_control_configuration_client", "description": "KubernetesConfiguration Client.", - "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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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\": [\"SourceControlConfigurationClientConfiguration\"]}}, \"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": { "cluster_extension_type": "ClusterExtensionTypeOperations", diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_source_control_configuration_client.py index 4fd5d4958ff5..7a271a306916 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_source_control_configuration_client.py @@ -6,119 +6,115 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import ClusterExtensionTypeOperations, ClusterExtensionTypesOperations, ExtensionTypeVersionsOperations, ExtensionsOperations, FluxConfigOperationStatusOperations, FluxConfigurationsOperations, LocationExtensionTypesOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + 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 SourceControlConfigurationClientConfiguration -from .operations import ClusterExtensionTypeOperations -from .operations import ClusterExtensionTypesOperations -from .operations import ExtensionTypeVersionsOperations -from .operations import LocationExtensionTypesOperations -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import FluxConfigurationsOperations -from .operations import FluxConfigOperationStatusOperations -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from . import models - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar cluster_extension_type: ClusterExtensionTypeOperations operations - :vartype cluster_extension_type: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ClusterExtensionTypeOperations + :vartype cluster_extension_type: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ClusterExtensionTypeOperations :ivar cluster_extension_types: ClusterExtensionTypesOperations operations - :vartype cluster_extension_types: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ClusterExtensionTypesOperations + :vartype cluster_extension_types: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ClusterExtensionTypesOperations :ivar extension_type_versions: ExtensionTypeVersionsOperations operations - :vartype extension_type_versions: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ExtensionTypeVersionsOperations + :vartype extension_type_versions: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ExtensionTypeVersionsOperations :ivar location_extension_types: LocationExtensionTypesOperations operations - :vartype location_extension_types: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.LocationExtensionTypesOperations + :vartype location_extension_types: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.LocationExtensionTypesOperations :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.OperationStatusOperations :ivar flux_configurations: FluxConfigurationsOperations operations - :vartype flux_configurations: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.FluxConfigurationsOperations + :vartype flux_configurations: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.FluxConfigurationsOperations :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations - :vartype flux_config_operation_status: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.FluxConfigOperationStatusOperations + :vartype flux_config_operation_status: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.FluxConfigOperationStatusOperations :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = SourceControlConfigurationClientConfiguration(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.cluster_extension_type = ClusterExtensionTypeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_types = ClusterExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extension_type_versions = ExtensionTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location_extension_types = LocationExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_configurations = FluxConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_config_operation_status = FluxConfigOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.cluster_extension_type = ClusterExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_types = ClusterExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type_versions = ExtensionTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.location_extension_types = LocationExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_configurations = FluxConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_config_operation_status = FluxConfigOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + + + 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', min_length=1), - } - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_vendor.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_version.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_version.py index c47f66669f1b..59deb8c7263b 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_version.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.1.0" diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/__init__.py index ba52c91a7ba1..5f583276b4ed 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/__init__.py @@ -8,3 +8,8 @@ from ._source_control_configuration_client import SourceControlConfigurationClient __all__ = ['SourceControlConfigurationClient'] + +# `._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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_configuration.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_configuration.py index fc051b591488..c39cb2de0a3e 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_configuration.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/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,11 +37,11 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(SourceControlConfigurationClientConfiguration, 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(SourceControlConfigurationClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id @@ -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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_patch.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_source_control_configuration_client.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_source_control_configuration_client.py index 502030b55683..d2a714a63785 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_source_control_configuration_client.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/_source_control_configuration_client.py @@ -6,115 +6,115 @@ # 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 SourceControlConfigurationClientConfiguration +from .operations import ClusterExtensionTypeOperations, ClusterExtensionTypesOperations, ExtensionTypeVersionsOperations, ExtensionsOperations, FluxConfigOperationStatusOperations, FluxConfigurationsOperations, LocationExtensionTypesOperations, OperationStatusOperations, Operations, SourceControlConfigurationsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import SourceControlConfigurationClientConfiguration -from .operations import ClusterExtensionTypeOperations -from .operations import ClusterExtensionTypesOperations -from .operations import ExtensionTypeVersionsOperations -from .operations import LocationExtensionTypesOperations -from .operations import ExtensionsOperations -from .operations import OperationStatusOperations -from .operations import FluxConfigurationsOperations -from .operations import FluxConfigOperationStatusOperations -from .operations import SourceControlConfigurationsOperations -from .operations import Operations -from .. import models - - -class SourceControlConfigurationClient(object): +class SourceControlConfigurationClient: """KubernetesConfiguration Client. :ivar cluster_extension_type: ClusterExtensionTypeOperations operations - :vartype cluster_extension_type: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ClusterExtensionTypeOperations + :vartype cluster_extension_type: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ClusterExtensionTypeOperations :ivar cluster_extension_types: ClusterExtensionTypesOperations operations - :vartype cluster_extension_types: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ClusterExtensionTypesOperations + :vartype cluster_extension_types: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ClusterExtensionTypesOperations :ivar extension_type_versions: ExtensionTypeVersionsOperations operations - :vartype extension_type_versions: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ExtensionTypeVersionsOperations + :vartype extension_type_versions: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ExtensionTypeVersionsOperations :ivar location_extension_types: LocationExtensionTypesOperations operations - :vartype location_extension_types: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.LocationExtensionTypesOperations + :vartype location_extension_types: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.LocationExtensionTypesOperations :ivar extensions: ExtensionsOperations operations - :vartype extensions: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ExtensionsOperations + :vartype extensions: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.ExtensionsOperations :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.OperationStatusOperations + :vartype operation_status: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.OperationStatusOperations :ivar flux_configurations: FluxConfigurationsOperations operations - :vartype flux_configurations: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.FluxConfigurationsOperations + :vartype flux_configurations: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.FluxConfigurationsOperations :ivar flux_config_operation_status: FluxConfigOperationStatusOperations operations - :vartype flux_config_operation_status: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.FluxConfigOperationStatusOperations + :vartype flux_config_operation_status: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.FluxConfigOperationStatusOperations :ivar source_control_configurations: SourceControlConfigurationsOperations operations - :vartype source_control_configurations: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.SourceControlConfigurationsOperations + :vartype source_control_configurations: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.SourceControlConfigurationsOperations :ivar operations: Operations operations - :vartype operations: azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.Operations + :vartype operations: + azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.aio.operations.Operations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :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 = SourceControlConfigurationClientConfiguration(credential, subscription_id, **kwargs) + self._config = SourceControlConfigurationClientConfiguration(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.cluster_extension_type = ClusterExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_extension_types = ClusterExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type_versions = ExtensionTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.location_extension_types = LocationExtensionTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.extensions = ExtensionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_configurations = FluxConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.flux_config_operation_status = FluxConfigOperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.source_control_configurations = SourceControlConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + - self.cluster_extension_type = ClusterExtensionTypeOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_extension_types = ClusterExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extension_type_versions = ExtensionTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.location_extension_types = LocationExtensionTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.extensions = ExtensionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation_status = OperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_configurations = FluxConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.flux_config_operation_status = FluxConfigOperationStatusOperations( - self._client, self._config, self._serialize, self._deserialize) - self.source_control_configurations = SourceControlConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - 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', min_length=1), - } - 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/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_type_operations.py index 5ad38f9c1db9..30b4795bd9b1 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_type_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_type_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, Union 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._cluster_extension_type_operations import build_get_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 get( self, resource_group_name: str, @@ -58,7 +63,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_type_name: Extension type name. @@ -73,36 +79,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionType', pipeline_response) @@ -111,4 +107,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_types_operations.py index 271b9752354c..64e611b47dd7 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_types_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_cluster_extension_types_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, 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.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._cluster_extension_types_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, resource_group_name: str, @@ -58,12 +64,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -71,38 +79,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,12 +122,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extension_type_versions_operations.py index 67d9ef02043f..8c3770819b1c 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extension_type_versions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extension_type_versions_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._extension_type_versions_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, location: str, @@ -54,8 +60,10 @@ def list( :param extension_type_name: Extension type name. :type extension_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionList] + :return: An iterator like instance of either ExtensionVersionList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] @@ -63,36 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_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_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + 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, + location=location, + extension_type_name=extension_type_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('ExtensionVersionList', pipeline_response) + deserialized = self._deserialize("ExtensionVersionList", pipeline_response) list_of_elem = deserialized.versions if cls: list_of_elem = cls(list_of_elem) @@ -105,12 +110,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extensions_operations.py index abfa18fde518..f4fbe841edf9 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extensions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_extensions_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._extensions_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,42 +63,31 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(extension, 'Extension') - # 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_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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('Extension', pipeline_response) @@ -105,8 +99,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -126,7 +123,8 @@ async def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -135,15 +133,20 @@ async def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -158,30 +161,21 @@ async def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -193,8 +187,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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -213,7 +209,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -228,36 +225,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -266,8 +253,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -283,45 +272,35 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + 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.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -342,7 +321,8 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -352,15 +332,17 @@ async def begin_delete( :type force_delete: bool :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', @@ -378,24 +360,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -407,6 +379,7 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore async def _update_initial( @@ -424,42 +397,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(patch_extension, 'PatchExtension') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.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(patch_extension, 'PatchExtension') - body_content_kwargs['content'] = body_content - request = self._client.patch(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 [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -467,8 +429,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -488,24 +453,31 @@ async def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. :type extension_name: str :param patch_extension: Properties to Patch in an existing Extension. - :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.PatchExtension + :type patch_extension: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.PatchExtension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :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 Extension or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -520,30 +492,21 @@ async def begin_update( cluster_name=cluster_name, extension_name=extension_name, patch_extension=patch_extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -555,8 +518,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -574,12 +539,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -587,38 +554,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -631,12 +597,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_config_operation_status_operations.py index 22b61526ac84..8d9d92b2fe58 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_config_operation_status_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_config_operation_status_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, Union 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._flux_config_operation_status_operations import build_get_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 get( self, resource_group_name: str, @@ -59,7 +64,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -76,37 +82,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + operation_id=operation_id, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -115,4 +111,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_configurations_operations.py index 175b59e0bedf..f4ce0db2446b 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_flux_configurations_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._flux_configurations_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial 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_async async def get( self, resource_group_name: str, @@ -61,7 +67,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -76,36 +83,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -114,8 +111,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -131,42 +130,31 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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(flux_configuration, 'FluxConfiguration') - # 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_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.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(flux_configuration, 'FluxConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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('FluxConfiguration', pipeline_response) @@ -178,8 +166,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -199,24 +190,31 @@ async def begin_create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration: Properties necessary to Create a FluxConfiguration. - :type flux_configuration: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] + :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.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -231,30 +229,21 @@ async def begin_create_or_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration=flux_configuration, + 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('FluxConfiguration', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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: @@ -266,6 +255,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore async def _update_initial( @@ -283,42 +273,31 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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(flux_configuration_patch, 'FluxConfigurationPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.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(flux_configuration_patch, 'FluxConfigurationPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(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 [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -326,8 +305,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -347,24 +329,31 @@ async def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. - :type flux_configuration_patch: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationPatch + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationPatch :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] + :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.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -379,30 +368,21 @@ async def begin_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration_patch=flux_configuration_patch, + 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('FluxConfiguration', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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: @@ -414,6 +394,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore async def _delete_initial( @@ -431,45 +412,35 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + 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.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -490,7 +461,8 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -500,15 +472,17 @@ async def begin_delete( :type force_delete: bool :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', @@ -526,24 +500,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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: @@ -555,8 +519,10 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -574,12 +540,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FluxConfigurationsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationsList] + :return: An iterator like instance of either FluxConfigurationsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfigurationsList"] @@ -587,38 +556,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('FluxConfigurationsList', pipeline_response) + deserialized = self._deserialize("FluxConfigurationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -631,12 +599,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_location_extension_types_operations.py index 6962894f9146..9b9f60426e20 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_location_extension_types_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_location_extension_types_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._location_extension_types_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, location: str, @@ -52,7 +58,8 @@ def list( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -60,35 +67,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'location': self._serialize.url("location", location, '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, + location=location, + 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, + location=location, + 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('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,12 +104,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operation_status_operations.py index 3f20c7ee86ba..61422e641821 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operation_status_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operation_status_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, 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.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._operation_status_operations import build_get_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_async async def get( self, resource_group_name: str, @@ -60,7 +66,8 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -77,37 +84,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -116,8 +113,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -135,12 +135,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -148,38 +150,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -192,12 +193,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operations.py index 6881dde99841..8fce071678e5 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/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._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 @@ -48,8 +54,10 @@ def list( """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -57,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -93,12 +98,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_source_control_configurations_operations.py index b1f67c247e3e..3819fcf2143e 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_source_control_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/aio/operations/_source_control_configurations_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._source_control_configurations_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_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_async async def get( self, resource_group_name: str, @@ -61,14 +67,16 @@ async def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -76,36 +84,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -114,8 +112,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -135,16 +136,19 @@ async def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -152,41 +156,31 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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(source_control_configuration, 'SourceControlConfiguration') - # 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_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.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(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -199,8 +193,10 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -215,43 +211,34 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -271,22 +258,25 @@ async def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_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', @@ -303,24 +293,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -332,8 +312,10 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -351,12 +333,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -364,38 +349,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -408,12 +392,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/__init__.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/__init__.py index bd6cd25837f6..7adf89f5a789 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/__init__.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/__init__.py @@ -6,98 +6,52 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import BucketDefinition - from ._models_py3 import BucketPatchDefinition - from ._models_py3 import ClusterScopeSettings - from ._models_py3 import ComplianceStatus - from ._models_py3 import DependsOnDefinition - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import Extension - from ._models_py3 import ExtensionPropertiesAksAssignedIdentity - from ._models_py3 import ExtensionStatus - from ._models_py3 import ExtensionType - from ._models_py3 import ExtensionTypeList - from ._models_py3 import ExtensionVersionList - from ._models_py3 import ExtensionVersionListVersionsItem - from ._models_py3 import ExtensionsList - from ._models_py3 import FluxConfiguration - from ._models_py3 import FluxConfigurationPatch - from ._models_py3 import FluxConfigurationsList - from ._models_py3 import GitRepositoryDefinition - from ._models_py3 import GitRepositoryPatchDefinition - from ._models_py3 import HelmOperatorProperties - from ._models_py3 import HelmReleasePropertiesDefinition - from ._models_py3 import Identity - from ._models_py3 import KustomizationDefinition - from ._models_py3 import KustomizationPatchDefinition - from ._models_py3 import ObjectReferenceDefinition - from ._models_py3 import ObjectStatusConditionDefinition - from ._models_py3 import ObjectStatusDefinition - from ._models_py3 import OperationStatusList - from ._models_py3 import OperationStatusResult - from ._models_py3 import PatchExtension - from ._models_py3 import ProxyResource - from ._models_py3 import RepositoryRefDefinition - from ._models_py3 import Resource - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import Scope - from ._models_py3 import ScopeCluster - from ._models_py3 import ScopeNamespace - from ._models_py3 import SourceControlConfiguration - from ._models_py3 import SourceControlConfigurationList - from ._models_py3 import SupportedScopes - from ._models_py3 import SystemData -except (SyntaxError, ImportError): - from ._models import BucketDefinition # type: ignore - from ._models import BucketPatchDefinition # type: ignore - from ._models import ClusterScopeSettings # type: ignore - from ._models import ComplianceStatus # type: ignore - from ._models import DependsOnDefinition # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Extension # type: ignore - from ._models import ExtensionPropertiesAksAssignedIdentity # type: ignore - from ._models import ExtensionStatus # type: ignore - from ._models import ExtensionType # type: ignore - from ._models import ExtensionTypeList # type: ignore - from ._models import ExtensionVersionList # type: ignore - from ._models import ExtensionVersionListVersionsItem # type: ignore - from ._models import ExtensionsList # type: ignore - from ._models import FluxConfiguration # type: ignore - from ._models import FluxConfigurationPatch # type: ignore - from ._models import FluxConfigurationsList # type: ignore - from ._models import GitRepositoryDefinition # type: ignore - from ._models import GitRepositoryPatchDefinition # type: ignore - from ._models import HelmOperatorProperties # type: ignore - from ._models import HelmReleasePropertiesDefinition # type: ignore - from ._models import Identity # type: ignore - from ._models import KustomizationDefinition # type: ignore - from ._models import KustomizationPatchDefinition # type: ignore - from ._models import ObjectReferenceDefinition # type: ignore - from ._models import ObjectStatusConditionDefinition # type: ignore - from ._models import ObjectStatusDefinition # type: ignore - from ._models import OperationStatusList # type: ignore - from ._models import OperationStatusResult # type: ignore - from ._models import PatchExtension # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import RepositoryRefDefinition # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import Scope # type: ignore - from ._models import ScopeCluster # type: ignore - from ._models import ScopeNamespace # type: ignore - from ._models import SourceControlConfiguration # type: ignore - from ._models import SourceControlConfigurationList # type: ignore - from ._models import SupportedScopes # type: ignore - from ._models import SystemData # type: ignore +from ._models_py3 import BucketDefinition +from ._models_py3 import BucketPatchDefinition +from ._models_py3 import ClusterScopeSettings +from ._models_py3 import ComplianceStatus +from ._models_py3 import DependsOnDefinition +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Extension +from ._models_py3 import ExtensionPropertiesAksAssignedIdentity +from ._models_py3 import ExtensionStatus +from ._models_py3 import ExtensionType +from ._models_py3 import ExtensionTypeList +from ._models_py3 import ExtensionVersionList +from ._models_py3 import ExtensionVersionListVersionsItem +from ._models_py3 import ExtensionsList +from ._models_py3 import FluxConfiguration +from ._models_py3 import FluxConfigurationPatch +from ._models_py3 import FluxConfigurationsList +from ._models_py3 import GitRepositoryDefinition +from ._models_py3 import GitRepositoryPatchDefinition +from ._models_py3 import HelmOperatorProperties +from ._models_py3 import HelmReleasePropertiesDefinition +from ._models_py3 import Identity +from ._models_py3 import KustomizationDefinition +from ._models_py3 import KustomizationPatchDefinition +from ._models_py3 import ObjectReferenceDefinition +from ._models_py3 import ObjectStatusConditionDefinition +from ._models_py3 import ObjectStatusDefinition +from ._models_py3 import OperationStatusList +from ._models_py3 import OperationStatusResult +from ._models_py3 import PatchExtension +from ._models_py3 import ProxyResource +from ._models_py3 import RepositoryRefDefinition +from ._models_py3 import Resource +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import Scope +from ._models_py3 import ScopeCluster +from ._models_py3 import ScopeNamespace +from ._models_py3 import SourceControlConfiguration +from ._models_py3 import SourceControlConfigurationList +from ._models_py3 import SupportedScopes +from ._models_py3 import SystemData + from ._source_control_configuration_client_enums import ( ClusterTypes, diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_models.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_models.py deleted file mode 100644 index cf53332d58ca..000000000000 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_models.py +++ /dev/null @@ -1,1836 +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 BucketDefinition(msrest.serialization.Model): - """Parameters to reconcile to the GitRepository source kind type. - - :param url: The URL to sync for the flux configuration S3 bucket. - :type url: str - :param bucket_name: The bucket name to sync from the url endpoint for the flux configuration. - :type bucket_name: str - :param insecure: Specify whether to use insecure communication when puling data from the S3 - bucket. - :type insecure: bool - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository - source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git - repository source with the remote. - :type sync_interval_in_seconds: long - :param access_key: Plaintext access key used to securely access the S3 bucket. - :type access_key: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the - authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - 'bucket_name': {'key': 'bucketName', 'type': 'str'}, - 'insecure': {'key': 'insecure', 'type': 'bool'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'access_key': {'key': 'accessKey', 'type': 'str'}, - 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BucketDefinition, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - self.bucket_name = kwargs.get('bucket_name', None) - self.insecure = kwargs.get('insecure', True) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', 600) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', 600) - self.access_key = kwargs.get('access_key', None) - self.local_auth_ref = kwargs.get('local_auth_ref', None) - - -class BucketPatchDefinition(msrest.serialization.Model): - """Parameters to reconcile to the GitRepository source kind type. - - :param url: The URL to sync for the flux configuration S3 bucket. - :type url: str - :param bucket_name: The bucket name to sync from the url endpoint for the flux configuration. - :type bucket_name: str - :param insecure: Specify whether to use insecure communication when puling data from the S3 - bucket. - :type insecure: bool - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository - source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git - repository source with the remote. - :type sync_interval_in_seconds: long - :param access_key: Plaintext access key used to securely access the S3 bucket. - :type access_key: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the - authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - 'bucket_name': {'key': 'bucketName', 'type': 'str'}, - 'insecure': {'key': 'insecure', 'type': 'bool'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'access_key': {'key': 'accessKey', 'type': 'str'}, - 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(BucketPatchDefinition, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - self.bucket_name = kwargs.get('bucket_name', None) - self.insecure = kwargs.get('insecure', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', None) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', None) - self.access_key = kwargs.get('access_key', None) - self.local_auth_ref = kwargs.get('local_auth_ref', None) - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class ClusterScopeSettings(ProxyResource): - """Extension scope settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param allow_multiple_instances: Describes if multiple instances of the extension are allowed. - :type allow_multiple_instances: bool - :param default_release_namespace: Default extension release namespace. - :type default_release_namespace: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'allow_multiple_instances': {'key': 'properties.allowMultipleInstances', 'type': 'bool'}, - 'default_release_namespace': {'key': 'properties.defaultReleaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterScopeSettings, self).__init__(**kwargs) - self.allow_multiple_instances = kwargs.get('allow_multiple_instances', None) - self.default_release_namespace = kwargs.get('default_release_namespace', None) - - -class ComplianceStatus(msrest.serialization.Model): - """Compliance Status details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar compliance_state: The compliance state of the configuration. Possible values include: - "Pending", "Compliant", "Noncompliant", "Installed", "Failed". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", - "Information". - :type message_level: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.MessageLevelType - """ - - _validation = { - 'compliance_state': {'readonly': True}, - } - - _attribute_map = { - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'last_config_applied': {'key': 'lastConfigApplied', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'message_level': {'key': 'messageLevel', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComplianceStatus, self).__init__(**kwargs) - self.compliance_state = None - self.last_config_applied = kwargs.get('last_config_applied', None) - self.message = kwargs.get('message', None) - self.message_level = kwargs.get('message_level', None) - - -class DependsOnDefinition(msrest.serialization.Model): - """Specify which kustomizations must succeed reconciliation on the cluster prior to reconciling this kustomization. - - :param kustomization_name: Name of the kustomization to claim dependency on. - :type kustomization_name: str - """ - - _attribute_map = { - 'kustomization_name': {'key': 'kustomizationName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DependsOnDefinition, self).__init__(**kwargs) - self.kustomization_name = kwargs.get('kustomization_name', None) - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class Extension(ProxyResource): - """The Extension object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Identity - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the - Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - :ivar provisioning_state: Status of installation of this extension. Possible values include: - "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionStatus] - :ivar error_info: Error information from the Agent - e.g. errors during installation. - :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail - :ivar custom_location_settings: Custom Location settings properties. - :vartype custom_location_settings: dict[str, str] - :ivar package_uri: Uri of the Helm package. - :vartype package_uri: str - :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. - :type aks_assigned_identity: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionPropertiesAksAssignedIdentity - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'error_info': {'readonly': True}, - 'custom_location_settings': {'readonly': True}, - 'package_uri': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'extension_type': {'key': 'properties.extensionType', 'type': 'str'}, - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'scope': {'key': 'properties.scope', 'type': 'Scope'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ExtensionStatus]'}, - 'error_info': {'key': 'properties.errorInfo', 'type': 'ErrorDetail'}, - 'custom_location_settings': {'key': 'properties.customLocationSettings', 'type': '{str}'}, - 'package_uri': {'key': 'properties.packageUri', 'type': 'str'}, - 'aks_assigned_identity': {'key': 'properties.aksAssignedIdentity', 'type': 'ExtensionPropertiesAksAssignedIdentity'}, - } - - def __init__( - self, - **kwargs - ): - super(Extension, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.system_data = None - self.extension_type = kwargs.get('extension_type', None) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.scope = kwargs.get('scope', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.provisioning_state = None - self.statuses = kwargs.get('statuses', None) - self.error_info = None - self.custom_location_settings = None - self.package_uri = None - self.aks_assigned_identity = kwargs.get('aks_assigned_identity', None) - - -class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): - """Identity of the Extension resource in an AKS cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class ExtensionsList(msrest.serialization.Model): - """Result of the request to list Extensions. It contains a list of Extension objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Extensions within a Kubernetes cluster. - :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] - :ivar next_link: URL to get the next set of extension objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Extension]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExtensionStatus(msrest.serialization.Model): - """Status from the extension. - - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". - Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'display_status': {'key': 'displayStatus', 'type': 'str'}, - 'level': {'key': 'level', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'time': {'key': 'time', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionStatus, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.display_status = kwargs.get('display_status', None) - self.level = kwargs.get('level', "Information") - self.message = kwargs.get('message', None) - self.time = kwargs.get('time', None) - - -class ExtensionType(msrest.serialization.Model): - """Represents an Extension Type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :ivar release_trains: Extension release train: preview or stable. - :vartype release_trains: list[str] - :ivar cluster_types: Cluster types. Possible values include: "connectedClusters", - "managedClusters". - :vartype cluster_types: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ClusterTypes - :ivar supported_scopes: Extension scopes. - :vartype supported_scopes: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SupportedScopes - """ - - _validation = { - 'system_data': {'readonly': True}, - 'release_trains': {'readonly': True}, - 'cluster_types': {'readonly': True}, - 'supported_scopes': {'readonly': True}, - } - - _attribute_map = { - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'release_trains': {'key': 'properties.releaseTrains', 'type': '[str]'}, - 'cluster_types': {'key': 'properties.clusterTypes', 'type': 'str'}, - 'supported_scopes': {'key': 'properties.supportedScopes', 'type': 'SupportedScopes'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionType, self).__init__(**kwargs) - self.system_data = None - self.release_trains = None - self.cluster_types = None - self.supported_scopes = None - - -class ExtensionTypeList(msrest.serialization.Model): - """List Extension Types. - - :param value: The list of Extension Types. - :type value: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExtensionType]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionTypeList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ExtensionVersionList(msrest.serialization.Model): - """List versions for an Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param versions: Versions available for this Extension Type. - :type versions: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionListVersionsItem] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - """ - - _validation = { - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'versions': {'key': 'versions', 'type': '[ExtensionVersionListVersionsItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionVersionList, self).__init__(**kwargs) - self.versions = kwargs.get('versions', None) - self.next_link = kwargs.get('next_link', None) - self.system_data = None - - -class ExtensionVersionListVersionsItem(msrest.serialization.Model): - """ExtensionVersionListVersionsItem. - - :param release_train: The release train for this Extension Type. - :type release_train: str - :param versions: Versions available for this Extension Type and release train. - :type versions: list[str] - """ - - _attribute_map = { - 'release_train': {'key': 'releaseTrain', 'type': 'str'}, - 'versions': {'key': 'versions', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ExtensionVersionListVersionsItem, self).__init__(**kwargs) - self.release_train = kwargs.get('release_train', None) - self.versions = kwargs.get('versions', None) - - -class FluxConfiguration(ProxyResource): - """The Flux Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :param scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type scope: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeType - :param namespace: The namespace to which this configuration is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type namespace: str - :param source_kind: Source Kind to pull the configuration data from. Possible values include: - "GitRepository", "Bucket". - :type source_kind: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its - kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.GitRepositoryDefinition - :param bucket: Parameters to reconcile to the Bucket source kind type. - :type bucket: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the - source type on the cluster. - :type kustomizations: dict[str, - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.KustomizationDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :ivar statuses: Statuses of the Flux Kubernetes resources created by the fluxConfiguration or - created by the managed objects provisioned by the fluxConfiguration. - :vartype statuses: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectStatusDefinition] - :ivar repository_public_key: Public Key associated with this fluxConfiguration (either - generated within the cluster or provided by the user). - :vartype repository_public_key: str - :ivar last_source_updated_commit_id: Branch and SHA of the last source commit synced with the - cluster. - :vartype last_source_updated_commit_id: str - :ivar last_source_updated_at: Datetime the fluxConfiguration last synced its source on the - cluster. - :vartype last_source_updated_at: ~datetime.datetime - :ivar compliance_state: Combined status of the Flux Kubernetes resources created by the - fluxConfiguration or created by the managed objects. Possible values include: "Compliant", - "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". - :vartype compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxComplianceState - :ivar provisioning_state: Status of the creation of the fluxConfiguration. Possible values - include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ProvisioningState - :ivar error_message: Error message returned to the user in the case of provisioning failure. - :vartype error_message: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'statuses': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'last_source_updated_commit_id': {'readonly': True}, - 'last_source_updated_at': {'readonly': True}, - 'compliance_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'error_message': {'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'}, - 'scope': {'key': 'properties.scope', 'type': 'str'}, - 'namespace': {'key': 'properties.namespace', 'type': 'str'}, - 'source_kind': {'key': 'properties.sourceKind', 'type': 'str'}, - 'suspend': {'key': 'properties.suspend', 'type': 'bool'}, - 'git_repository': {'key': 'properties.gitRepository', 'type': 'GitRepositoryDefinition'}, - 'bucket': {'key': 'properties.bucket', 'type': 'BucketDefinition'}, - 'kustomizations': {'key': 'properties.kustomizations', 'type': '{KustomizationDefinition}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'statuses': {'key': 'properties.statuses', 'type': '[ObjectStatusDefinition]'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'last_source_updated_commit_id': {'key': 'properties.lastSourceUpdatedCommitId', 'type': 'str'}, - 'last_source_updated_at': {'key': 'properties.lastSourceUpdatedAt', 'type': 'iso-8601'}, - 'compliance_state': {'key': 'properties.complianceState', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'error_message': {'key': 'properties.errorMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FluxConfiguration, self).__init__(**kwargs) - self.system_data = None - self.scope = kwargs.get('scope', "cluster") - self.namespace = kwargs.get('namespace', "default") - self.source_kind = kwargs.get('source_kind', None) - self.suspend = kwargs.get('suspend', False) - self.git_repository = kwargs.get('git_repository', None) - self.bucket = kwargs.get('bucket', None) - self.kustomizations = kwargs.get('kustomizations', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.statuses = None - self.repository_public_key = None - self.last_source_updated_commit_id = None - self.last_source_updated_at = None - self.compliance_state = None - self.provisioning_state = None - self.error_message = None - - -class FluxConfigurationPatch(msrest.serialization.Model): - """The Flux Configuration Patch Request object. - - :param source_kind: Source Kind to pull the configuration data from. Possible values include: - "GitRepository", "Bucket". - :type source_kind: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its - kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.GitRepositoryPatchDefinition - :param bucket: Parameters to reconcile to the Bucket source kind type. - :type bucket: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the - source type on the cluster. - :type kustomizations: dict[str, - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.KustomizationPatchDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - """ - - _attribute_map = { - 'source_kind': {'key': 'properties.sourceKind', 'type': 'str'}, - 'suspend': {'key': 'properties.suspend', 'type': 'bool'}, - 'git_repository': {'key': 'properties.gitRepository', 'type': 'GitRepositoryPatchDefinition'}, - 'bucket': {'key': 'properties.bucket', 'type': 'BucketDefinition'}, - 'kustomizations': {'key': 'properties.kustomizations', 'type': '{KustomizationPatchDefinition}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(FluxConfigurationPatch, self).__init__(**kwargs) - self.source_kind = kwargs.get('source_kind', None) - self.suspend = kwargs.get('suspend', None) - self.git_repository = kwargs.get('git_repository', None) - self.bucket = kwargs.get('bucket', None) - self.kustomizations = kwargs.get('kustomizations', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - - -class FluxConfigurationsList(msrest.serialization.Model): - """Result of the request to list Flux Configurations. It contains a list of FluxConfiguration objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Flux Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FluxConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FluxConfigurationsList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class GitRepositoryDefinition(msrest.serialization.Model): - """Parameters to reconcile to the GitRepository source kind type. - - :param url: The URL to sync for the flux configuration git repository. - :type url: str - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository - source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git - repository source with the remote. - :type sync_interval_in_seconds: long - :param repository_ref: The source reference for the GitRepository object. - :type repository_ref: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.RepositoryRefDefinition - :param ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to - access private git repositories over SSH. - :type ssh_known_hosts: str - :param https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. - :type https_user: str - :param https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git - private git repositories over HTTPS. - :type https_ca_cert: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the - authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'repository_ref': {'key': 'repositoryRef', 'type': 'RepositoryRefDefinition'}, - 'ssh_known_hosts': {'key': 'sshKnownHosts', 'type': 'str'}, - 'https_user': {'key': 'httpsUser', 'type': 'str'}, - 'https_ca_cert': {'key': 'httpsCACert', 'type': 'str'}, - 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GitRepositoryDefinition, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', 600) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', 600) - self.repository_ref = kwargs.get('repository_ref', None) - self.ssh_known_hosts = kwargs.get('ssh_known_hosts', None) - self.https_user = kwargs.get('https_user', None) - self.https_ca_cert = kwargs.get('https_ca_cert', None) - self.local_auth_ref = kwargs.get('local_auth_ref', None) - - -class GitRepositoryPatchDefinition(msrest.serialization.Model): - """Parameters to reconcile to the GitRepository source kind type. - - :param url: The URL to sync for the flux configuration git repository. - :type url: str - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository - source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git - repository source with the remote. - :type sync_interval_in_seconds: long - :param repository_ref: The source reference for the GitRepository object. - :type repository_ref: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.RepositoryRefDefinition - :param ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to - access private git repositories over SSH. - :type ssh_known_hosts: str - :param https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. - :type https_user: str - :param https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git - private git repositories over HTTPS. - :type https_ca_cert: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the - authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str - """ - - _attribute_map = { - 'url': {'key': 'url', 'type': 'str'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'repository_ref': {'key': 'repositoryRef', 'type': 'RepositoryRefDefinition'}, - 'ssh_known_hosts': {'key': 'sshKnownHosts', 'type': 'str'}, - 'https_user': {'key': 'httpsUser', 'type': 'str'}, - 'https_ca_cert': {'key': 'httpsCACert', 'type': 'str'}, - 'local_auth_ref': {'key': 'localAuthRef', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(GitRepositoryPatchDefinition, self).__init__(**kwargs) - self.url = kwargs.get('url', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', None) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', None) - self.repository_ref = kwargs.get('repository_ref', None) - self.ssh_known_hosts = kwargs.get('ssh_known_hosts', None) - self.https_user = kwargs.get('https_user', None) - self.https_ca_cert = kwargs.get('https_ca_cert', None) - self.local_auth_ref = kwargs.get('local_auth_ref', None) - - -class HelmOperatorProperties(msrest.serialization.Model): - """Properties for Helm operator. - - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str - """ - - _attribute_map = { - 'chart_version': {'key': 'chartVersion', 'type': 'str'}, - 'chart_values': {'key': 'chartValues', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmOperatorProperties, self).__init__(**kwargs) - self.chart_version = kwargs.get('chart_version', None) - self.chart_values = kwargs.get('chart_values', None) - - -class HelmReleasePropertiesDefinition(msrest.serialization.Model): - """HelmReleasePropertiesDefinition. - - :param last_revision_applied: The revision number of the last released object change. - :type last_revision_applied: long - :param helm_chart_ref: The reference to the HelmChart object used as the source to this - HelmRelease. - :type helm_chart_ref: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectReferenceDefinition - :param failure_count: Total number of times that the HelmRelease failed to install or upgrade. - :type failure_count: long - :param install_failure_count: Number of times that the HelmRelease failed to install. - :type install_failure_count: long - :param upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. - :type upgrade_failure_count: long - """ - - _attribute_map = { - 'last_revision_applied': {'key': 'lastRevisionApplied', 'type': 'long'}, - 'helm_chart_ref': {'key': 'helmChartRef', 'type': 'ObjectReferenceDefinition'}, - 'failure_count': {'key': 'failureCount', 'type': 'long'}, - 'install_failure_count': {'key': 'installFailureCount', 'type': 'long'}, - 'upgrade_failure_count': {'key': 'upgradeFailureCount', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(HelmReleasePropertiesDefinition, self).__init__(**kwargs) - self.last_revision_applied = kwargs.get('last_revision_applied', None) - self.helm_chart_ref = kwargs.get('helm_chart_ref', None) - self.failure_count = kwargs.get('failure_count', None) - self.install_failure_count = kwargs.get('install_failure_count', None) - self.upgrade_failure_count = kwargs.get('upgrade_failure_count', None) - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class KustomizationDefinition(msrest.serialization.Model): - """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. - - :param path: The path in the source reference to reconcile on the cluster. - :type path: str - :param depends_on: Specifies other Kustomizations that this Kustomization depends on. This - Kustomization will not reconcile until all dependencies have completed their reconciliation. - :type depends_on: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.DependsOnDefinition] - :param timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the - cluster. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the - cluster. - :type sync_interval_in_seconds: long - :param retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on - the cluster in the event of failure on reconciliation. - :type retry_interval_in_seconds: long - :param prune: Enable/disable garbage collections of Kubernetes objects created by this - Kustomization. - :type prune: bool - :param force: Enable/disable re-creating Kubernetes resources on the cluster when patching - fails due to an immutable field change. - :type force: bool - """ - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'depends_on': {'key': 'dependsOn', 'type': '[DependsOnDefinition]'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'retry_interval_in_seconds': {'key': 'retryIntervalInSeconds', 'type': 'long'}, - 'prune': {'key': 'prune', 'type': 'bool'}, - 'force': {'key': 'force', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(KustomizationDefinition, self).__init__(**kwargs) - self.path = kwargs.get('path', "") - self.depends_on = kwargs.get('depends_on', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', 600) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', 600) - self.retry_interval_in_seconds = kwargs.get('retry_interval_in_seconds', None) - self.prune = kwargs.get('prune', False) - self.force = kwargs.get('force', False) - - -class KustomizationPatchDefinition(msrest.serialization.Model): - """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. - - :param path: The path in the source reference to reconcile on the cluster. - :type path: str - :param depends_on: Specifies other Kustomizations that this Kustomization depends on. This - Kustomization will not reconcile until all dependencies have completed their reconciliation. - :type depends_on: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.DependsOnDefinition] - :param timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the - cluster. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the - cluster. - :type sync_interval_in_seconds: long - :param retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on - the cluster in the event of failure on reconciliation. - :type retry_interval_in_seconds: long - :param prune: Enable/disable garbage collections of Kubernetes objects created by this - Kustomization. - :type prune: bool - :param force: Enable/disable re-creating Kubernetes resources on the cluster when patching - fails due to an immutable field change. - :type force: bool - """ - - _attribute_map = { - 'path': {'key': 'path', 'type': 'str'}, - 'depends_on': {'key': 'dependsOn', 'type': '[DependsOnDefinition]'}, - 'timeout_in_seconds': {'key': 'timeoutInSeconds', 'type': 'long'}, - 'sync_interval_in_seconds': {'key': 'syncIntervalInSeconds', 'type': 'long'}, - 'retry_interval_in_seconds': {'key': 'retryIntervalInSeconds', 'type': 'long'}, - 'prune': {'key': 'prune', 'type': 'bool'}, - 'force': {'key': 'force', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(KustomizationPatchDefinition, self).__init__(**kwargs) - self.path = kwargs.get('path', None) - self.depends_on = kwargs.get('depends_on', None) - self.timeout_in_seconds = kwargs.get('timeout_in_seconds', None) - self.sync_interval_in_seconds = kwargs.get('sync_interval_in_seconds', None) - self.retry_interval_in_seconds = kwargs.get('retry_interval_in_seconds', None) - self.prune = kwargs.get('prune', None) - self.force = kwargs.get('force', None) - - -class ObjectReferenceDefinition(msrest.serialization.Model): - """Object reference to a Kubernetes object on a cluster. - - :param name: Name of the object. - :type name: str - :param namespace: Namespace of the object. - :type namespace: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectReferenceDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.namespace = kwargs.get('namespace', None) - - -class ObjectStatusConditionDefinition(msrest.serialization.Model): - """Status condition of Kubernetes object. - - :param last_transition_time: Last time this status condition has changed. - :type last_transition_time: ~datetime.datetime - :param message: A more verbose description of the object status condition. - :type message: str - :param reason: Reason for the specified status condition type status. - :type reason: str - :param status: Status of the Kubernetes object condition type. - :type status: str - :param type: Object status condition type for this object. - :type type: str - """ - - _attribute_map = { - 'last_transition_time': {'key': 'lastTransitionTime', 'type': 'iso-8601'}, - 'message': {'key': 'message', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectStatusConditionDefinition, self).__init__(**kwargs) - self.last_transition_time = kwargs.get('last_transition_time', None) - self.message = kwargs.get('message', None) - self.reason = kwargs.get('reason', None) - self.status = kwargs.get('status', None) - self.type = kwargs.get('type', None) - - -class ObjectStatusDefinition(msrest.serialization.Model): - """Statuses of objects deployed by the user-specified kustomizations from the git repository. - - :param name: Name of the applied object. - :type name: str - :param namespace: Namespace of the applied object. - :type namespace: str - :param kind: Kind of the applied object. - :type kind: str - :param compliance_state: Compliance state of the applied object showing whether the applied - object has come into a ready state on the cluster. Possible values include: "Compliant", - "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". - :type compliance_state: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxComplianceState - :param applied_by: Object reference to the Kustomization that applied this object. - :type applied_by: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectReferenceDefinition - :param status_conditions: List of Kubernetes object status conditions present on the cluster. - :type status_conditions: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectStatusConditionDefinition] - :param helm_release_properties: Additional properties that are provided from objects of the - HelmRelease kind. - :type helm_release_properties: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.HelmReleasePropertiesDefinition - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'namespace': {'key': 'namespace', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'compliance_state': {'key': 'complianceState', 'type': 'str'}, - 'applied_by': {'key': 'appliedBy', 'type': 'ObjectReferenceDefinition'}, - 'status_conditions': {'key': 'statusConditions', 'type': '[ObjectStatusConditionDefinition]'}, - 'helm_release_properties': {'key': 'helmReleaseProperties', 'type': 'HelmReleasePropertiesDefinition'}, - } - - def __init__( - self, - **kwargs - ): - super(ObjectStatusDefinition, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.namespace = kwargs.get('namespace', None) - self.kind = kwargs.get('kind', None) - self.compliance_state = kwargs.get('compliance_state', "Unknown") - self.applied_by = kwargs.get('applied_by', None) - self.status_conditions = kwargs.get('status_conditions', None) - self.helm_release_properties = kwargs.get('helm_release_properties', None) - - -class OperationStatusList(msrest.serialization.Model): - """The async operations in progress, in the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of async operations in progress, in the cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusResult] - :ivar next_link: URL to get the next set of Operation Result objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationStatusResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class OperationStatusResult(msrest.serialization.Model): - """The current status of an async operation. - - 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 id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] - :ivar error: If present, details of the operation error. - :vartype error: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail - """ - - _validation = { - 'status': {'required': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{str}'}, - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationStatusResult, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.status = kwargs['status'] - self.properties = kwargs.get('properties', None) - self.error = None - - -class PatchExtension(msrest.serialization.Model): - """The Extension Patch Request object. - - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade - of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific - version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param configuration_settings: Configuration settings, as name-value pairs for configuring this - extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as - name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] - """ - - _attribute_map = { - 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, - 'release_train': {'key': 'properties.releaseTrain', 'type': 'str'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'configuration_settings': {'key': 'properties.configurationSettings', 'type': '{str}'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(PatchExtension, self).__init__(**kwargs) - self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', True) - self.release_train = kwargs.get('release_train', "Stable") - self.version = kwargs.get('version', None) - self.configuration_settings = kwargs.get('configuration_settings', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - - -class RepositoryRefDefinition(msrest.serialization.Model): - """The source reference for the GitRepository object. - - :param branch: The git repository branch name to checkout. - :type branch: str - :param tag: The git repository tag name to checkout. This takes precedence over branch. - :type tag: str - :param semver: The semver range used to match against git repository tags. This takes - precedence over tag. - :type semver: str - :param commit: The commit SHA to checkout. This value must be combined with the branch name to - be valid. This takes precedence over semver. - :type commit: str - """ - - _attribute_map = { - 'branch': {'key': 'branch', 'type': 'str'}, - 'tag': {'key': 'tag', 'type': 'str'}, - 'semver': {'key': 'semver', 'type': 'str'}, - 'commit': {'key': 'commit', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RepositoryRefDefinition, self).__init__(**kwargs) - self.branch = kwargs.get('branch', None) - self.tag = kwargs.get('tag', None) - self.semver = kwargs.get('semver', None) - self.commit = kwargs.get('commit', None) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationDisplay - :ivar is_data_action: The flag that indicates whether the operation applies to data plane. - :vartype is_data_action: bool - :ivar origin: Origin of the operation. - :vartype origin: str - """ - - _validation = { - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'origin': {'key': 'origin', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = None - self.origin = None - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :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(ResourceProviderOperationDisplay, 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 ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperation] - :ivar next_link: URL to the next set of results, if any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Scope(msrest.serialization.Model): - """Scope of the extension. It can be either Cluster or Namespace; but not both. - - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeNamespace - """ - - _attribute_map = { - 'cluster': {'key': 'cluster', 'type': 'ScopeCluster'}, - 'namespace': {'key': 'namespace', 'type': 'ScopeNamespace'}, - } - - def __init__( - self, - **kwargs - ): - super(Scope, self).__init__(**kwargs) - self.cluster = kwargs.get('cluster', None) - self.namespace = kwargs.get('namespace', None) - - -class ScopeCluster(msrest.serialization.Model): - """Specifies that the scope of the extension is Cluster. - - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster - scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str - """ - - _attribute_map = { - 'release_namespace': {'key': 'releaseNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeCluster, self).__init__(**kwargs) - self.release_namespace = kwargs.get('release_namespace', None) - - -class ScopeNamespace(msrest.serialization.Model): - """Specifies that the scope of the extension is Namespace. - - :param target_namespace: Namespace where the extension will be created for an Namespace scoped - extension. If this namespace does not exist, it will be created. - :type target_namespace: str - """ - - _attribute_map = { - 'target_namespace': {'key': 'targetNamespace', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScopeNamespace, self).__init__(**kwargs) - self.target_namespace = kwargs.get('target_namespace', None) - - -class SourceControlConfiguration(ProxyResource): - """The SourceControl Configuration object returned in Get & Put response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Top level metadata - https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. - :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 - lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific - configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperatorScopeType - :ivar repository_public_key: Public Key associated with this SourceControl configuration - (either generated within the cluster or provided by the user). - :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys - required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.HelmOperatorProperties - :ivar provisioning_state: The provisioning state of the resource provider. Possible values - include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". - :vartype provisioning_state: str or - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ProvisioningStateType - :ivar compliance_status: Compliance Status of the Configuration. - :vartype compliance_status: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ComplianceStatus - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'repository_public_key': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'compliance_status': {'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'}, - 'repository_url': {'key': 'properties.repositoryUrl', 'type': 'str'}, - 'operator_namespace': {'key': 'properties.operatorNamespace', 'type': 'str'}, - 'operator_instance_name': {'key': 'properties.operatorInstanceName', 'type': 'str'}, - 'operator_type': {'key': 'properties.operatorType', 'type': 'str'}, - 'operator_params': {'key': 'properties.operatorParams', 'type': 'str'}, - 'configuration_protected_settings': {'key': 'properties.configurationProtectedSettings', 'type': '{str}'}, - 'operator_scope': {'key': 'properties.operatorScope', 'type': 'str'}, - 'repository_public_key': {'key': 'properties.repositoryPublicKey', 'type': 'str'}, - 'ssh_known_hosts_contents': {'key': 'properties.sshKnownHostsContents', 'type': 'str'}, - 'enable_helm_operator': {'key': 'properties.enableHelmOperator', 'type': 'bool'}, - 'helm_operator_properties': {'key': 'properties.helmOperatorProperties', 'type': 'HelmOperatorProperties'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'compliance_status': {'key': 'properties.complianceStatus', 'type': 'ComplianceStatus'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfiguration, self).__init__(**kwargs) - self.system_data = None - self.repository_url = kwargs.get('repository_url', None) - self.operator_namespace = kwargs.get('operator_namespace', "default") - self.operator_instance_name = kwargs.get('operator_instance_name', None) - self.operator_type = kwargs.get('operator_type', None) - self.operator_params = kwargs.get('operator_params', None) - self.configuration_protected_settings = kwargs.get('configuration_protected_settings', None) - self.operator_scope = kwargs.get('operator_scope', "cluster") - self.repository_public_key = None - self.ssh_known_hosts_contents = kwargs.get('ssh_known_hosts_contents', None) - self.enable_helm_operator = kwargs.get('enable_helm_operator', None) - self.helm_operator_properties = kwargs.get('helm_operator_properties', None) - self.provisioning_state = None - self.compliance_status = None - - -class SourceControlConfigurationList(msrest.serialization.Model): - """Result of the request to list Source Control Configurations. It contains a list of SourceControlConfiguration objects and a URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Source Control Configurations within a Kubernetes cluster. - :vartype value: - list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration] - :ivar next_link: URL to get the next set of configuration objects, if any. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SourceControlConfiguration]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SourceControlConfigurationList, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class SupportedScopes(msrest.serialization.Model): - """Extension scopes. - - :param default_scope: Default extension scopes: cluster or namespace. - :type default_scope: str - :param cluster_scope_settings: Scope settings. - :type cluster_scope_settings: - ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ClusterScopeSettings - """ - - _attribute_map = { - 'default_scope': {'key': 'defaultScope', 'type': 'str'}, - 'cluster_scope_settings': {'key': 'clusterScopeSettings', 'type': 'ClusterScopeSettings'}, - } - - def __init__( - self, - **kwargs - ): - super(SupportedScopes, self).__init__(**kwargs) - self.default_scope = kwargs.get('default_scope', None) - self.cluster_scope_settings = kwargs.get('cluster_scope_settings', 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.kubernetesconfiguration.v2022_01_01_preview.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.kubernetesconfiguration.v2022_01_01_preview.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) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_models_py3.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_models_py3.py index 23eef7e57d62..97d3533d40dc 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_models_py3.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_models_py3.py @@ -18,24 +18,24 @@ class BucketDefinition(msrest.serialization.Model): """Parameters to reconcile to the GitRepository source kind type. - :param url: The URL to sync for the flux configuration S3 bucket. - :type url: str - :param bucket_name: The bucket name to sync from the url endpoint for the flux configuration. - :type bucket_name: str - :param insecure: Specify whether to use insecure communication when puling data from the S3 + :ivar url: The URL to sync for the flux configuration S3 bucket. + :vartype url: str + :ivar bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :vartype bucket_name: str + :ivar insecure: Specify whether to use insecure communication when puling data from the S3 bucket. - :type insecure: bool - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + :vartype insecure: bool + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git repository source with the remote. - :type sync_interval_in_seconds: long - :param access_key: Plaintext access key used to securely access the S3 bucket. - :type access_key: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + :vartype sync_interval_in_seconds: long + :ivar access_key: Plaintext access key used to securely access the S3 bucket. + :vartype access_key: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str + :vartype local_auth_ref: str """ _attribute_map = { @@ -60,6 +60,26 @@ def __init__( local_auth_ref: Optional[str] = None, **kwargs ): + """ + :keyword url: The URL to sync for the flux configuration S3 bucket. + :paramtype url: str + :keyword bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :paramtype bucket_name: str + :keyword insecure: Specify whether to use insecure communication when puling data from the S3 + bucket. + :paramtype insecure: bool + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword access_key: Plaintext access key used to securely access the S3 bucket. + :paramtype access_key: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ super(BucketDefinition, self).__init__(**kwargs) self.url = url self.bucket_name = bucket_name @@ -73,24 +93,24 @@ def __init__( class BucketPatchDefinition(msrest.serialization.Model): """Parameters to reconcile to the GitRepository source kind type. - :param url: The URL to sync for the flux configuration S3 bucket. - :type url: str - :param bucket_name: The bucket name to sync from the url endpoint for the flux configuration. - :type bucket_name: str - :param insecure: Specify whether to use insecure communication when puling data from the S3 + :ivar url: The URL to sync for the flux configuration S3 bucket. + :vartype url: str + :ivar bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :vartype bucket_name: str + :ivar insecure: Specify whether to use insecure communication when puling data from the S3 bucket. - :type insecure: bool - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + :vartype insecure: bool + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git repository source with the remote. - :type sync_interval_in_seconds: long - :param access_key: Plaintext access key used to securely access the S3 bucket. - :type access_key: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + :vartype sync_interval_in_seconds: long + :ivar access_key: Plaintext access key used to securely access the S3 bucket. + :vartype access_key: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str + :vartype local_auth_ref: str """ _attribute_map = { @@ -115,6 +135,26 @@ def __init__( local_auth_ref: Optional[str] = None, **kwargs ): + """ + :keyword url: The URL to sync for the flux configuration S3 bucket. + :paramtype url: str + :keyword bucket_name: The bucket name to sync from the url endpoint for the flux configuration. + :paramtype bucket_name: str + :keyword insecure: Specify whether to use insecure communication when puling data from the S3 + bucket. + :paramtype insecure: bool + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword access_key: Plaintext access key used to securely access the S3 bucket. + :paramtype access_key: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ super(BucketPatchDefinition, self).__init__(**kwargs) self.url = url self.bucket_name = bucket_name @@ -156,6 +196,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -193,6 +235,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -209,10 +253,10 @@ class ClusterScopeSettings(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param allow_multiple_instances: Describes if multiple instances of the extension are allowed. - :type allow_multiple_instances: bool - :param default_release_namespace: Default extension release namespace. - :type default_release_namespace: str + :ivar allow_multiple_instances: Describes if multiple instances of the extension are allowed. + :vartype allow_multiple_instances: bool + :ivar default_release_namespace: Default extension release namespace. + :vartype default_release_namespace: str """ _validation = { @@ -236,6 +280,13 @@ def __init__( default_release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword allow_multiple_instances: Describes if multiple instances of the extension are + allowed. + :paramtype allow_multiple_instances: bool + :keyword default_release_namespace: Default extension release namespace. + :paramtype default_release_namespace: str + """ super(ClusterScopeSettings, self).__init__(**kwargs) self.allow_multiple_instances = allow_multiple_instances self.default_release_namespace = default_release_namespace @@ -250,13 +301,13 @@ class ComplianceStatus(msrest.serialization.Model): "Pending", "Compliant", "Noncompliant", "Installed", "Failed". :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ComplianceStateType - :param last_config_applied: Datetime the configuration was last applied. - :type last_config_applied: ~datetime.datetime - :param message: Message from when the configuration was applied. - :type message: str - :param message_level: Level of the message. Possible values include: "Error", "Warning", + :ivar last_config_applied: Datetime the configuration was last applied. + :vartype last_config_applied: ~datetime.datetime + :ivar message: Message from when the configuration was applied. + :vartype message: str + :ivar message_level: Level of the message. Possible values include: "Error", "Warning", "Information". - :type message_level: str or + :vartype message_level: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.MessageLevelType """ @@ -279,6 +330,16 @@ def __init__( message_level: Optional[Union[str, "MessageLevelType"]] = None, **kwargs ): + """ + :keyword last_config_applied: Datetime the configuration was last applied. + :paramtype last_config_applied: ~datetime.datetime + :keyword message: Message from when the configuration was applied. + :paramtype message: str + :keyword message_level: Level of the message. Possible values include: "Error", "Warning", + "Information". + :paramtype message_level: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.MessageLevelType + """ super(ComplianceStatus, self).__init__(**kwargs) self.compliance_state = None self.last_config_applied = last_config_applied @@ -289,8 +350,8 @@ def __init__( class DependsOnDefinition(msrest.serialization.Model): """Specify which kustomizations must succeed reconciliation on the cluster prior to reconciling this kustomization. - :param kustomization_name: Name of the kustomization to claim dependency on. - :type kustomization_name: str + :ivar kustomization_name: Name of the kustomization to claim dependency on. + :vartype kustomization_name: str """ _attribute_map = { @@ -303,6 +364,10 @@ def __init__( kustomization_name: Optional[str] = None, **kwargs ): + """ + :keyword kustomization_name: Name of the kustomization to claim dependency on. + :paramtype kustomization_name: str + """ super(DependsOnDefinition, self).__init__(**kwargs) self.kustomization_name = kustomization_name @@ -332,6 +397,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -376,6 +443,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -387,8 +456,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail """ _attribute_map = { @@ -401,6 +470,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -418,38 +491,38 @@ class Extension(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param identity: Identity of the Extension resource. - :type identity: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Identity + :ivar identity: Identity of the Extension resource. + :vartype identity: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Identity :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :param extension_type: Type of the Extension, of which this resource is an instance of. It - must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + :ivar extension_type: Type of the Extension, of which this resource is an instance of. It must + be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the Extension publisher. - :type extension_type: str - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :vartype extension_type: str + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param scope: Scope at which the extension is installed. - :type scope: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Scope - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar scope: Scope at which the extension is installed. + :vartype scope: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Scope + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] :ivar provisioning_state: Status of installation of this extension. Possible values include: "Succeeded", "Failed", "Canceled", "Creating", "Updating", "Deleting". :vartype provisioning_state: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ProvisioningState - :param statuses: Status from this extension. - :type statuses: + :ivar statuses: Status from this extension. + :vartype statuses: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionStatus] :ivar error_info: Error information from the Agent - e.g. errors during installation. :vartype error_info: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail @@ -457,8 +530,8 @@ class Extension(ProxyResource): :vartype custom_location_settings: dict[str, str] :ivar package_uri: Uri of the Helm package. :vartype package_uri: str - :param aks_assigned_identity: Identity of the Extension resource in an AKS cluster. - :type aks_assigned_identity: + :ivar aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :vartype aks_assigned_identity: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionPropertiesAksAssignedIdentity """ @@ -509,6 +582,37 @@ def __init__( aks_assigned_identity: Optional["ExtensionPropertiesAksAssignedIdentity"] = None, **kwargs ): + """ + :keyword identity: Identity of the Extension resource. + :paramtype identity: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Identity + :keyword extension_type: Type of the Extension, of which this resource is an instance of. It + must be one of the Extension Types registered with Microsoft.KubernetesConfiguration by the + Extension publisher. + :paramtype extension_type: str + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword scope: Scope at which the extension is installed. + :paramtype scope: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Scope + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + :keyword statuses: Status from this extension. + :paramtype statuses: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionStatus] + :keyword aks_assigned_identity: Identity of the Extension resource in an AKS cluster. + :paramtype aks_assigned_identity: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionPropertiesAksAssignedIdentity + """ super(Extension, self).__init__(**kwargs) self.identity = identity self.system_data = None @@ -536,9 +640,9 @@ class ExtensionPropertiesAksAssignedIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -558,6 +662,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(ExtensionPropertiesAksAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -589,6 +698,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -597,17 +708,17 @@ def __init__( class ExtensionStatus(msrest.serialization.Model): """Status from the extension. - :param code: Status code provided by the Extension. - :type code: str - :param display_status: Short description of status of the extension. - :type display_status: str - :param level: Level of the status. Possible values include: "Error", "Warning", "Information". + :ivar code: Status code provided by the Extension. + :vartype code: str + :ivar display_status: Short description of status of the extension. + :vartype display_status: str + :ivar level: Level of the status. Possible values include: "Error", "Warning", "Information". Default value: "Information". - :type level: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.LevelType - :param message: Detailed message of the status from the Extension. - :type message: str - :param time: DateLiteral (per ISO8601) noting the time of installation status. - :type time: str + :vartype level: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.LevelType + :ivar message: Detailed message of the status from the Extension. + :vartype message: str + :ivar time: DateLiteral (per ISO8601) noting the time of installation status. + :vartype time: str """ _attribute_map = { @@ -628,6 +739,20 @@ def __init__( time: Optional[str] = None, **kwargs ): + """ + :keyword code: Status code provided by the Extension. + :paramtype code: str + :keyword display_status: Short description of status of the extension. + :paramtype display_status: str + :keyword level: Level of the status. Possible values include: "Error", "Warning", + "Information". Default value: "Information". + :paramtype level: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.LevelType + :keyword message: Detailed message of the status from the Extension. + :paramtype message: str + :keyword time: DateLiteral (per ISO8601) noting the time of installation status. + :paramtype time: str + """ super(ExtensionStatus, self).__init__(**kwargs) self.code = code self.display_status = display_status @@ -672,6 +797,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExtensionType, self).__init__(**kwargs) self.system_data = None self.release_trains = None @@ -682,10 +809,11 @@ def __init__( class ExtensionTypeList(msrest.serialization.Model): """List Extension Types. - :param value: The list of Extension Types. - :type value: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str + :ivar value: The list of Extension Types. + :vartype value: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType] + :ivar next_link: The link to fetch the next page of Extension Types. + :vartype next_link: str """ _attribute_map = { @@ -700,6 +828,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of Extension Types. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionType] + :keyword next_link: The link to fetch the next page of Extension Types. + :paramtype next_link: str + """ super(ExtensionTypeList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -710,11 +845,11 @@ class ExtensionVersionList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param versions: Versions available for this Extension Type. - :type versions: + :ivar versions: Versions available for this Extension Type. + :vartype versions: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionListVersionsItem] - :param next_link: The link to fetch the next page of Extension Types. - :type next_link: str + :ivar next_link: The link to fetch the next page of Extension Types. + :vartype next_link: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData """ @@ -736,6 +871,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword versions: Versions available for this Extension Type. + :paramtype versions: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionListVersionsItem] + :keyword next_link: The link to fetch the next page of Extension Types. + :paramtype next_link: str + """ super(ExtensionVersionList, self).__init__(**kwargs) self.versions = versions self.next_link = next_link @@ -745,10 +887,10 @@ def __init__( class ExtensionVersionListVersionsItem(msrest.serialization.Model): """ExtensionVersionListVersionsItem. - :param release_train: The release train for this Extension Type. - :type release_train: str - :param versions: Versions available for this Extension Type and release train. - :type versions: list[str] + :ivar release_train: The release train for this Extension Type. + :vartype release_train: str + :ivar versions: Versions available for this Extension Type and release train. + :vartype versions: list[str] """ _attribute_map = { @@ -763,6 +905,12 @@ def __init__( versions: Optional[List[str]] = None, **kwargs ): + """ + :keyword release_train: The release train for this Extension Type. + :paramtype release_train: str + :keyword versions: Versions available for this Extension Type and release train. + :paramtype versions: list[str] + """ super(ExtensionVersionListVersionsItem, self).__init__(**kwargs) self.release_train = release_train self.versions = versions @@ -784,31 +932,32 @@ class FluxConfiguration(ProxyResource): :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :param scope: Scope at which the operator will be installed. Possible values include: - "cluster", "namespace". Default value: "cluster". - :type scope: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeType - :param namespace: The namespace to which this configuration is installed to. Maximum of 253 + :ivar scope: Scope at which the operator will be installed. Possible values include: "cluster", + "namespace". Default value: "cluster". + :vartype scope: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeType + :ivar namespace: The namespace to which this configuration is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type namespace: str - :param source_kind: Source Kind to pull the configuration data from. Possible values include: + :vartype namespace: str + :ivar source_kind: Source Kind to pull the configuration data from. Possible values include: "GitRepository", "Bucket". - :type source_kind: str or + :vartype source_kind: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its + :ivar suspend: Whether this configuration should suspend its reconciliation of its kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: + :vartype suspend: bool + :ivar git_repository: Parameters to reconcile to the GitRepository source kind type. + :vartype git_repository: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.GitRepositoryDefinition - :param bucket: Parameters to reconcile to the Bucket source kind type. - :type bucket: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + :ivar bucket: Parameters to reconcile to the Bucket source kind type. + :vartype bucket: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition + :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. - :type kustomizations: dict[str, + :vartype kustomizations: dict[str, ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.KustomizationDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] + :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for + the configuration. + :vartype configuration_protected_settings: dict[str, str] :ivar statuses: Statuses of the Flux Kubernetes resources created by the fluxConfiguration or created by the managed objects provisioned by the fluxConfiguration. :vartype statuses: @@ -884,6 +1033,35 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword scope: Scope at which the operator will be installed. Possible values include: + "cluster", "namespace". Default value: "cluster". + :paramtype scope: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeType + :keyword namespace: The namespace to which this configuration is installed to. Maximum of 253 + lower case alphanumeric characters, hyphen and period only. + :paramtype namespace: str + :keyword source_kind: Source Kind to pull the configuration data from. Possible values include: + "GitRepository", "Bucket". + :paramtype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceKindType + :keyword suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :paramtype suspend: bool + :keyword git_repository: Parameters to reconcile to the GitRepository source kind type. + :paramtype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.GitRepositoryDefinition + :keyword bucket: Parameters to reconcile to the Bucket source kind type. + :paramtype bucket: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition + :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :paramtype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.KustomizationDefinition] + :keyword configuration_protected_settings: Key-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + """ super(FluxConfiguration, self).__init__(**kwargs) self.system_data = None self.scope = scope @@ -906,25 +1084,26 @@ def __init__( class FluxConfigurationPatch(msrest.serialization.Model): """The Flux Configuration Patch Request object. - :param source_kind: Source Kind to pull the configuration data from. Possible values include: + :ivar source_kind: Source Kind to pull the configuration data from. Possible values include: "GitRepository", "Bucket". - :type source_kind: str or + :vartype source_kind: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceKindType - :param suspend: Whether this configuration should suspend its reconciliation of its + :ivar suspend: Whether this configuration should suspend its reconciliation of its kustomizations and sources. - :type suspend: bool - :param git_repository: Parameters to reconcile to the GitRepository source kind type. - :type git_repository: + :vartype suspend: bool + :ivar git_repository: Parameters to reconcile to the GitRepository source kind type. + :vartype git_repository: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.GitRepositoryPatchDefinition - :param bucket: Parameters to reconcile to the Bucket source kind type. - :type bucket: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition - :param kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + :ivar bucket: Parameters to reconcile to the Bucket source kind type. + :vartype bucket: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition + :ivar kustomizations: Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster. - :type kustomizations: dict[str, + :vartype kustomizations: dict[str, ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.KustomizationPatchDefinition] - :param configuration_protected_settings: Key-value pairs of protected configuration settings - for the configuration. - :type configuration_protected_settings: dict[str, str] + :ivar configuration_protected_settings: Key-value pairs of protected configuration settings for + the configuration. + :vartype configuration_protected_settings: dict[str, str] """ _attribute_map = { @@ -947,6 +1126,28 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword source_kind: Source Kind to pull the configuration data from. Possible values include: + "GitRepository", "Bucket". + :paramtype source_kind: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceKindType + :keyword suspend: Whether this configuration should suspend its reconciliation of its + kustomizations and sources. + :paramtype suspend: bool + :keyword git_repository: Parameters to reconcile to the GitRepository source kind type. + :paramtype git_repository: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.GitRepositoryPatchDefinition + :keyword bucket: Parameters to reconcile to the Bucket source kind type. + :paramtype bucket: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.BucketDefinition + :keyword kustomizations: Array of kustomizations used to reconcile the artifact pulled by the + source type on the cluster. + :paramtype kustomizations: dict[str, + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.KustomizationPatchDefinition] + :keyword configuration_protected_settings: Key-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + """ super(FluxConfigurationPatch, self).__init__(**kwargs) self.source_kind = source_kind self.suspend = suspend @@ -982,6 +1183,8 @@ def __init__( self, **kwargs ): + """ + """ super(FluxConfigurationsList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -990,28 +1193,28 @@ def __init__( class GitRepositoryDefinition(msrest.serialization.Model): """Parameters to reconcile to the GitRepository source kind type. - :param url: The URL to sync for the flux configuration git repository. - :type url: str - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + :ivar url: The URL to sync for the flux configuration git repository. + :vartype url: str + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git repository source with the remote. - :type sync_interval_in_seconds: long - :param repository_ref: The source reference for the GitRepository object. - :type repository_ref: + :vartype sync_interval_in_seconds: long + :ivar repository_ref: The source reference for the GitRepository object. + :vartype repository_ref: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.RepositoryRefDefinition - :param ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to + :ivar ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH. - :type ssh_known_hosts: str - :param https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. - :type https_user: str - :param https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + :vartype ssh_known_hosts: str + :ivar https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. + :vartype https_user: str + :ivar https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS. - :type https_ca_cert: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + :vartype https_ca_cert: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str + :vartype local_auth_ref: str """ _attribute_map = { @@ -1038,6 +1241,31 @@ def __init__( local_auth_ref: Optional[str] = None, **kwargs ): + """ + :keyword url: The URL to sync for the flux configuration git repository. + :paramtype url: str + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword repository_ref: The source reference for the GitRepository object. + :paramtype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.RepositoryRefDefinition + :keyword ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required + to access private git repositories over SSH. + :paramtype ssh_known_hosts: str + :keyword https_user: Plaintext HTTPS username used to access private git repositories over + HTTPS. + :paramtype https_user: str + :keyword https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :paramtype https_ca_cert: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ super(GitRepositoryDefinition, self).__init__(**kwargs) self.url = url self.timeout_in_seconds = timeout_in_seconds @@ -1052,28 +1280,28 @@ def __init__( class GitRepositoryPatchDefinition(msrest.serialization.Model): """Parameters to reconcile to the GitRepository source kind type. - :param url: The URL to sync for the flux configuration git repository. - :type url: str - :param timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository + :ivar url: The URL to sync for the flux configuration git repository. + :vartype url: str + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the cluster git repository source with the remote. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the cluster git repository source with the remote. - :type sync_interval_in_seconds: long - :param repository_ref: The source reference for the GitRepository object. - :type repository_ref: + :vartype sync_interval_in_seconds: long + :ivar repository_ref: The source reference for the GitRepository object. + :vartype repository_ref: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.RepositoryRefDefinition - :param ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to + :ivar ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH. - :type ssh_known_hosts: str - :param https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. - :type https_user: str - :param https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + :vartype ssh_known_hosts: str + :ivar https_user: Plaintext HTTPS username used to access private git repositories over HTTPS. + :vartype https_user: str + :ivar https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS. - :type https_ca_cert: str - :param local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + :vartype https_ca_cert: str + :ivar local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or user-provided configuration secrets. - :type local_auth_ref: str + :vartype local_auth_ref: str """ _attribute_map = { @@ -1100,6 +1328,31 @@ def __init__( local_auth_ref: Optional[str] = None, **kwargs ): + """ + :keyword url: The URL to sync for the flux configuration git repository. + :paramtype url: str + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the cluster git + repository source with the remote. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the cluster git + repository source with the remote. + :paramtype sync_interval_in_seconds: long + :keyword repository_ref: The source reference for the GitRepository object. + :paramtype repository_ref: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.RepositoryRefDefinition + :keyword ssh_known_hosts: Base64-encoded known_hosts value containing public SSH keys required + to access private git repositories over SSH. + :paramtype ssh_known_hosts: str + :keyword https_user: Plaintext HTTPS username used to access private git repositories over + HTTPS. + :paramtype https_user: str + :keyword https_ca_cert: Base64-encoded HTTPS certificate authority contents used to access git + private git repositories over HTTPS. + :paramtype https_ca_cert: str + :keyword local_auth_ref: Name of a local secret on the Kubernetes cluster to use as the + authentication secret rather than the managed or user-provided configuration secrets. + :paramtype local_auth_ref: str + """ super(GitRepositoryPatchDefinition, self).__init__(**kwargs) self.url = url self.timeout_in_seconds = timeout_in_seconds @@ -1114,10 +1367,10 @@ def __init__( class HelmOperatorProperties(msrest.serialization.Model): """Properties for Helm operator. - :param chart_version: Version of the operator Helm chart. - :type chart_version: str - :param chart_values: Values override for the operator Helm chart. - :type chart_values: str + :ivar chart_version: Version of the operator Helm chart. + :vartype chart_version: str + :ivar chart_values: Values override for the operator Helm chart. + :vartype chart_values: str """ _attribute_map = { @@ -1132,6 +1385,12 @@ def __init__( chart_values: Optional[str] = None, **kwargs ): + """ + :keyword chart_version: Version of the operator Helm chart. + :paramtype chart_version: str + :keyword chart_values: Values override for the operator Helm chart. + :paramtype chart_values: str + """ super(HelmOperatorProperties, self).__init__(**kwargs) self.chart_version = chart_version self.chart_values = chart_values @@ -1140,18 +1399,18 @@ def __init__( class HelmReleasePropertiesDefinition(msrest.serialization.Model): """HelmReleasePropertiesDefinition. - :param last_revision_applied: The revision number of the last released object change. - :type last_revision_applied: long - :param helm_chart_ref: The reference to the HelmChart object used as the source to this + :ivar last_revision_applied: The revision number of the last released object change. + :vartype last_revision_applied: long + :ivar helm_chart_ref: The reference to the HelmChart object used as the source to this HelmRelease. - :type helm_chart_ref: + :vartype helm_chart_ref: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectReferenceDefinition - :param failure_count: Total number of times that the HelmRelease failed to install or upgrade. - :type failure_count: long - :param install_failure_count: Number of times that the HelmRelease failed to install. - :type install_failure_count: long - :param upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. - :type upgrade_failure_count: long + :ivar failure_count: Total number of times that the HelmRelease failed to install or upgrade. + :vartype failure_count: long + :ivar install_failure_count: Number of times that the HelmRelease failed to install. + :vartype install_failure_count: long + :ivar upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. + :vartype upgrade_failure_count: long """ _attribute_map = { @@ -1172,6 +1431,21 @@ def __init__( upgrade_failure_count: Optional[int] = None, **kwargs ): + """ + :keyword last_revision_applied: The revision number of the last released object change. + :paramtype last_revision_applied: long + :keyword helm_chart_ref: The reference to the HelmChart object used as the source to this + HelmRelease. + :paramtype helm_chart_ref: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectReferenceDefinition + :keyword failure_count: Total number of times that the HelmRelease failed to install or + upgrade. + :paramtype failure_count: long + :keyword install_failure_count: Number of times that the HelmRelease failed to install. + :paramtype install_failure_count: long + :keyword upgrade_failure_count: Number of times that the HelmRelease failed to upgrade. + :paramtype upgrade_failure_count: long + """ super(HelmReleasePropertiesDefinition, self).__init__(**kwargs) self.last_revision_applied = last_revision_applied self.helm_chart_ref = helm_chart_ref @@ -1189,9 +1463,9 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -1211,6 +1485,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -1220,27 +1499,27 @@ def __init__( class KustomizationDefinition(msrest.serialization.Model): """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. - :param path: The path in the source reference to reconcile on the cluster. - :type path: str - :param depends_on: Specifies other Kustomizations that this Kustomization depends on. This + :ivar path: The path in the source reference to reconcile on the cluster. + :vartype path: str + :ivar depends_on: Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. - :type depends_on: + :vartype depends_on: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.DependsOnDefinition] - :param timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the cluster. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the cluster. - :type sync_interval_in_seconds: long - :param retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on - the cluster in the event of failure on reconciliation. - :type retry_interval_in_seconds: long - :param prune: Enable/disable garbage collections of Kubernetes objects created by this + :vartype sync_interval_in_seconds: long + :ivar retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster in the event of failure on reconciliation. + :vartype retry_interval_in_seconds: long + :ivar prune: Enable/disable garbage collections of Kubernetes objects created by this Kustomization. - :type prune: bool - :param force: Enable/disable re-creating Kubernetes resources on the cluster when patching - fails due to an immutable field change. - :type force: bool + :vartype prune: bool + :ivar force: Enable/disable re-creating Kubernetes resources on the cluster when patching fails + due to an immutable field change. + :vartype force: bool """ _attribute_map = { @@ -1265,6 +1544,29 @@ def __init__( force: Optional[bool] = False, **kwargs ): + """ + :keyword path: The path in the source reference to reconcile on the cluster. + :paramtype path: str + :keyword depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :paramtype depends_on: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.DependsOnDefinition] + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster. + :paramtype sync_interval_in_seconds: long + :keyword retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster in the event of failure on reconciliation. + :paramtype retry_interval_in_seconds: long + :keyword prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :paramtype prune: bool + :keyword force: Enable/disable re-creating Kubernetes resources on the cluster when patching + fails due to an immutable field change. + :paramtype force: bool + """ super(KustomizationDefinition, self).__init__(**kwargs) self.path = path self.depends_on = depends_on @@ -1278,27 +1580,27 @@ def __init__( class KustomizationPatchDefinition(msrest.serialization.Model): """The Kustomization defining how to reconcile the artifact pulled by the source type on the cluster. - :param path: The path in the source reference to reconcile on the cluster. - :type path: str - :param depends_on: Specifies other Kustomizations that this Kustomization depends on. This + :ivar path: The path in the source reference to reconcile on the cluster. + :vartype path: str + :ivar depends_on: Specifies other Kustomizations that this Kustomization depends on. This Kustomization will not reconcile until all dependencies have completed their reconciliation. - :type depends_on: + :vartype depends_on: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.DependsOnDefinition] - :param timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + :ivar timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the cluster. - :type timeout_in_seconds: long - :param sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + :vartype timeout_in_seconds: long + :ivar sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the cluster. - :type sync_interval_in_seconds: long - :param retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on - the cluster in the event of failure on reconciliation. - :type retry_interval_in_seconds: long - :param prune: Enable/disable garbage collections of Kubernetes objects created by this + :vartype sync_interval_in_seconds: long + :ivar retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on the + cluster in the event of failure on reconciliation. + :vartype retry_interval_in_seconds: long + :ivar prune: Enable/disable garbage collections of Kubernetes objects created by this Kustomization. - :type prune: bool - :param force: Enable/disable re-creating Kubernetes resources on the cluster when patching - fails due to an immutable field change. - :type force: bool + :vartype prune: bool + :ivar force: Enable/disable re-creating Kubernetes resources on the cluster when patching fails + due to an immutable field change. + :vartype force: bool """ _attribute_map = { @@ -1323,6 +1625,29 @@ def __init__( force: Optional[bool] = None, **kwargs ): + """ + :keyword path: The path in the source reference to reconcile on the cluster. + :paramtype path: str + :keyword depends_on: Specifies other Kustomizations that this Kustomization depends on. This + Kustomization will not reconcile until all dependencies have completed their reconciliation. + :paramtype depends_on: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.DependsOnDefinition] + :keyword timeout_in_seconds: The maximum time to attempt to reconcile the Kustomization on the + cluster. + :paramtype timeout_in_seconds: long + :keyword sync_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster. + :paramtype sync_interval_in_seconds: long + :keyword retry_interval_in_seconds: The interval at which to re-reconcile the Kustomization on + the cluster in the event of failure on reconciliation. + :paramtype retry_interval_in_seconds: long + :keyword prune: Enable/disable garbage collections of Kubernetes objects created by this + Kustomization. + :paramtype prune: bool + :keyword force: Enable/disable re-creating Kubernetes resources on the cluster when patching + fails due to an immutable field change. + :paramtype force: bool + """ super(KustomizationPatchDefinition, self).__init__(**kwargs) self.path = path self.depends_on = depends_on @@ -1336,10 +1661,10 @@ def __init__( class ObjectReferenceDefinition(msrest.serialization.Model): """Object reference to a Kubernetes object on a cluster. - :param name: Name of the object. - :type name: str - :param namespace: Namespace of the object. - :type namespace: str + :ivar name: Name of the object. + :vartype name: str + :ivar namespace: Namespace of the object. + :vartype namespace: str """ _attribute_map = { @@ -1354,6 +1679,12 @@ def __init__( namespace: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the object. + :paramtype name: str + :keyword namespace: Namespace of the object. + :paramtype namespace: str + """ super(ObjectReferenceDefinition, self).__init__(**kwargs) self.name = name self.namespace = namespace @@ -1362,16 +1693,16 @@ def __init__( class ObjectStatusConditionDefinition(msrest.serialization.Model): """Status condition of Kubernetes object. - :param last_transition_time: Last time this status condition has changed. - :type last_transition_time: ~datetime.datetime - :param message: A more verbose description of the object status condition. - :type message: str - :param reason: Reason for the specified status condition type status. - :type reason: str - :param status: Status of the Kubernetes object condition type. - :type status: str - :param type: Object status condition type for this object. - :type type: str + :ivar last_transition_time: Last time this status condition has changed. + :vartype last_transition_time: ~datetime.datetime + :ivar message: A more verbose description of the object status condition. + :vartype message: str + :ivar reason: Reason for the specified status condition type status. + :vartype reason: str + :ivar status: Status of the Kubernetes object condition type. + :vartype status: str + :ivar type: Object status condition type for this object. + :vartype type: str """ _attribute_map = { @@ -1392,6 +1723,18 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword last_transition_time: Last time this status condition has changed. + :paramtype last_transition_time: ~datetime.datetime + :keyword message: A more verbose description of the object status condition. + :paramtype message: str + :keyword reason: Reason for the specified status condition type status. + :paramtype reason: str + :keyword status: Status of the Kubernetes object condition type. + :paramtype status: str + :keyword type: Object status condition type for this object. + :paramtype type: str + """ super(ObjectStatusConditionDefinition, self).__init__(**kwargs) self.last_transition_time = last_transition_time self.message = message @@ -1403,26 +1746,26 @@ def __init__( class ObjectStatusDefinition(msrest.serialization.Model): """Statuses of objects deployed by the user-specified kustomizations from the git repository. - :param name: Name of the applied object. - :type name: str - :param namespace: Namespace of the applied object. - :type namespace: str - :param kind: Kind of the applied object. - :type kind: str - :param compliance_state: Compliance state of the applied object showing whether the applied + :ivar name: Name of the applied object. + :vartype name: str + :ivar namespace: Namespace of the applied object. + :vartype namespace: str + :ivar kind: Kind of the applied object. + :vartype kind: str + :ivar compliance_state: Compliance state of the applied object showing whether the applied object has come into a ready state on the cluster. Possible values include: "Compliant", "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". - :type compliance_state: str or + :vartype compliance_state: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxComplianceState - :param applied_by: Object reference to the Kustomization that applied this object. - :type applied_by: + :ivar applied_by: Object reference to the Kustomization that applied this object. + :vartype applied_by: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectReferenceDefinition - :param status_conditions: List of Kubernetes object status conditions present on the cluster. - :type status_conditions: + :ivar status_conditions: List of Kubernetes object status conditions present on the cluster. + :vartype status_conditions: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectStatusConditionDefinition] - :param helm_release_properties: Additional properties that are provided from objects of the + :ivar helm_release_properties: Additional properties that are provided from objects of the HelmRelease kind. - :type helm_release_properties: + :vartype helm_release_properties: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.HelmReleasePropertiesDefinition """ @@ -1448,6 +1791,29 @@ def __init__( helm_release_properties: Optional["HelmReleasePropertiesDefinition"] = None, **kwargs ): + """ + :keyword name: Name of the applied object. + :paramtype name: str + :keyword namespace: Namespace of the applied object. + :paramtype namespace: str + :keyword kind: Kind of the applied object. + :paramtype kind: str + :keyword compliance_state: Compliance state of the applied object showing whether the applied + object has come into a ready state on the cluster. Possible values include: "Compliant", + "Non-Compliant", "Pending", "Suspended", "Unknown". Default value: "Unknown". + :paramtype compliance_state: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxComplianceState + :keyword applied_by: Object reference to the Kustomization that applied this object. + :paramtype applied_by: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectReferenceDefinition + :keyword status_conditions: List of Kubernetes object status conditions present on the cluster. + :paramtype status_conditions: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ObjectStatusConditionDefinition] + :keyword helm_release_properties: Additional properties that are provided from objects of the + HelmRelease kind. + :paramtype helm_release_properties: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.HelmReleasePropertiesDefinition + """ super(ObjectStatusDefinition, self).__init__(**kwargs) self.name = name self.namespace = namespace @@ -1484,6 +1850,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationStatusList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1496,14 +1864,14 @@ class OperationStatusResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param id: Fully qualified ID for the async operation. - :type id: str - :param name: Name of the async operation. - :type name: str - :param status: Required. Operation status. - :type status: str - :param properties: Additional information, if available. - :type properties: dict[str, str] + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Required. Operation status. + :vartype status: str + :ivar properties: Additional information, if available. + :vartype properties: dict[str, str] :ivar error: If present, details of the operation error. :vartype error: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ErrorDetail """ @@ -1530,6 +1898,16 @@ def __init__( properties: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Required. Operation status. + :paramtype status: str + :keyword properties: Additional information, if available. + :paramtype properties: dict[str, str] + """ super(OperationStatusResult, self).__init__(**kwargs) self.id = id self.name = name @@ -1541,21 +1919,21 @@ def __init__( class PatchExtension(msrest.serialization.Model): """The Extension Patch Request object. - :param auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade + :ivar auto_upgrade_minor_version: Flag to note if this extension participates in auto upgrade of minor version, or not. - :type auto_upgrade_minor_version: bool - :param release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. - Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. - :type release_train: str - :param version: Version of the extension for this extension, if it is 'pinned' to a specific + :vartype auto_upgrade_minor_version: bool + :ivar release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. Stable, + Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :vartype release_train: str + :ivar version: Version of the extension for this extension, if it is 'pinned' to a specific version. autoUpgradeMinorVersion must be 'false'. - :type version: str - :param configuration_settings: Configuration settings, as name-value pairs for configuring this + :vartype version: str + :ivar configuration_settings: Configuration settings, as name-value pairs for configuring this extension. - :type configuration_settings: dict[str, str] - :param configuration_protected_settings: Configuration settings that are sensitive, as + :vartype configuration_settings: dict[str, str] + :ivar configuration_protected_settings: Configuration settings that are sensitive, as name-value pairs for configuring this extension. - :type configuration_protected_settings: dict[str, str] + :vartype configuration_protected_settings: dict[str, str] """ _attribute_map = { @@ -1576,6 +1954,23 @@ def __init__( configuration_protected_settings: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword auto_upgrade_minor_version: Flag to note if this extension participates in auto + upgrade of minor version, or not. + :paramtype auto_upgrade_minor_version: bool + :keyword release_train: ReleaseTrain this extension participates in for auto-upgrade (e.g. + Stable, Preview, etc.) - only if autoUpgradeMinorVersion is 'true'. + :paramtype release_train: str + :keyword version: Version of the extension for this extension, if it is 'pinned' to a specific + version. autoUpgradeMinorVersion must be 'false'. + :paramtype version: str + :keyword configuration_settings: Configuration settings, as name-value pairs for configuring + this extension. + :paramtype configuration_settings: dict[str, str] + :keyword configuration_protected_settings: Configuration settings that are sensitive, as + name-value pairs for configuring this extension. + :paramtype configuration_protected_settings: dict[str, str] + """ super(PatchExtension, self).__init__(**kwargs) self.auto_upgrade_minor_version = auto_upgrade_minor_version self.release_train = release_train @@ -1587,16 +1982,16 @@ def __init__( class RepositoryRefDefinition(msrest.serialization.Model): """The source reference for the GitRepository object. - :param branch: The git repository branch name to checkout. - :type branch: str - :param tag: The git repository tag name to checkout. This takes precedence over branch. - :type tag: str - :param semver: The semver range used to match against git repository tags. This takes - precedence over tag. - :type semver: str - :param commit: The commit SHA to checkout. This value must be combined with the branch name to + :ivar branch: The git repository branch name to checkout. + :vartype branch: str + :ivar tag: The git repository tag name to checkout. This takes precedence over branch. + :vartype tag: str + :ivar semver: The semver range used to match against git repository tags. This takes precedence + over tag. + :vartype semver: str + :ivar commit: The commit SHA to checkout. This value must be combined with the branch name to be valid. This takes precedence over semver. - :type commit: str + :vartype commit: str """ _attribute_map = { @@ -1615,6 +2010,18 @@ def __init__( commit: Optional[str] = None, **kwargs ): + """ + :keyword branch: The git repository branch name to checkout. + :paramtype branch: str + :keyword tag: The git repository tag name to checkout. This takes precedence over branch. + :paramtype tag: str + :keyword semver: The semver range used to match against git repository tags. This takes + precedence over tag. + :paramtype semver: str + :keyword commit: The commit SHA to checkout. This value must be combined with the branch name + to be valid. This takes precedence over semver. + :paramtype commit: str + """ super(RepositoryRefDefinition, self).__init__(**kwargs) self.branch = branch self.tag = tag @@ -1627,10 +2034,10 @@ class ResourceProviderOperation(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationDisplay :ivar is_data_action: The flag that indicates whether the operation applies to data plane. :vartype is_data_action: bool @@ -1657,6 +2064,13 @@ def __init__( display: Optional["ResourceProviderOperationDisplay"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationDisplay + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -1667,14 +2081,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft KubernetesConfiguration. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft KubernetesConfiguration. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -1693,6 +2107,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft KubernetesConfiguration. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1705,8 +2129,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperation] :ivar next_link: URL to the next set of results, if any. :vartype next_link: str @@ -1727,6 +2151,11 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: + list[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1735,10 +2164,11 @@ def __init__( class Scope(msrest.serialization.Model): """Scope of the extension. It can be either Cluster or Namespace; but not both. - :param cluster: Specifies that the scope of the extension is Cluster. - :type cluster: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeCluster - :param namespace: Specifies that the scope of the extension is Namespace. - :type namespace: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeNamespace + :ivar cluster: Specifies that the scope of the extension is Cluster. + :vartype cluster: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeCluster + :ivar namespace: Specifies that the scope of the extension is Namespace. + :vartype namespace: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeNamespace """ _attribute_map = { @@ -1753,6 +2183,13 @@ def __init__( namespace: Optional["ScopeNamespace"] = None, **kwargs ): + """ + :keyword cluster: Specifies that the scope of the extension is Cluster. + :paramtype cluster: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeCluster + :keyword namespace: Specifies that the scope of the extension is Namespace. + :paramtype namespace: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ScopeNamespace + """ super(Scope, self).__init__(**kwargs) self.cluster = cluster self.namespace = namespace @@ -1761,9 +2198,9 @@ def __init__( class ScopeCluster(msrest.serialization.Model): """Specifies that the scope of the extension is Cluster. - :param release_namespace: Namespace where the extension Release must be placed, for a Cluster + :ivar release_namespace: Namespace where the extension Release must be placed, for a Cluster scoped extension. If this namespace does not exist, it will be created. - :type release_namespace: str + :vartype release_namespace: str """ _attribute_map = { @@ -1776,6 +2213,11 @@ def __init__( release_namespace: Optional[str] = None, **kwargs ): + """ + :keyword release_namespace: Namespace where the extension Release must be placed, for a Cluster + scoped extension. If this namespace does not exist, it will be created. + :paramtype release_namespace: str + """ super(ScopeCluster, self).__init__(**kwargs) self.release_namespace = release_namespace @@ -1783,9 +2225,9 @@ def __init__( class ScopeNamespace(msrest.serialization.Model): """Specifies that the scope of the extension is Namespace. - :param target_namespace: Namespace where the extension will be created for an Namespace scoped + :ivar target_namespace: Namespace where the extension will be created for an Namespace scoped extension. If this namespace does not exist, it will be created. - :type target_namespace: str + :vartype target_namespace: str """ _attribute_map = { @@ -1798,6 +2240,11 @@ def __init__( target_namespace: Optional[str] = None, **kwargs ): + """ + :keyword target_namespace: Namespace where the extension will be created for an Namespace + scoped extension. If this namespace does not exist, it will be created. + :paramtype target_namespace: str + """ super(ScopeNamespace, self).__init__(**kwargs) self.target_namespace = target_namespace @@ -1818,36 +2265,36 @@ class SourceControlConfiguration(ProxyResource): :ivar system_data: Top level metadata https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/common-api-contracts.md#system-metadata-for-all-azure-resources. :vartype system_data: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SystemData - :param repository_url: Url of the SourceControl Repository. - :type repository_url: str - :param operator_namespace: The namespace to which this operator is installed to. Maximum of 253 + :ivar repository_url: Url of the SourceControl Repository. + :vartype repository_url: str + :ivar operator_namespace: The namespace to which this operator is installed to. Maximum of 253 lower case alphanumeric characters, hyphen and period only. - :type operator_namespace: str - :param operator_instance_name: Instance name of the operator - identifying the specific + :vartype operator_namespace: str + :ivar operator_instance_name: Instance name of the operator - identifying the specific configuration. - :type operator_instance_name: str - :param operator_type: Type of the operator. Possible values include: "Flux". - :type operator_type: str or + :vartype operator_instance_name: str + :ivar operator_type: Type of the operator. Possible values include: "Flux". + :vartype operator_type: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperatorType - :param operator_params: Any Parameters for the Operator instance in string format. - :type operator_params: str - :param configuration_protected_settings: Name-value pairs of protected configuration settings + :ivar operator_params: Any Parameters for the Operator instance in string format. + :vartype operator_params: str + :ivar configuration_protected_settings: Name-value pairs of protected configuration settings for the configuration. - :type configuration_protected_settings: dict[str, str] - :param operator_scope: Scope at which the operator will be installed. Possible values include: + :vartype configuration_protected_settings: dict[str, str] + :ivar operator_scope: Scope at which the operator will be installed. Possible values include: "cluster", "namespace". Default value: "cluster". - :type operator_scope: str or + :vartype operator_scope: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperatorScopeType :ivar repository_public_key: Public Key associated with this SourceControl configuration (either generated within the cluster or provided by the user). :vartype repository_public_key: str - :param ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys + :ivar ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH keys required to access private Git instances. - :type ssh_known_hosts_contents: str - :param enable_helm_operator: Option to enable Helm Operator for this git configuration. - :type enable_helm_operator: bool - :param helm_operator_properties: Properties for Helm operator. - :type helm_operator_properties: + :vartype ssh_known_hosts_contents: str + :ivar enable_helm_operator: Option to enable Helm Operator for this git configuration. + :vartype enable_helm_operator: bool + :ivar helm_operator_properties: Properties for Helm operator. + :vartype helm_operator_properties: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.HelmOperatorProperties :ivar provisioning_state: The provisioning state of the resource provider. Possible values include: "Accepted", "Deleting", "Running", "Succeeded", "Failed". @@ -1903,6 +2350,36 @@ def __init__( helm_operator_properties: Optional["HelmOperatorProperties"] = None, **kwargs ): + """ + :keyword repository_url: Url of the SourceControl Repository. + :paramtype repository_url: str + :keyword operator_namespace: The namespace to which this operator is installed to. Maximum of + 253 lower case alphanumeric characters, hyphen and period only. + :paramtype operator_namespace: str + :keyword operator_instance_name: Instance name of the operator - identifying the specific + configuration. + :paramtype operator_instance_name: str + :keyword operator_type: Type of the operator. Possible values include: "Flux". + :paramtype operator_type: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperatorType + :keyword operator_params: Any Parameters for the Operator instance in string format. + :paramtype operator_params: str + :keyword configuration_protected_settings: Name-value pairs of protected configuration settings + for the configuration. + :paramtype configuration_protected_settings: dict[str, str] + :keyword operator_scope: Scope at which the operator will be installed. Possible values + include: "cluster", "namespace". Default value: "cluster". + :paramtype operator_scope: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperatorScopeType + :keyword ssh_known_hosts_contents: Base64-encoded known_hosts contents containing public SSH + keys required to access private Git instances. + :paramtype ssh_known_hosts_contents: str + :keyword enable_helm_operator: Option to enable Helm Operator for this git configuration. + :paramtype enable_helm_operator: bool + :keyword helm_operator_properties: Properties for Helm operator. + :paramtype helm_operator_properties: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.HelmOperatorProperties + """ super(SourceControlConfiguration, self).__init__(**kwargs) self.system_data = None self.repository_url = repository_url @@ -1946,6 +2423,8 @@ def __init__( self, **kwargs ): + """ + """ super(SourceControlConfigurationList, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1954,10 +2433,10 @@ def __init__( class SupportedScopes(msrest.serialization.Model): """Extension scopes. - :param default_scope: Default extension scopes: cluster or namespace. - :type default_scope: str - :param cluster_scope_settings: Scope settings. - :type cluster_scope_settings: + :ivar default_scope: Default extension scopes: cluster or namespace. + :vartype default_scope: str + :ivar cluster_scope_settings: Scope settings. + :vartype cluster_scope_settings: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ClusterScopeSettings """ @@ -1973,6 +2452,13 @@ def __init__( cluster_scope_settings: Optional["ClusterScopeSettings"] = None, **kwargs ): + """ + :keyword default_scope: Default extension scopes: cluster or namespace. + :paramtype default_scope: str + :keyword cluster_scope_settings: Scope settings. + :paramtype cluster_scope_settings: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ClusterScopeSettings + """ super(SupportedScopes, self).__init__(**kwargs) self.default_scope = default_scope self.cluster_scope_settings = cluster_scope_settings @@ -1981,22 +2467,22 @@ 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 + :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.kubernetesconfiguration.v2022_01_01_preview.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_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 + :vartype last_modified_by_type: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -2019,6 +2505,24 @@ 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.kubernetesconfiguration.v2022_01_01_preview.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.kubernetesconfiguration.v2022_01_01_preview.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 diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_source_control_configuration_client_enums.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_source_control_configuration_client_enums.py index 1396bc813d40..ad643f563600 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_source_control_configuration_client_enums.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/models/_source_control_configuration_client_enums.py @@ -6,34 +6,19 @@ # 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 ClusterTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Cluster types """ CONNECTED_CLUSTERS = "connectedClusters" MANAGED_CLUSTERS = "managedClusters" -class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ComplianceStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compliance state of the configuration. """ @@ -43,7 +28,7 @@ class ComplianceStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): INSTALLED = "Installed" FAILED = "Failed" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -52,17 +37,17 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Enum0(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum0(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MICROSOFT_CONTAINER_SERVICE = "Microsoft.ContainerService" MICROSOFT_KUBERNETES = "Microsoft.Kubernetes" -class Enum1(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Enum1(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_CLUSTERS = "managedClusters" CONNECTED_CLUSTERS = "connectedClusters" -class FluxComplianceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FluxComplianceState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Compliance state of the cluster object. """ @@ -72,7 +57,7 @@ class FluxComplianceState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SUSPENDED = "Suspended" UNKNOWN = "Unknown" -class KustomizationValidationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class KustomizationValidationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specify whether to validate the Kubernetes objects referenced in the Kustomization before applying them to the cluster. """ @@ -81,7 +66,7 @@ class KustomizationValidationType(with_metaclass(_CaseInsensitiveEnumMeta, str, CLIENT = "client" SERVER = "server" -class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the status. """ @@ -89,7 +74,7 @@ class LevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MessageLevelType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Level of the message. """ @@ -97,20 +82,20 @@ class MessageLevelType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): WARNING = "Warning" INFORMATION = "Information" -class OperatorScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the operator will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class OperatorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OperatorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of the operator """ FLUX = "Flux" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource. """ @@ -121,7 +106,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): UPDATING = "Updating" DELETING = "Deleting" -class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningStateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the resource provider. """ @@ -131,14 +116,14 @@ class ProvisioningStateType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) SUCCEEDED = "Succeeded" FAILED = "Failed" -class ScopeType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScopeType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scope at which the configuration will be installed. """ CLUSTER = "cluster" NAMESPACE = "namespace" -class SourceKindType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SourceKindType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Source Kind to pull the configuration data from. """ diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_type_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_type_operations.py index 4392300f4a6c..debfdb4909b5 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_type_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_type_operations.py @@ -5,22 +5,65 @@ # 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, Union 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, 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionTypeName": _SERIALIZER.url("extension_type_name", extension_type_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 + ) class ClusterExtensionTypeOperations(object): """ClusterExtensionTypeOperations operations. @@ -44,16 +87,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExtensionType" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_type_name: str, + **kwargs: Any + ) -> "_models.ExtensionType": """Get Extension Type details. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,7 +106,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_type_name: Extension type name. @@ -78,36 +122,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_type_name=extension_type_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExtensionType', pipeline_response) @@ -116,4 +150,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes/{extensionTypeName}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_types_operations.py index 61a5f735fcca..851713541a93 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_types_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_cluster_extension_types_operations.py @@ -5,23 +5,64 @@ # 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.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, 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') +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, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensionTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class ClusterExtensionTypesOperations(object): """ClusterExtensionTypesOperations operations. @@ -45,15 +86,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionTypeList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeList"]: """Get Extension Types. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,12 +104,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -76,38 +119,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -120,12 +162,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extension_type_versions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extension_type_versions_operations.py index c4627a848b14..e377f2282604 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extension_type_versions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extension_type_versions_operations.py @@ -5,23 +5,60 @@ # 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') +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, + location: str, + extension_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes/{extensionTypeName}/versions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, 'str'), + "extensionTypeName": _SERIALIZER.url("extension_type_name", extension_type_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 + ) class ExtensionTypeVersionsOperations(object): """ExtensionTypeVersionsOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - extension_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionVersionList"] + location: str, + extension_type_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionVersionList"]: """List available versions for an Extension Type. :param location: extension location. @@ -59,8 +96,10 @@ def list( :param extension_type_name: Extension type name. :type extension_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExtensionVersionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionList] + :return: An iterator like instance of either ExtensionVersionList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionVersionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionVersionList"] @@ -68,36 +107,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'location': self._serialize.url("location", location, 'str'), - 'extensionTypeName': self._serialize.url("extension_type_name", extension_type_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_request( + subscription_id=self._config.subscription_id, + location=location, + extension_type_name=extension_type_name, + 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, + location=location, + extension_type_name=extension_type_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('ExtensionVersionList', pipeline_response) + deserialized = self._deserialize("ExtensionVersionList", pipeline_response) list_of_elem = deserialized.versions if cls: list_of_elem = cls(list_of_elem) @@ -110,12 +146,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extensions_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extensions_operations.py index 03f7f0ca45dd..a59c4ff2d48e 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extensions_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_extensions_operations.py @@ -5,25 +5,253 @@ # 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_create_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # 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 + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_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_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class ExtensionsOperations(object): """ExtensionsOperations operations. @@ -49,56 +277,44 @@ def __init__(self, client, config, serializer, deserializer): def _create_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(extension, 'Extension') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(extension, 'Extension') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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('Extension', pipeline_response) @@ -110,19 +326,21 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - extension, # type: "_models.Extension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + extension: "_models.Extension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Create a new Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -132,7 +350,8 @@ def begin_create( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -141,15 +360,19 @@ def begin_create( :type extension: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -164,30 +387,21 @@ def begin_create( cluster_name=cluster_name, extension_name=extension_name, extension=extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -199,18 +413,19 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + **kwargs: Any + ) -> "_models.Extension": """Gets Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -220,7 +435,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -235,36 +451,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -273,74 +479,64 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **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 = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + force_delete=force_delete, + 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.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """Delete a Kubernetes Cluster Extension. This will cause the Agent to Uninstall the extension from the cluster. @@ -351,7 +547,8 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -361,15 +558,17 @@ def begin_delete( :type force_delete: bool :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', @@ -387,24 +586,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -416,60 +605,49 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - patch_extension, # type: "_models.PatchExtension" - **kwargs # type: Any - ): - # type: (...) -> "_models.Extension" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> "_models.Extension": cls = kwargs.pop('cls', None) # type: ClsType["_models.Extension"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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(patch_extension, 'PatchExtension') - # 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_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.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(patch_extension, 'PatchExtension') - body_content_kwargs['content'] = body_content - request = self._client.patch(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 [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Extension', pipeline_response) @@ -477,19 +655,21 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - patch_extension, # type: "_models.PatchExtension" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Extension"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + patch_extension: "_models.PatchExtension", + **kwargs: Any + ) -> LROPoller["_models.Extension"]: """Patch an existing Kubernetes Cluster Extension. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -499,24 +679,30 @@ def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. :type extension_name: str :param patch_extension: Properties to Patch in an existing Extension. - :type patch_extension: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.PatchExtension + :type patch_extension: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.PatchExtension :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 Extension or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Extension] + :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.Extension"] lro_delay = kwargs.pop( 'polling_interval', @@ -531,30 +717,21 @@ def begin_update( cluster_name=cluster_name, extension_name=extension_name, patch_extension=patch_extension, + 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('Extension', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_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: @@ -566,17 +743,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionsList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionsList"]: """List all Extensions in the cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -586,12 +764,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionsList"] @@ -599,38 +779,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('ExtensionsList', pipeline_response) + deserialized = self._deserialize("ExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -643,12 +822,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_config_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_config_operation_status_operations.py index ccb630e51f8b..43272e116094 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_config_operation_status_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_config_operation_status_operations.py @@ -5,22 +5,67 @@ # 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, Union 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, 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') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_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 + ) class FluxConfigOperationStatusOperations(object): """FluxConfigOperationStatusOperations operations. @@ -44,17 +89,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResult" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": """Get Async Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -64,7 +109,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -81,37 +127,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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 = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + operation_id=operation_id, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -120,4 +156,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}/operations/{operationId}'} # type: ignore + diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_configurations_operations.py index a2129c8a8008..965f518b8af2 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_flux_configurations_operations.py @@ -5,25 +5,253 @@ # 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_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_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_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_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_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, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + *, + force_delete: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "fluxConfigurationName": _SERIALIZER.url("flux_configuration_name", flux_configuration_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') + if force_delete is not None: + query_parameters['forceDelete'] = _SERIALIZER.query("force_delete", force_delete, 'bool') + + # 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 + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class FluxConfigurationsOperations(object): """FluxConfigurationsOperations operations. @@ -47,16 +275,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.FluxConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + **kwargs: Any + ) -> "_models.FluxConfiguration": """Gets details of the Flux Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,7 +294,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -81,36 +310,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -119,60 +338,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration, # type: "_models.FluxConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.FluxConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration: "_models.FluxConfiguration", + **kwargs: Any + ) -> "_models.FluxConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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(flux_configuration, 'FluxConfiguration') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.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(flux_configuration, 'FluxConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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('FluxConfiguration', pipeline_response) @@ -184,19 +393,21 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration, # type: "_models.FluxConfiguration" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FluxConfiguration"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration: "_models.FluxConfiguration", + **kwargs: Any + ) -> LROPoller["_models.FluxConfiguration"]: """Create a new Kubernetes Flux Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -206,24 +417,31 @@ def begin_create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration: Properties necessary to Create a FluxConfiguration. - :type flux_configuration: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration + :type flux_configuration: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] + :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.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -238,30 +456,21 @@ def begin_create_or_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration=flux_configuration, + 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('FluxConfiguration', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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: @@ -273,60 +482,49 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration_patch, # type: "_models.FluxConfigurationPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.FluxConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: "_models.FluxConfigurationPatch", + **kwargs: Any + ) -> "_models.FluxConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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(flux_configuration_patch, 'FluxConfigurationPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.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(flux_configuration_patch, 'FluxConfigurationPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(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 [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('FluxConfiguration', pipeline_response) @@ -334,19 +532,21 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - flux_configuration_patch, # type: "_models.FluxConfigurationPatch" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.FluxConfiguration"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + flux_configuration_patch: "_models.FluxConfigurationPatch", + **kwargs: Any + ) -> LROPoller["_models.FluxConfiguration"]: """Update an existing Kubernetes Flux Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -356,24 +556,31 @@ def begin_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. :type flux_configuration_name: str :param flux_configuration_patch: Properties to Patch in an existing Flux Configuration. - :type flux_configuration_patch: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationPatch + :type flux_configuration_patch: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationPatch :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 FluxConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: + :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 FluxConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfiguration] + :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.FluxConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -388,30 +595,21 @@ def begin_update( cluster_name=cluster_name, flux_configuration_name=flux_configuration_name, flux_configuration_patch=flux_configuration_patch, + 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('FluxConfiguration', 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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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: @@ -423,74 +621,63 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **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 = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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') - if force_delete is not None: - query_parameters['forceDelete'] = self._serialize.query("force_delete", force_delete, 'bool') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + flux_configuration_name=flux_configuration_name, + force_delete=force_delete, + 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.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - flux_configuration_name, # type: str - force_delete=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + flux_configuration_name: str, + force_delete: Optional[bool] = None, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Flux Configuration, thus stopping future sync from the source repo. @@ -501,7 +688,8 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param flux_configuration_name: Name of the Flux Configuration. @@ -511,15 +699,17 @@ def begin_delete( :type force_delete: bool :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', @@ -537,24 +727,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'fluxConfigurationName': self._serialize.url("flux_configuration_name", flux_configuration_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: @@ -566,17 +746,18 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/fluxConfigurations/{fluxConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FluxConfigurationsList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.FluxConfigurationsList"]: """List all Flux Configurations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -586,12 +767,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either FluxConfigurationsList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationsList] + :return: An iterator like instance of either FluxConfigurationsList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.FluxConfigurationsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FluxConfigurationsList"] @@ -599,38 +783,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('FluxConfigurationsList', pipeline_response) + deserialized = self._deserialize("FluxConfigurationsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -643,12 +826,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_location_extension_types_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_location_extension_types_operations.py index 454b01b96556..42c18809e53c 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_location_extension_types_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_location_extension_types_operations.py @@ -5,23 +5,58 @@ # 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') +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, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.KubernetesConfiguration/locations/{location}/extensionTypes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "location": _SERIALIZER.url("location", location, '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 + ) class LocationExtensionTypesOperations(object): """LocationExtensionTypesOperations operations. @@ -45,19 +80,20 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExtensionTypeList"] + location: str, + **kwargs: Any + ) -> Iterable["_models.ExtensionTypeList"]: """List all Extension Types. :param location: extension location. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExtensionTypeList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ExtensionTypeList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExtensionTypeList"] @@ -65,35 +101,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'location': self._serialize.url("location", location, '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, + location=location, + 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, + location=location, + 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('ExtensionTypeList', pipeline_response) + deserialized = self._deserialize("ExtensionTypeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,12 +138,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operation_status_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operation_status_operations.py index 4f88c2781a98..2591f56c380f 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operation_status_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operation_status_operations.py @@ -5,23 +5,107 @@ # 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.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 +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "extensionName": _SERIALIZER.url("extension_name", extension_name, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_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_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/operations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class OperationStatusOperations(object): """OperationStatusOperations operations. @@ -45,17 +129,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - extension_name, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationStatusResult" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + extension_name: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationStatusResult": """Get Async Operation status. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -65,7 +149,8 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param extension_name: Name of the Extension. @@ -82,37 +167,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'extensionName': self._serialize.url("extension_name", extension_name, 'str'), - 'operationId': self._serialize.url("operation_id", operation_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') - # 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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + extension_name=extension_name, + operation_id=operation_id, + 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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('OperationStatusResult', pipeline_response) @@ -121,17 +196,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/extensions/{extensionName}/operations/{operationId}'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationStatusList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.OperationStatusList"]: """List Async Operations, currently in progress, in a cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,12 +218,14 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationStatusList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.OperationStatusList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationStatusList"] @@ -154,38 +233,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('OperationStatusList', pipeline_response) + deserialized = self._deserialize("OperationStatusList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -198,12 +276,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operations.py index a52ba75a3305..ba30bb536152 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/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 = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.KubernetesConfiguration/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 Operations(object): """Operations operations. @@ -45,16 +72,18 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all the available operations the KubernetesConfiguration resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] @@ -62,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_source_control_configurations_operations.py b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_source_control_configurations_operations.py index 44412282d5ad..05dc06f3a215 100644 --- a/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_source_control_configurations_operations.py +++ b/sdk/kubernetesconfiguration/azure-mgmt-kubernetesconfiguration/azure/mgmt/kubernetesconfiguration/v2022_01_01_preview/operations/_source_control_configurations_operations.py @@ -5,25 +5,199 @@ # 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "sourceControlConfigurationName": _SERIALIZER.url("source_control_configuration_name", source_control_configuration_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 + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "clusterRp": _SERIALIZER.url("cluster_rp", cluster_rp, 'str'), + "clusterResourceName": _SERIALIZER.url("cluster_resource_name", cluster_resource_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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 + ) class SourceControlConfigurationsOperations(object): """SourceControlConfigurationsOperations operations. @@ -47,16 +221,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Gets details of the Source Control Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -66,14 +240,16 @@ def get( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -81,36 +257,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('SourceControlConfiguration', pipeline_response) @@ -119,19 +285,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - source_control_configuration, # type: "_models.SourceControlConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.SourceControlConfiguration" + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + source_control_configuration: "_models.SourceControlConfiguration", + **kwargs: Any + ) -> "_models.SourceControlConfiguration": """Create a new Kubernetes Source Control Configuration. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -141,16 +309,19 @@ def create_or_update( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_name: str :param source_control_configuration: Properties necessary to Create KubernetesConfiguration. - :type source_control_configuration: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration + :type source_control_configuration: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration :keyword callable cls: A custom type or function that will be passed the direct response :return: SourceControlConfiguration, or the result of cls(response) - :rtype: ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration + :rtype: + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfiguration :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfiguration"] @@ -158,41 +329,31 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-01-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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(source_control_configuration, 'SourceControlConfiguration') - # 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_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_name, + content_type=content_type, + json=_json, + template_url=self.create_or_update.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(source_control_configuration, 'SourceControlConfiguration') - body_content_kwargs['content'] = body_content - request = self._client.put(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, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: @@ -205,70 +366,61 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_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 = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_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, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + source_control_configuration_name=source_control_configuration_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, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - source_control_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + source_control_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """This will delete the YAML file used to set up the Source control configuration, thus stopping future sync from the source repo. @@ -279,22 +431,25 @@ def begin_delete( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :param source_control_configuration_name: Name of the Source Control Configuration. :type source_control_configuration_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', @@ -311,24 +466,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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'sourceControlConfigurationName': self._serialize.url("source_control_configuration_name", source_control_configuration_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -340,17 +485,18 @@ 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/{clusterRp}/{clusterResourceName}/{clusterName}/providers/Microsoft.KubernetesConfiguration/sourceControlConfigurations/{sourceControlConfigurationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_rp, # type: Union[str, "_models.Enum0"] - cluster_resource_name, # type: Union[str, "_models.Enum1"] - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SourceControlConfigurationList"] + resource_group_name: str, + cluster_rp: Union[str, "_models.Enum0"], + cluster_resource_name: Union[str, "_models.Enum1"], + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlConfigurationList"]: """List all Source Control Configurations. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -360,12 +506,15 @@ def list( :type cluster_rp: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum0 :param cluster_resource_name: The Kubernetes cluster resource name - either managedClusters (for AKS clusters) or connectedClusters (for OnPrem K8S clusters). - :type cluster_resource_name: str or ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 + :type cluster_resource_name: str or + ~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.Enum1 :param cluster_name: The name of the kubernetes cluster. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SourceControlConfigurationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfigurationList] + :return: An iterator like instance of either SourceControlConfigurationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.kubernetesconfiguration.v2022_01_01_preview.models.SourceControlConfigurationList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlConfigurationList"] @@ -373,38 +522,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2022-01-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', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'clusterRp': self._serialize.url("cluster_rp", cluster_rp, 'str'), - 'clusterResourceName': self._serialize.url("cluster_resource_name", cluster_resource_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_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_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_name, + 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, + resource_group_name=resource_group_name, + cluster_rp=cluster_rp, + cluster_resource_name=cluster_resource_name, + cluster_name=cluster_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('SourceControlConfigurationList', pipeline_response) + deserialized = self._deserialize("SourceControlConfigurationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -417,12 +565,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.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data )