diff --git a/sdk/kusto/azure-mgmt-kusto/_meta.json b/sdk/kusto/azure-mgmt-kusto/_meta.json index 46b54243bec6..1f7c72d13984 100644 --- a/sdk/kusto/azure-mgmt-kusto/_meta.json +++ b/sdk/kusto/azure-mgmt-kusto/_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": "2ecc4a457776feff5cf647d28c045ea9acffadb3", + "commit": "9a1aa3dbd8555838ad20ce8815de4fde45220506", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/azure-kusto/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/azure-kusto/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/azure-kusto/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/__init__.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/__init__.py index ca1fc34a94da..37ab98770d3e 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/__init__.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['KustoManagementClient'] -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/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_configuration.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_configuration.py index 7847665b5e79..ddadd4220890 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_configuration.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_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 KustoManagementClientConfiguration(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(KustoManagementClientConfiguration, 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(KustoManagementClientConfiguration, 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/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py index b07bc3c9b506..6449e1d5f28b 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_kusto_management_client.py @@ -6,55 +6,48 @@ # 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 KustoManagementClientConfiguration +from .operations import AttachedDatabaseConfigurationsOperations, ClusterPrincipalAssignmentsOperations, ClustersOperations, DataConnectionsOperations, DatabasePrincipalAssignmentsOperations, DatabasesOperations, ManagedPrivateEndpointsOperations, Operations, OperationsResultsOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ScriptsOperations + 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 KustoManagementClientConfiguration -from .operations import ClustersOperations -from .operations import ClusterPrincipalAssignmentsOperations -from .operations import DatabasesOperations -from .operations import AttachedDatabaseConfigurationsOperations -from .operations import ManagedPrivateEndpointsOperations -from .operations import DatabasePrincipalAssignmentsOperations -from .operations import ScriptsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import DataConnectionsOperations -from .operations import Operations -from .operations import OperationsResultsOperations -from . import models - -class KustoManagementClient(object): +class KustoManagementClient: """The Azure Kusto management API provides a RESTful set of web services that interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and delete clusters and databases. :ivar clusters: ClustersOperations operations :vartype clusters: kusto_management_client.operations.ClustersOperations :ivar cluster_principal_assignments: ClusterPrincipalAssignmentsOperations operations - :vartype cluster_principal_assignments: kusto_management_client.operations.ClusterPrincipalAssignmentsOperations + :vartype cluster_principal_assignments: + kusto_management_client.operations.ClusterPrincipalAssignmentsOperations :ivar databases: DatabasesOperations operations :vartype databases: kusto_management_client.operations.DatabasesOperations :ivar attached_database_configurations: AttachedDatabaseConfigurationsOperations operations - :vartype attached_database_configurations: kusto_management_client.operations.AttachedDatabaseConfigurationsOperations + :vartype attached_database_configurations: + kusto_management_client.operations.AttachedDatabaseConfigurationsOperations :ivar managed_private_endpoints: ManagedPrivateEndpointsOperations operations - :vartype managed_private_endpoints: kusto_management_client.operations.ManagedPrivateEndpointsOperations + :vartype managed_private_endpoints: + kusto_management_client.operations.ManagedPrivateEndpointsOperations :ivar database_principal_assignments: DatabasePrincipalAssignmentsOperations operations - :vartype database_principal_assignments: kusto_management_client.operations.DatabasePrincipalAssignmentsOperations + :vartype database_principal_assignments: + kusto_management_client.operations.DatabasePrincipalAssignmentsOperations :ivar scripts: ScriptsOperations operations :vartype scripts: kusto_management_client.operations.ScriptsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: kusto_management_client.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + kusto_management_client.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: kusto_management_client.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + kusto_management_client.operations.PrivateLinkResourcesOperations :ivar data_connections: DataConnectionsOperations operations :vartype data_connections: kusto_management_client.operations.DataConnectionsOperations :ivar operations: Operations operations @@ -63,72 +56,68 @@ class KustoManagementClient(object): :vartype operations_results: kusto_management_client.operations.OperationsResultsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :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 = KustoManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = KustoManagementClientConfiguration(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.clusters = ClustersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_principal_assignments = ClusterPrincipalAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.databases = DatabasesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.attached_database_configurations = AttachedDatabaseConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.managed_private_endpoints = ManagedPrivateEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.database_principal_assignments = DatabasePrincipalAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.scripts = ScriptsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_connections = DataConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_results = OperationsResultsOperations( - 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.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_principal_assignments = ClusterPrincipalAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize) + self.attached_database_configurations = AttachedDatabaseConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_private_endpoints = ManagedPrivateEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.database_principal_assignments = DatabasePrincipalAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scripts = ScriptsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_connections = DataConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.operations_results = OperationsResultsOperations(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'), - } - 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/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_metadata.json b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_metadata.json index fa0144640826..265097797d46 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_metadata.json +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_metadata.json @@ -5,13 +5,13 @@ "name": "KustoManagementClient", "filename": "_kusto_management_client", "description": "The Azure Kusto management API provides a RESTful set of web services that interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and delete clusters and databases.", - "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\": [\"KustoManagementClientConfiguration\"]}}, \"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\": [\"KustoManagementClientConfiguration\"]}}, \"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\": [\"KustoManagementClientConfiguration\"]}}, \"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\": [\"KustoManagementClientConfiguration\"]}}, \"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": { "clusters": "ClustersOperations", diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_patch.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_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/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_vendor.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_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/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_version.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_version.py index 83f24ab50946..e32dc6ec4218 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_version.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.1.0" +VERSION = "2.0.0b1" diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/__init__.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/__init__.py index 1fd2725469e3..bc8f0ef99515 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/__init__.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/__init__.py @@ -8,3 +8,8 @@ from ._kusto_management_client import KustoManagementClient __all__ = ['KustoManagementClient'] + +# `._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/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_configuration.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_configuration.py index 0b0f62ab702c..6cb497bb8768 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_configuration.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/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(KustoManagementClientConfiguration, 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(KustoManagementClientConfiguration, 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/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_kusto_management_client.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_kusto_management_client.py index e3d5b476bc82..48b550391804 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_kusto_management_client.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_kusto_management_client.py @@ -6,53 +6,48 @@ # 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 KustoManagementClientConfiguration +from .operations import AttachedDatabaseConfigurationsOperations, ClusterPrincipalAssignmentsOperations, ClustersOperations, DataConnectionsOperations, DatabasePrincipalAssignmentsOperations, DatabasesOperations, ManagedPrivateEndpointsOperations, Operations, OperationsResultsOperations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ScriptsOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import KustoManagementClientConfiguration -from .operations import ClustersOperations -from .operations import ClusterPrincipalAssignmentsOperations -from .operations import DatabasesOperations -from .operations import AttachedDatabaseConfigurationsOperations -from .operations import ManagedPrivateEndpointsOperations -from .operations import DatabasePrincipalAssignmentsOperations -from .operations import ScriptsOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations -from .operations import DataConnectionsOperations -from .operations import Operations -from .operations import OperationsResultsOperations -from .. import models - - -class KustoManagementClient(object): +class KustoManagementClient: """The Azure Kusto management API provides a RESTful set of web services that interact with Azure Kusto services to manage your clusters and databases. The API enables you to create, update, and delete clusters and databases. :ivar clusters: ClustersOperations operations :vartype clusters: kusto_management_client.aio.operations.ClustersOperations :ivar cluster_principal_assignments: ClusterPrincipalAssignmentsOperations operations - :vartype cluster_principal_assignments: kusto_management_client.aio.operations.ClusterPrincipalAssignmentsOperations + :vartype cluster_principal_assignments: + kusto_management_client.aio.operations.ClusterPrincipalAssignmentsOperations :ivar databases: DatabasesOperations operations :vartype databases: kusto_management_client.aio.operations.DatabasesOperations :ivar attached_database_configurations: AttachedDatabaseConfigurationsOperations operations - :vartype attached_database_configurations: kusto_management_client.aio.operations.AttachedDatabaseConfigurationsOperations + :vartype attached_database_configurations: + kusto_management_client.aio.operations.AttachedDatabaseConfigurationsOperations :ivar managed_private_endpoints: ManagedPrivateEndpointsOperations operations - :vartype managed_private_endpoints: kusto_management_client.aio.operations.ManagedPrivateEndpointsOperations + :vartype managed_private_endpoints: + kusto_management_client.aio.operations.ManagedPrivateEndpointsOperations :ivar database_principal_assignments: DatabasePrincipalAssignmentsOperations operations - :vartype database_principal_assignments: kusto_management_client.aio.operations.DatabasePrincipalAssignmentsOperations + :vartype database_principal_assignments: + kusto_management_client.aio.operations.DatabasePrincipalAssignmentsOperations :ivar scripts: ScriptsOperations operations :vartype scripts: kusto_management_client.aio.operations.ScriptsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: kusto_management_client.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + kusto_management_client.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: kusto_management_client.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + kusto_management_client.aio.operations.PrivateLinkResourcesOperations :ivar data_connections: DataConnectionsOperations operations :vartype data_connections: kusto_management_client.aio.operations.DataConnectionsOperations :ivar operations: Operations operations @@ -61,70 +56,68 @@ class KustoManagementClient(object): :vartype operations_results: kusto_management_client.aio.operations.OperationsResultsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :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 = KustoManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = KustoManagementClientConfiguration(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.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_principal_assignments = ClusterPrincipalAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize) + self.attached_database_configurations = AttachedDatabaseConfigurationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_private_endpoints = ManagedPrivateEndpointsOperations(self._client, self._config, self._serialize, self._deserialize) + self.database_principal_assignments = DatabasePrincipalAssignmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.scripts = ScriptsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + self.data_connections = DataConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.operations_results = OperationsResultsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.clusters = ClustersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_principal_assignments = ClusterPrincipalAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.databases = DatabasesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.attached_database_configurations = AttachedDatabaseConfigurationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.managed_private_endpoints = ManagedPrivateEndpointsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.database_principal_assignments = DatabasePrincipalAssignmentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.scripts = ScriptsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_connections = DataConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.operations_results = OperationsResultsOperations( - 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/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_patch.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/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/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_attached_database_configurations_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_attached_database_configurations_operations.py index deb83ca3a5a8..8482b3470c7d 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_attached_database_configurations_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_attached_database_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._attached_database_configurations_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_cluster_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 check_name_availability( self, resource_group_name: str, @@ -58,7 +64,8 @@ async def check_name_availability( :param cluster_name: The name of the Kusto cluster. :type cluster_name: str :param resource_name: The name of the resource. - :type resource_name: ~kusto_management_client.models.AttachedDatabaseConfigurationsCheckNameRequest + :type resource_name: + ~kusto_management_client.models.AttachedDatabaseConfigurationsCheckNameRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameResult, or the result of cls(response) :rtype: ~kusto_management_client.models.CheckNameResult @@ -69,32 +76,22 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(resource_name, 'AttachedDatabaseConfigurationsCheckNameRequest') + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(resource_name, 'AttachedDatabaseConfigurationsCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -108,8 +105,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurationCheckNameAvailability'} # type: ignore + + @distributed_trace def list_by_cluster( self, resource_group_name: str, @@ -123,8 +123,10 @@ def list_by_cluster( :param cluster_name: The name of the Kusto 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 AttachedDatabaseConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.AttachedDatabaseConfigurationListResult] + :return: An iterator like instance of either AttachedDatabaseConfigurationListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.AttachedDatabaseConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfigurationListResult"] @@ -132,36 +134,33 @@ def list_by_cluster( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('AttachedDatabaseConfigurationListResult', pipeline_response) + deserialized = self._deserialize("AttachedDatabaseConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -179,11 +178,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -209,28 +210,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + attached_database_configuration_name=attached_database_configuration_name, + subscription_id=self._config.subscription_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 @@ -244,8 +235,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -259,33 +252,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'AttachedDatabaseConfiguration') - # 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( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + attached_database_configuration_name=attached_database_configuration_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'AttachedDatabaseConfiguration') - 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 @@ -306,8 +289,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/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -328,15 +314,20 @@ async def begin_create_or_update( :type parameters: ~kusto_management_client.models.AttachedDatabaseConfiguration :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 AttachedDatabaseConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.AttachedDatabaseConfiguration] - :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 AttachedDatabaseConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.AttachedDatabaseConfiguration] + :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.AttachedDatabaseConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -349,28 +340,21 @@ async def begin_create_or_update( cluster_name=cluster_name, attached_database_configuration_name=attached_database_configuration_name, parameters=parameters, + 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('AttachedDatabaseConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -382,6 +366,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/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore async def _delete_initial( @@ -396,28 +381,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + attached_database_configuration_name=attached_database_configuration_name, + subscription_id=self._config.subscription_id, + 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 @@ -430,6 +405,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -447,15 +424,17 @@ async def begin_delete( :type attached_database_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', @@ -470,22 +449,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -497,4 +468,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_cluster_principal_assignments_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_cluster_principal_assignments_operations.py index dd726ae83ff8..4683a7b46c99 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_cluster_principal_assignments_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_cluster_principal_assignments_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._cluster_principal_assignments_operations import build_check_name_availability_request, build_create_or_update_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]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, resource_group_name: str, @@ -57,7 +63,8 @@ async def check_name_availability( :param cluster_name: The name of the Kusto cluster. :type cluster_name: str :param principal_assignment_name: The name of the principal assignment. - :type principal_assignment_name: ~kusto_management_client.models.ClusterPrincipalAssignmentCheckNameRequest + :type principal_assignment_name: + ~kusto_management_client.models.ClusterPrincipalAssignmentCheckNameRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameResult, or the result of cls(response) :rtype: ~kusto_management_client.models.CheckNameResult @@ -68,32 +75,22 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(principal_assignment_name, 'ClusterPrincipalAssignmentCheckNameRequest') + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(principal_assignment_name, 'ClusterPrincipalAssignmentCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,8 +104,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkPrincipalAssignmentNameAvailability'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -134,28 +134,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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_name=cluster_name, + principal_assignment_name=principal_assignment_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 @@ -169,8 +159,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -184,33 +176,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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(parameters, 'ClusterPrincipalAssignment') - # 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_name=cluster_name, + principal_assignment_name=principal_assignment_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(parameters, 'ClusterPrincipalAssignment') - 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 @@ -228,8 +210,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/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -251,15 +236,20 @@ async def begin_create_or_update( :type parameters: ~kusto_management_client.models.ClusterPrincipalAssignment :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 ClusterPrincipalAssignment or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.ClusterPrincipalAssignment] - :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 ClusterPrincipalAssignment or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.ClusterPrincipalAssignment] + :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.ClusterPrincipalAssignment"] lro_delay = kwargs.pop( 'polling_interval', @@ -272,28 +262,21 @@ async def begin_create_or_update( cluster_name=cluster_name, principal_assignment_name=principal_assignment_name, parameters=parameters, + 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('ClusterPrincipalAssignment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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: @@ -305,6 +288,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/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} # type: ignore async def _delete_initial( @@ -319,28 +303,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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_name=cluster_name, + principal_assignment_name=principal_assignment_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 @@ -353,6 +327,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -370,15 +346,17 @@ async def begin_delete( :type principal_assignment_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', @@ -393,22 +371,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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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: @@ -420,8 +390,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/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -435,8 +407,10 @@ def list( :param cluster_name: The name of the Kusto 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 ClusterPrincipalAssignmentListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.ClusterPrincipalAssignmentListResult] + :return: An iterator like instance of either ClusterPrincipalAssignmentListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.ClusterPrincipalAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignmentListResult"] @@ -444,36 +418,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - '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_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_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('ClusterPrincipalAssignmentListResult', pipeline_response) + deserialized = self._deserialize("ClusterPrincipalAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -491,6 +462,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_clusters_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_clusters_operations.py index afdd060afdd2..00489bfb531b 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_clusters_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_clusters_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._clusters_operations import build_add_language_extensions_request_initial, build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_detach_follower_databases_request_initial, build_diagnose_virtual_network_request_initial, build_get_request, build_list_by_resource_group_request, build_list_follower_databases_request, build_list_language_extensions_request, build_list_outbound_network_dependencies_endpoints_request, build_list_request, build_list_skus_by_resource_request, build_list_skus_request, build_remove_language_extensions_request_initial, build_start_request_initial, build_stop_request_initial, 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, @@ -65,27 +71,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_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 @@ -99,8 +95,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -115,36 +113,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Cluster') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Cluster') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + if_none_match=if_none_match, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +148,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/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -190,15 +179,19 @@ async def begin_create_or_update( :type if_none_match: 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. - :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', @@ -212,27 +205,21 @@ async def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + 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('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -244,6 +231,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/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore async def _update_initial( @@ -259,34 +247,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ClusterUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -307,8 +284,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -331,15 +311,19 @@ async def begin_update( :type if_match: 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. - :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', @@ -352,27 +336,21 @@ async def begin_update( cluster_name=cluster_name, parameters=parameters, if_match=if_match, + 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('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -384,6 +362,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/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore async def _delete_initial( @@ -397,27 +376,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + 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 @@ -430,6 +399,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -444,15 +415,17 @@ async def begin_delete( :type cluster_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', @@ -466,21 +439,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -492,6 +458,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/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore async def _stop_initial( @@ -505,27 +472,17 @@ async def _stop_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -538,6 +495,8 @@ async def _stop_initial( _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop'} # type: ignore + + @distributed_trace_async async def begin_stop( self, resource_group_name: str, @@ -552,15 +511,17 @@ async def begin_stop( :type cluster_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', @@ -574,21 +535,14 @@ async def begin_stop( 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -600,6 +554,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop'} # type: ignore async def _start_initial( @@ -613,27 +568,17 @@ async def _start_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -646,6 +591,8 @@ async def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start'} # type: ignore + + @distributed_trace_async async def begin_start( self, resource_group_name: str, @@ -660,15 +607,17 @@ async def begin_start( :type cluster_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', @@ -682,21 +631,14 @@ async def begin_start( 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -708,8 +650,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start'} # type: ignore + @distributed_trace def list_follower_databases( self, resource_group_name: str, @@ -724,8 +668,10 @@ def list_follower_databases( :param cluster_name: The name of the Kusto 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 FollowerDatabaseListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.FollowerDatabaseListResult] + :return: An iterator like instance of either FollowerDatabaseListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.FollowerDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FollowerDatabaseListResult"] @@ -733,36 +679,33 @@ def list_follower_databases( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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_follower_databases.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_follower_databases_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self.list_follower_databases.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_follower_databases_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('FollowerDatabaseListResult', pipeline_response) + deserialized = self._deserialize("FollowerDatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -780,6 +723,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -797,32 +741,22 @@ async def _detach_follower_databases_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._detach_follower_databases_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(follower_database_to_remove, 'FollowerDatabaseDefinition') + + request = build_detach_follower_databases_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._detach_follower_databases_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(follower_database_to_remove, 'FollowerDatabaseDefinition') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -835,6 +769,8 @@ async def _detach_follower_databases_initial( _detach_follower_databases_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases'} # type: ignore + + @distributed_trace_async async def begin_detach_follower_databases( self, resource_group_name: str, @@ -852,15 +788,18 @@ async def begin_detach_follower_databases( :type follower_database_to_remove: ~kusto_management_client.models.FollowerDatabaseDefinition :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] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -872,24 +811,18 @@ async def begin_detach_follower_databases( resource_group_name=resource_group_name, cluster_name=cluster_name, follower_database_to_remove=follower_database_to_remove, + 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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -901,6 +834,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_detach_follower_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases'} # type: ignore async def _diagnose_virtual_network_initial( @@ -914,27 +848,17 @@ async def _diagnose_virtual_network_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self._diagnose_virtual_network_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_diagnose_virtual_network_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self._diagnose_virtual_network_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -950,8 +874,11 @@ async def _diagnose_virtual_network_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _diagnose_virtual_network_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/diagnoseVirtualNetwork'} # type: ignore + + @distributed_trace_async async def begin_diagnose_virtual_network( self, resource_group_name: str, @@ -967,15 +894,19 @@ async def begin_diagnose_virtual_network( :type cluster_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. - :return: An instance of AsyncLROPoller that returns either DiagnoseVirtualNetworkResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.DiagnoseVirtualNetworkResult] - :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 DiagnoseVirtualNetworkResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.DiagnoseVirtualNetworkResult] + :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["_models.DiagnoseVirtualNetworkResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -989,24 +920,17 @@ async def begin_diagnose_virtual_network( 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('DiagnoseVirtualNetworkResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1018,8 +942,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_diagnose_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/diagnoseVirtualNetwork'} # type: ignore + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -1031,7 +957,8 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ClusterListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.ClusterListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.ClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] @@ -1039,35 +966,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterListResult', pipeline_response) + deserialized = self._deserialize("ClusterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1085,11 +1008,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters'} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -1098,7 +1023,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ClusterListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.ClusterListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.ClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] @@ -1106,34 +1032,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterListResult', pipeline_response) + deserialized = self._deserialize("ClusterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1151,11 +1072,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters'} # type: ignore + @distributed_trace def list_skus( self, **kwargs: Any @@ -1164,7 +1087,8 @@ def list_skus( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SkuDescriptionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.SkuDescriptionList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.SkuDescriptionList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SkuDescriptionList"] @@ -1172,34 +1096,29 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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_skus.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + subscription_id=self._config.subscription_id, + template_url=self.list_skus.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_skus_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SkuDescriptionList', pipeline_response) + deserialized = self._deserialize("SkuDescriptionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1217,11 +1136,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus'} # type: ignore + @distributed_trace_async async def check_name_availability( self, location: str, @@ -1244,31 +1165,21 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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') + 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(cluster_name, 'ClusterCheckNameRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(cluster_name, 'ClusterCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1282,8 +1193,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_skus_by_resource( self, resource_group_name: str, @@ -1297,8 +1211,10 @@ def list_skus_by_resource( :param cluster_name: The name of the Kusto 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 ListResourceSkusResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.ListResourceSkusResult] + :return: An iterator like instance of either ListResourceSkusResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.ListResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ListResourceSkusResult"] @@ -1306,36 +1222,33 @@ def list_skus_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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_skus_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_by_resource_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus_by_resource.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_skus_by_resource_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ListResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ListResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1353,11 +1266,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_skus_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/skus'} # type: ignore + @distributed_trace def list_outbound_network_dependencies_endpoints( self, resource_group_name: str, @@ -1371,8 +1286,10 @@ def list_outbound_network_dependencies_endpoints( :param cluster_name: The name of the Kusto 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 OutboundNetworkDependenciesEndpointListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.OutboundNetworkDependenciesEndpointListResult] + :return: An iterator like instance of either OutboundNetworkDependenciesEndpointListResult or + the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.OutboundNetworkDependenciesEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundNetworkDependenciesEndpointListResult"] @@ -1380,36 +1297,33 @@ def list_outbound_network_dependencies_endpoints( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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_outbound_network_dependencies_endpoints.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'), - '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_outbound_network_dependencies_endpoints_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.list_outbound_network_dependencies_endpoints.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_outbound_network_dependencies_endpoints_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('OutboundNetworkDependenciesEndpointListResult', pipeline_response) + deserialized = self._deserialize("OutboundNetworkDependenciesEndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1427,11 +1341,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/outboundNetworkDependenciesEndpoints'} # type: ignore + @distributed_trace def list_language_extensions( self, resource_group_name: str, @@ -1445,8 +1361,10 @@ def list_language_extensions( :param cluster_name: The name of the Kusto 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 LanguageExtensionsList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.LanguageExtensionsList] + :return: An iterator like instance of either LanguageExtensionsList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.LanguageExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.LanguageExtensionsList"] @@ -1454,36 +1372,33 @@ def list_language_extensions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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_language_extensions.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'), - '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.post(url, query_parameters, header_parameters) + + request = build_list_language_extensions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.list_language_extensions.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_language_extensions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('LanguageExtensionsList', pipeline_response) + deserialized = self._deserialize("LanguageExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1501,6 +1416,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -1518,32 +1434,22 @@ async def _add_language_extensions_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._add_language_extensions_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'), - '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') + 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(language_extensions_to_add, 'LanguageExtensionsList') + + request = build_add_language_extensions_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self._add_language_extensions_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(language_extensions_to_add, 'LanguageExtensionsList') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1556,6 +1462,8 @@ async def _add_language_extensions_initial( _add_language_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions'} # type: ignore + + @distributed_trace_async async def begin_add_language_extensions( self, resource_group_name: str, @@ -1573,15 +1481,18 @@ async def begin_add_language_extensions( :type language_extensions_to_add: ~kusto_management_client.models.LanguageExtensionsList :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] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1593,24 +1504,18 @@ async def begin_add_language_extensions( resource_group_name=resource_group_name, cluster_name=cluster_name, language_extensions_to_add=language_extensions_to_add, + 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): 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_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: @@ -1622,6 +1527,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_add_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions'} # type: ignore async def _remove_language_extensions_initial( @@ -1636,32 +1542,22 @@ async def _remove_language_extensions_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._remove_language_extensions_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'), - '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') + 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(language_extensions_to_remove, 'LanguageExtensionsList') + + request = build_remove_language_extensions_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self._remove_language_extensions_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(language_extensions_to_remove, 'LanguageExtensionsList') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1674,6 +1570,8 @@ async def _remove_language_extensions_initial( _remove_language_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions'} # type: ignore + + @distributed_trace_async async def begin_remove_language_extensions( self, resource_group_name: str, @@ -1691,15 +1589,18 @@ async def begin_remove_language_extensions( :type language_extensions_to_remove: ~kusto_management_client.models.LanguageExtensionsList :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] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1711,24 +1612,18 @@ async def begin_remove_language_extensions( resource_group_name=resource_group_name, cluster_name=cluster_name, language_extensions_to_remove=language_extensions_to_remove, + 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): 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_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: @@ -1740,4 +1635,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_remove_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions'} # type: ignore diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_data_connections_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_data_connections_operations.py index 42b6f67a9987..5659de52b2c5 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_data_connections_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_data_connections_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._data_connections_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_data_connection_validation_request_initial, build_delete_request_initial, build_get_request, build_list_by_database_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 def list_by_database( self, resource_group_name: str, @@ -59,8 +65,10 @@ def list_by_database( :param database_name: The name of the database in the Kusto cluster. :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.DataConnectionListResult] + :return: An iterator like instance of either DataConnectionListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.DataConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnectionListResult"] @@ -68,37 +76,35 @@ def list_by_database( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_database.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_database_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_database.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_database_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DataConnectionListResult', pipeline_response) + deserialized = self._deserialize("DataConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,6 +122,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) @@ -134,33 +141,23 @@ async def _data_connection_validation_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._data_connection_validation_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataConnectionValidation') - # 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_data_connection_validation_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._data_connection_validation_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(parameters, 'DataConnectionValidation') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -176,8 +173,11 @@ async def _data_connection_validation_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _data_connection_validation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnectionValidation'} # type: ignore + + @distributed_trace_async async def begin_data_connection_validation( self, resource_group_name: str, @@ -198,15 +198,20 @@ async def begin_data_connection_validation( :type parameters: ~kusto_management_client.models.DataConnectionValidation :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 DataConnectionValidationListResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.DataConnectionValidationListResult] - :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 DataConnectionValidationListResult + or the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.DataConnectionValidationListResult] + :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.DataConnectionValidationListResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -219,28 +224,21 @@ async def begin_data_connection_validation( cluster_name=cluster_name, database_name=database_name, parameters=parameters, + 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('DataConnectionValidationListResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -252,8 +250,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_data_connection_validation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnectionValidation'} # type: ignore + @distributed_trace_async async def check_name_availability( self, resource_group_name: str, @@ -282,33 +282,23 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_connection_name, 'DataConnectionCheckNameRequest') + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(data_connection_name, 'DataConnectionCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -322,8 +312,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkNameAvailability'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -352,29 +345,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + subscription_id=self._config.subscription_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 @@ -388,8 +371,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -404,34 +389,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'DataConnection') - # 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( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'DataConnection') - 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 @@ -452,8 +427,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -477,15 +455,19 @@ async def begin_create_or_update( :type parameters: ~kusto_management_client.models.DataConnection :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 DataConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataConnection or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.DataConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -499,29 +481,21 @@ async def begin_create_or_update( database_name=database_name, data_connection_name=data_connection_name, parameters=parameters, + 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('DataConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -533,6 +507,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore async def _update_initial( @@ -549,34 +524,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataConnection') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'DataConnection') - 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 @@ -597,8 +562,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -622,15 +590,19 @@ async def begin_update( :type parameters: ~kusto_management_client.models.DataConnection :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 DataConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either DataConnection or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.DataConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -644,29 +616,21 @@ async def begin_update( database_name=database_name, data_connection_name=data_connection_name, parameters=parameters, + 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('DataConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -678,6 +642,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore async def _delete_initial( @@ -693,29 +658,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + subscription_id=self._config.subscription_id, + 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 @@ -728,6 +683,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -748,15 +705,17 @@ async def begin_delete( :type data_connection_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', @@ -772,23 +731,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -800,4 +750,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_database_principal_assignments_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_database_principal_assignments_operations.py index dcd76bdcdf9f..094d8831fdcc 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_database_principal_assignments_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_database_principal_assignments_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._database_principal_assignments_operations import build_check_name_availability_request, build_create_or_update_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]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, resource_group_name: str, @@ -60,7 +66,8 @@ async def check_name_availability( :param database_name: The name of the database in the Kusto cluster. :type database_name: str :param principal_assignment_name: The name of the resource. - :type principal_assignment_name: ~kusto_management_client.models.DatabasePrincipalAssignmentCheckNameRequest + :type principal_assignment_name: + ~kusto_management_client.models.DatabasePrincipalAssignmentCheckNameRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameResult, or the result of cls(response) :rtype: ~kusto_management_client.models.CheckNameResult @@ -71,33 +78,23 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(principal_assignment_name, 'DatabasePrincipalAssignmentCheckNameRequest') + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(principal_assignment_name, 'DatabasePrincipalAssignmentCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -111,8 +108,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkPrincipalAssignmentNameAvailability'} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -141,29 +141,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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_name=cluster_name, + database_name=database_name, + principal_assignment_name=principal_assignment_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 @@ -177,8 +167,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -193,34 +185,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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(parameters, 'DatabasePrincipalAssignment') - # 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_name=cluster_name, + database_name=database_name, + principal_assignment_name=principal_assignment_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(parameters, 'DatabasePrincipalAssignment') - 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 @@ -238,8 +220,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -263,15 +248,20 @@ async def begin_create_or_update( :type parameters: ~kusto_management_client.models.DatabasePrincipalAssignment :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 DatabasePrincipalAssignment or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.DatabasePrincipalAssignment] - :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 DatabasePrincipalAssignment or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.DatabasePrincipalAssignment] + :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.DatabasePrincipalAssignment"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,29 +275,21 @@ async def begin_create_or_update( database_name=database_name, principal_assignment_name=principal_assignment_name, parameters=parameters, + 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('DatabasePrincipalAssignment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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: @@ -319,6 +301,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore async def _delete_initial( @@ -334,29 +317,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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_name=cluster_name, + database_name=database_name, + principal_assignment_name=principal_assignment_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 @@ -369,6 +342,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -389,15 +364,17 @@ async def begin_delete( :type principal_assignment_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', @@ -413,23 +390,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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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: @@ -441,8 +409,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -459,8 +429,10 @@ def list( :param database_name: The name of the database in the Kusto cluster. :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatabasePrincipalAssignmentListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.DatabasePrincipalAssignmentListResult] + :return: An iterator like instance of either DatabasePrincipalAssignmentListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.DatabasePrincipalAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignmentListResult"] @@ -468,37 +440,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_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_name=cluster_name, + database_name=database_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_name=cluster_name, + database_name=database_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('DatabasePrincipalAssignmentListResult', pipeline_response) + deserialized = self._deserialize("DatabasePrincipalAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -516,6 +486,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_databases_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_databases_operations.py index 315f03c8ba03..e8ef5493b2e0 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_databases_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_databases_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._databases_operations import build_add_principals_request, build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_cluster_request, build_list_principals_request, build_remove_principals_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 check_name_availability( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(resource_name, 'CheckNameRequest') + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(resource_name, 'CheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,8 +103,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_by_cluster( self, resource_group_name: str, @@ -123,7 +122,8 @@ def list_by_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 DatabaseListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.DatabaseListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.DatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabaseListResult"] @@ -131,36 +131,33 @@ def list_by_cluster( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DatabaseListResult', pipeline_response) + deserialized = self._deserialize("DatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -178,11 +175,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -208,28 +207,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_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 @@ -243,8 +232,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -258,33 +249,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Database') - # 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( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'Database') - 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 @@ -305,8 +286,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -327,15 +311,19 @@ async def begin_create_or_update( :type parameters: ~kusto_management_client.models.Database :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 Database or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Database or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.Database] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,28 +336,21 @@ async def begin_create_or_update( cluster_name=cluster_name, database_name=database_name, parameters=parameters, + 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('Database', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -381,6 +362,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore async def _update_initial( @@ -396,33 +378,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Database') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'Database') - 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 @@ -443,8 +415,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -465,15 +440,19 @@ async def begin_update( :type parameters: ~kusto_management_client.models.Database :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 Database or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Database or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.Database] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] lro_delay = kwargs.pop( 'polling_interval', @@ -486,28 +465,21 @@ async def begin_update( cluster_name=cluster_name, database_name=database_name, parameters=parameters, + 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('Database', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -519,6 +491,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore async def _delete_initial( @@ -533,28 +506,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + 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 @@ -567,6 +530,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -584,15 +549,17 @@ async def begin_delete( :type database_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', @@ -607,22 +574,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -634,8 +593,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore + @distributed_trace def list_principals( self, resource_group_name: str, @@ -652,8 +613,10 @@ def list_principals( :param database_name: The name of the database in the Kusto cluster. :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatabasePrincipalListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.DatabasePrincipalListResult] + :return: An iterator like instance of either DatabasePrincipalListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.DatabasePrincipalListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalListResult"] @@ -661,37 +624,35 @@ def list_principals( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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_principals.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_principals_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + template_url=self.list_principals.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_principals_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('DatabasePrincipalListResult', pipeline_response) + deserialized = self._deserialize("DatabasePrincipalListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -709,11 +670,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_principals.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/listPrincipals'} # type: ignore + @distributed_trace_async async def add_principals( self, resource_group_name: str, @@ -742,33 +705,23 @@ async def add_principals( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.add_principals.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(database_principals_to_add, 'DatabasePrincipalListRequest') - # 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_add_principals_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.add_principals.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(database_principals_to_add, 'DatabasePrincipalListRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -782,8 +735,11 @@ async def add_principals( return cls(pipeline_response, deserialized, {}) return deserialized + add_principals.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/addPrincipals'} # type: ignore + + @distributed_trace_async async def remove_principals( self, resource_group_name: str, @@ -801,7 +757,8 @@ async def remove_principals( :param database_name: The name of the database in the Kusto cluster. :type database_name: str :param database_principals_to_remove: List of database principals to remove. - :type database_principals_to_remove: ~kusto_management_client.models.DatabasePrincipalListRequest + :type database_principals_to_remove: + ~kusto_management_client.models.DatabasePrincipalListRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: DatabasePrincipalListResult, or the result of cls(response) :rtype: ~kusto_management_client.models.DatabasePrincipalListResult @@ -812,33 +769,23 @@ async def remove_principals( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.remove_principals.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(database_principals_to_remove, 'DatabasePrincipalListRequest') + + request = build_remove_principals_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.remove_principals.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(database_principals_to_remove, 'DatabasePrincipalListRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -852,4 +799,6 @@ async def remove_principals( return cls(pipeline_response, deserialized, {}) return deserialized + remove_principals.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/removePrincipals'} # type: ignore + diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_managed_private_endpoints_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_managed_private_endpoints_operations.py index 84ad68bde57f..fb7cbf0161d4 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_managed_private_endpoints_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_managed_private_endpoints_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._managed_private_endpoints_operations import build_check_name_availability_request, 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 check_name_availability( self, resource_group_name: str, @@ -68,32 +74,22 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource_name, 'ManagedPrivateEndpointsCheckNameRequest') - # 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_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(resource_name, 'ManagedPrivateEndpointsCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -107,8 +103,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpointsCheckNameAvailability'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -122,8 +121,10 @@ def list( :param cluster_name: The name of the Kusto 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 ManagedPrivateEndpointListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.ManagedPrivateEndpointListResult] + :return: An iterator like instance of either ManagedPrivateEndpointListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.ManagedPrivateEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedPrivateEndpointListResult"] @@ -131,36 +132,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - '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_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_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('ManagedPrivateEndpointListResult', pipeline_response) + deserialized = self._deserialize("ManagedPrivateEndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -178,11 +176,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -208,28 +208,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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_name=cluster_name, + managed_private_endpoint_name=managed_private_endpoint_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 @@ -243,8 +233,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -258,33 +250,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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(parameters, 'ManagedPrivateEndpoint') - # 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_name=cluster_name, + managed_private_endpoint_name=managed_private_endpoint_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(parameters, 'ManagedPrivateEndpoint') - 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 @@ -305,8 +287,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/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -327,15 +312,20 @@ async def begin_create_or_update( :type parameters: ~kusto_management_client.models.ManagedPrivateEndpoint :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 ManagedPrivateEndpoint or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.ManagedPrivateEndpoint] - :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 ManagedPrivateEndpoint or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.ManagedPrivateEndpoint] + :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.ManagedPrivateEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,28 +338,21 @@ async def begin_create_or_update( cluster_name=cluster_name, managed_private_endpoint_name=managed_private_endpoint_name, parameters=parameters, + 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('ManagedPrivateEndpoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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: @@ -381,6 +364,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/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore async def _update_initial( @@ -396,33 +380,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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(parameters, 'ManagedPrivateEndpoint') - # 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_name=cluster_name, + managed_private_endpoint_name=managed_private_endpoint_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(parameters, 'ManagedPrivateEndpoint') - 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 @@ -440,8 +414,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -462,15 +439,20 @@ async def begin_update( :type parameters: ~kusto_management_client.models.ManagedPrivateEndpoint :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 ManagedPrivateEndpoint or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.ManagedPrivateEndpoint] - :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 ManagedPrivateEndpoint or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.ManagedPrivateEndpoint] + :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.ManagedPrivateEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -483,28 +465,21 @@ async def begin_update( cluster_name=cluster_name, managed_private_endpoint_name=managed_private_endpoint_name, parameters=parameters, + 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('ManagedPrivateEndpoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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: @@ -516,6 +491,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/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore async def _delete_initial( @@ -530,28 +506,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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_name=cluster_name, + managed_private_endpoint_name=managed_private_endpoint_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 @@ -564,6 +530,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -581,15 +549,17 @@ async def begin_delete( :type managed_private_endpoint_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', @@ -604,22 +574,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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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: @@ -631,4 +593,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations.py index 116094d03eef..86419f8297e4 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/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,7 +55,8 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -57,30 +64,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -98,6 +102,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations_results_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations_results_operations.py index f95d8f67be3a..2cce2826cfcb 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations_results_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_operations_results_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations_results_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, location: str, @@ -62,27 +67,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'location': self._serialize.url("location", location, '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, + location=location, + 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 @@ -96,4 +91,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/operationresults/{operationId}'} # type: ignore + diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_endpoint_connections_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_endpoint_connections_operations.py index f3cefd84d633..6ca8901bdc6a 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_endpoint_connections_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._private_endpoint_connections_operations import build_create_or_update_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]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -56,8 +62,10 @@ def list( :param cluster_name: The name of the Kusto 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 PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -65,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - '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_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_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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -142,28 +149,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_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 @@ -177,8 +174,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -192,33 +191,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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(parameters, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_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(parameters, 'PrivateEndpointConnection') - 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 @@ -236,8 +225,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/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -258,15 +250,20 @@ async def begin_create_or_update( :type parameters: ~kusto_management_client.models.PrivateEndpointConnection :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 PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.PrivateEndpointConnection] - :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 PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.PrivateEndpointConnection] + :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.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -279,28 +276,21 @@ async def begin_create_or_update( cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, + 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('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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: @@ -312,6 +302,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/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore async def _delete_initial( @@ -326,28 +317,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_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 @@ -360,6 +341,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -377,15 +360,17 @@ async def begin_delete( :type private_endpoint_connection_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', @@ -400,22 +385,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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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: @@ -427,4 +404,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_link_resources_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_link_resources_operations.py index 16a457b35319..297124acdbde 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_link_resources_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_private_link_resources_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._private_link_resources_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, @@ -54,8 +60,10 @@ def list( :param cluster_name: The name of the Kusto 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 PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -63,36 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - '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_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_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('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -110,11 +115,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -140,28 +147,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_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_name=cluster_name, + private_link_resource_name=private_link_resource_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 @@ -175,4 +172,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_scripts_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_scripts_operations.py index 90ee17ab72b8..910e0afb9b9c 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_scripts_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/aio/operations/_scripts_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._scripts_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_database_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 def list_by_database( self, resource_group_name: str, @@ -60,7 +66,8 @@ def list_by_database( :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScriptListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.ScriptListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~kusto_management_client.models.ScriptListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScriptListResult"] @@ -68,37 +75,35 @@ def list_by_database( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_database.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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_database_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + template_url=self.list_by_database.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_database_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_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('ScriptListResult', pipeline_response) + deserialized = self._deserialize("ScriptListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -116,11 +121,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -149,29 +156,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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_name=cluster_name, + database_name=database_name, + script_name=script_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 @@ -185,8 +182,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -201,34 +200,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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(parameters, 'Script') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + script_name=script_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(parameters, 'Script') - 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 @@ -249,8 +238,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -274,15 +266,19 @@ async def begin_create_or_update( :type parameters: ~kusto_management_client.models.Script :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 Script or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Script or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.Script] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Script"] lro_delay = kwargs.pop( 'polling_interval', @@ -296,29 +292,21 @@ async def begin_create_or_update( database_name=database_name, script_name=script_name, parameters=parameters, + 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('Script', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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: @@ -330,6 +318,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore async def _update_initial( @@ -346,34 +335,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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(parameters, 'Script') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + script_name=script_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(parameters, 'Script') - 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 @@ -391,8 +370,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -416,15 +398,19 @@ async def begin_update( :type parameters: ~kusto_management_client.models.Script :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 Script or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Script or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.Script] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Script"] lro_delay = kwargs.pop( 'polling_interval', @@ -438,29 +424,21 @@ async def begin_update( database_name=database_name, script_name=script_name, parameters=parameters, + 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('Script', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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: @@ -472,6 +450,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore async def _delete_initial( @@ -487,29 +466,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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_name=cluster_name, + database_name=database_name, + script_name=script_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 @@ -522,6 +491,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -542,15 +513,17 @@ async def begin_delete( :type script_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', @@ -566,23 +539,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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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: @@ -594,8 +558,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore + @distributed_trace_async async def check_name_availability( self, resource_group_name: str, @@ -624,33 +590,23 @@ async def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(script_name, 'ScriptCheckNameRequest') - # 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_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(script_name, 'ScriptCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -664,4 +620,6 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scriptsCheckNameAvailability'} # type: ignore + diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/__init__.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/__init__.py index 25effe035c5b..3a4b01a60a4c 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/__init__.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/__init__.py @@ -6,162 +6,84 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AcceptedAudiences - from ._models_py3 import AttachedDatabaseConfiguration - from ._models_py3 import AttachedDatabaseConfigurationListResult - from ._models_py3 import AttachedDatabaseConfigurationsCheckNameRequest - from ._models_py3 import AzureCapacity - from ._models_py3 import AzureResourceSku - from ._models_py3 import AzureSku - from ._models_py3 import CheckNameRequest - from ._models_py3 import CheckNameResult - from ._models_py3 import CloudErrorBody - from ._models_py3 import Cluster - from ._models_py3 import ClusterCheckNameRequest - from ._models_py3 import ClusterListResult - from ._models_py3 import ClusterPrincipalAssignment - from ._models_py3 import ClusterPrincipalAssignmentCheckNameRequest - from ._models_py3 import ClusterPrincipalAssignmentListResult - from ._models_py3 import ClusterUpdate - from ._models_py3 import ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties - from ._models_py3 import DataConnection - from ._models_py3 import DataConnectionCheckNameRequest - from ._models_py3 import DataConnectionListResult - from ._models_py3 import DataConnectionValidation - from ._models_py3 import DataConnectionValidationListResult - from ._models_py3 import DataConnectionValidationResult - from ._models_py3 import Database - from ._models_py3 import DatabaseListResult - from ._models_py3 import DatabasePrincipal - from ._models_py3 import DatabasePrincipalAssignment - from ._models_py3 import DatabasePrincipalAssignmentCheckNameRequest - from ._models_py3 import DatabasePrincipalAssignmentListResult - from ._models_py3 import DatabasePrincipalListRequest - from ._models_py3 import DatabasePrincipalListResult - from ._models_py3 import DatabaseStatistics - from ._models_py3 import DiagnoseVirtualNetworkResult - from ._models_py3 import EndpointDependency - from ._models_py3 import EndpointDetail - from ._models_py3 import EventGridDataConnection - from ._models_py3 import EventHubDataConnection - from ._models_py3 import FollowerDatabaseDefinition - from ._models_py3 import FollowerDatabaseListResult - from ._models_py3 import Identity - from ._models_py3 import IotHubDataConnection - from ._models_py3 import KeyVaultProperties - from ._models_py3 import LanguageExtension - from ._models_py3 import LanguageExtensionsList - from ._models_py3 import ListResourceSkusResult - from ._models_py3 import ManagedPrivateEndpoint - from ._models_py3 import ManagedPrivateEndpointListResult - from ._models_py3 import ManagedPrivateEndpointsCheckNameRequest - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import OperationResult - from ._models_py3 import OptimizedAutoscale - from ._models_py3 import OutboundNetworkDependenciesEndpoint - from ._models_py3 import OutboundNetworkDependenciesEndpointListResult - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResult - from ._models_py3 import PrivateEndpointProperty - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionStateProperty - from ._models_py3 import ProxyResource - from ._models_py3 import ReadOnlyFollowingDatabase - from ._models_py3 import ReadWriteDatabase - from ._models_py3 import Resource - from ._models_py3 import Script - from ._models_py3 import ScriptCheckNameRequest - from ._models_py3 import ScriptListResult - from ._models_py3 import SkuDescription - from ._models_py3 import SkuDescriptionList - from ._models_py3 import SkuLocationInfoItem - from ._models_py3 import SystemData - from ._models_py3 import TableLevelSharingProperties - from ._models_py3 import TrackedResource - from ._models_py3 import TrustedExternalTenant - from ._models_py3 import VirtualNetworkConfiguration -except (SyntaxError, ImportError): - from ._models import AcceptedAudiences # type: ignore - from ._models import AttachedDatabaseConfiguration # type: ignore - from ._models import AttachedDatabaseConfigurationListResult # type: ignore - from ._models import AttachedDatabaseConfigurationsCheckNameRequest # type: ignore - from ._models import AzureCapacity # type: ignore - from ._models import AzureResourceSku # type: ignore - from ._models import AzureSku # type: ignore - from ._models import CheckNameRequest # type: ignore - from ._models import CheckNameResult # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import Cluster # type: ignore - from ._models import ClusterCheckNameRequest # type: ignore - from ._models import ClusterListResult # type: ignore - from ._models import ClusterPrincipalAssignment # type: ignore - from ._models import ClusterPrincipalAssignmentCheckNameRequest # type: ignore - from ._models import ClusterPrincipalAssignmentListResult # type: ignore - from ._models import ClusterUpdate # type: ignore - from ._models import ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties # type: ignore - from ._models import DataConnection # type: ignore - from ._models import DataConnectionCheckNameRequest # type: ignore - from ._models import DataConnectionListResult # type: ignore - from ._models import DataConnectionValidation # type: ignore - from ._models import DataConnectionValidationListResult # type: ignore - from ._models import DataConnectionValidationResult # type: ignore - from ._models import Database # type: ignore - from ._models import DatabaseListResult # type: ignore - from ._models import DatabasePrincipal # type: ignore - from ._models import DatabasePrincipalAssignment # type: ignore - from ._models import DatabasePrincipalAssignmentCheckNameRequest # type: ignore - from ._models import DatabasePrincipalAssignmentListResult # type: ignore - from ._models import DatabasePrincipalListRequest # type: ignore - from ._models import DatabasePrincipalListResult # type: ignore - from ._models import DatabaseStatistics # type: ignore - from ._models import DiagnoseVirtualNetworkResult # type: ignore - from ._models import EndpointDependency # type: ignore - from ._models import EndpointDetail # type: ignore - from ._models import EventGridDataConnection # type: ignore - from ._models import EventHubDataConnection # type: ignore - from ._models import FollowerDatabaseDefinition # type: ignore - from ._models import FollowerDatabaseListResult # type: ignore - from ._models import Identity # type: ignore - from ._models import IotHubDataConnection # type: ignore - from ._models import KeyVaultProperties # type: ignore - from ._models import LanguageExtension # type: ignore - from ._models import LanguageExtensionsList # type: ignore - from ._models import ListResourceSkusResult # type: ignore - from ._models import ManagedPrivateEndpoint # type: ignore - from ._models import ManagedPrivateEndpointListResult # type: ignore - from ._models import ManagedPrivateEndpointsCheckNameRequest # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationResult # type: ignore - from ._models import OptimizedAutoscale # type: ignore - from ._models import OutboundNetworkDependenciesEndpoint # type: ignore - from ._models import OutboundNetworkDependenciesEndpointListResult # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResult # type: ignore - from ._models import PrivateEndpointProperty # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionStateProperty # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import ReadOnlyFollowingDatabase # type: ignore - from ._models import ReadWriteDatabase # type: ignore - from ._models import Resource # type: ignore - from ._models import Script # type: ignore - from ._models import ScriptCheckNameRequest # type: ignore - from ._models import ScriptListResult # type: ignore - from ._models import SkuDescription # type: ignore - from ._models import SkuDescriptionList # type: ignore - from ._models import SkuLocationInfoItem # type: ignore - from ._models import SystemData # type: ignore - from ._models import TableLevelSharingProperties # type: ignore - from ._models import TrackedResource # type: ignore - from ._models import TrustedExternalTenant # type: ignore - from ._models import VirtualNetworkConfiguration # type: ignore +from ._models_py3 import AcceptedAudiences +from ._models_py3 import AttachedDatabaseConfiguration +from ._models_py3 import AttachedDatabaseConfigurationListResult +from ._models_py3 import AttachedDatabaseConfigurationsCheckNameRequest +from ._models_py3 import AzureCapacity +from ._models_py3 import AzureResourceSku +from ._models_py3 import AzureSku +from ._models_py3 import CheckNameRequest +from ._models_py3 import CheckNameResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import Cluster +from ._models_py3 import ClusterCheckNameRequest +from ._models_py3 import ClusterListResult +from ._models_py3 import ClusterPrincipalAssignment +from ._models_py3 import ClusterPrincipalAssignmentCheckNameRequest +from ._models_py3 import ClusterPrincipalAssignmentListResult +from ._models_py3 import ClusterUpdate +from ._models_py3 import ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties +from ._models_py3 import DataConnection +from ._models_py3 import DataConnectionCheckNameRequest +from ._models_py3 import DataConnectionListResult +from ._models_py3 import DataConnectionValidation +from ._models_py3 import DataConnectionValidationListResult +from ._models_py3 import DataConnectionValidationResult +from ._models_py3 import Database +from ._models_py3 import DatabaseListResult +from ._models_py3 import DatabasePrincipal +from ._models_py3 import DatabasePrincipalAssignment +from ._models_py3 import DatabasePrincipalAssignmentCheckNameRequest +from ._models_py3 import DatabasePrincipalAssignmentListResult +from ._models_py3 import DatabasePrincipalListRequest +from ._models_py3 import DatabasePrincipalListResult +from ._models_py3 import DatabaseStatistics +from ._models_py3 import DiagnoseVirtualNetworkResult +from ._models_py3 import EndpointDependency +from ._models_py3 import EndpointDetail +from ._models_py3 import EventGridDataConnection +from ._models_py3 import EventHubDataConnection +from ._models_py3 import FollowerDatabaseDefinition +from ._models_py3 import FollowerDatabaseListResult +from ._models_py3 import Identity +from ._models_py3 import IotHubDataConnection +from ._models_py3 import KeyVaultProperties +from ._models_py3 import LanguageExtension +from ._models_py3 import LanguageExtensionsList +from ._models_py3 import ListResourceSkusResult +from ._models_py3 import ManagedPrivateEndpoint +from ._models_py3 import ManagedPrivateEndpointListResult +from ._models_py3 import ManagedPrivateEndpointsCheckNameRequest +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import OperationResult +from ._models_py3 import OptimizedAutoscale +from ._models_py3 import OutboundNetworkDependenciesEndpoint +from ._models_py3 import OutboundNetworkDependenciesEndpointListResult +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateEndpointProperty +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionStateProperty +from ._models_py3 import ProxyResource +from ._models_py3 import ReadOnlyFollowingDatabase +from ._models_py3 import ReadWriteDatabase +from ._models_py3 import Resource +from ._models_py3 import Script +from ._models_py3 import ScriptCheckNameRequest +from ._models_py3 import ScriptListResult +from ._models_py3 import SkuDescription +from ._models_py3 import SkuDescriptionList +from ._models_py3 import SkuLocationInfoItem +from ._models_py3 import SystemData +from ._models_py3 import TableLevelSharingProperties +from ._models_py3 import TrackedResource +from ._models_py3 import TrustedExternalTenant +from ._models_py3 import VirtualNetworkConfiguration + from ._kusto_management_client_enums import ( AzureScaleType, diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_kusto_management_client_enums.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_kusto_management_client_enums.py index de61d1c1ca50..20e97c069ba9 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_kusto_management_client_enums.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_kusto_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AzureScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Scale type. """ @@ -34,7 +19,7 @@ class AzureScaleType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANUAL = "manual" NONE = "none" -class AzureSkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU name. """ @@ -64,21 +49,21 @@ class AzureSkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD_E16_AS_V4_4_TB_PS = "Standard_E16as_v4+4TB_PS" DEV_NO_SLA_STANDARD_E2_A_V4 = "Dev(No SLA)_Standard_E2a_v4" -class AzureSkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AzureSkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """SKU tier. """ BASIC = "Basic" STANDARD = "Standard" -class BlobStorageEventType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BlobStorageEventType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The name of blob storage event type to process. """ MICROSOFT_STORAGE_BLOB_CREATED = "Microsoft.Storage.BlobCreated" MICROSOFT_STORAGE_BLOB_RENAMED = "Microsoft.Storage.BlobRenamed" -class ClusterNetworkAccessFlag(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterNetworkAccessFlag(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Whether or not to restrict outbound network access. Value is optional but if passed in, must be 'Enabled' or 'Disabled' """ @@ -86,21 +71,21 @@ class ClusterNetworkAccessFlag(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu ENABLED = "Enabled" DISABLED = "Disabled" -class ClusterPrincipalRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterPrincipalRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Cluster principal role. """ ALL_DATABASES_ADMIN = "AllDatabasesAdmin" ALL_DATABASES_VIEWER = "AllDatabasesViewer" -class Compression(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Compression(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compression type """ NONE = "None" G_ZIP = "GZip" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -109,7 +94,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class DatabasePrincipalRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DatabasePrincipalRole(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Database principal role. """ @@ -120,7 +105,7 @@ class DatabasePrincipalRole(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) UNRESTRICTED_VIEWER = "UnrestrictedViewer" VIEWER = "Viewer" -class DatabasePrincipalType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DatabasePrincipalType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Database principal type. """ @@ -128,7 +113,7 @@ class DatabasePrincipalType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) GROUP = "Group" USER = "User" -class DataConnectionKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DataConnectionKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Kind of the endpoint for the data connection """ @@ -136,7 +121,7 @@ class DataConnectionKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): EVENT_GRID = "EventGrid" IOT_HUB = "IotHub" -class DefaultPrincipalsModificationKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DefaultPrincipalsModificationKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The default principals modification kind """ @@ -144,14 +129,14 @@ class DefaultPrincipalsModificationKind(with_metaclass(_CaseInsensitiveEnumMeta, REPLACE = "Replace" NONE = "None" -class EngineType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EngineType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The engine type """ V2 = "V2" V3 = "V3" -class EventGridDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EventGridDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The data format of the message. Optionally the data format can be added to each message. """ @@ -172,7 +157,7 @@ class EventGridDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): APACHEAVRO = "APACHEAVRO" W3_CLOGFILE = "W3CLOGFILE" -class EventHubDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EventHubDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The data format of the message. Optionally the data format can be added to each message. """ @@ -193,7 +178,7 @@ class EventHubDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): APACHEAVRO = "APACHEAVRO" W3_CLOGFILE = "W3CLOGFILE" -class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove all identities. @@ -204,7 +189,7 @@ class IdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): USER_ASSIGNED = "UserAssigned" SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" -class IotHubDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IotHubDataFormat(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The data format of the message. Optionally the data format can be added to each message. """ @@ -225,21 +210,21 @@ class IotHubDataFormat(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): APACHEAVRO = "APACHEAVRO" W3_CLOGFILE = "W3CLOGFILE" -class Kind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Kind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Kind of the database """ READ_WRITE = "ReadWrite" READ_ONLY_FOLLOWING = "ReadOnlyFollowing" -class LanguageExtensionName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LanguageExtensionName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Language extension that can run within KQL query. """ PYTHON = "PYTHON" R = "R" -class PrincipalsModificationKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrincipalsModificationKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The principals modification kind of the database """ @@ -247,7 +232,7 @@ class PrincipalsModificationKind(with_metaclass(_CaseInsensitiveEnumMeta, str, E REPLACE = "Replace" NONE = "None" -class PrincipalType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrincipalType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Principal type. """ @@ -255,7 +240,7 @@ class PrincipalType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GROUP = "Group" USER = "User" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioned state of the resource. """ @@ -266,7 +251,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" MOVING = "Moving" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Public network access to the cluster is enabled by default. When disabled, only private endpoint connection to the cluster is allowed """ @@ -274,14 +259,14 @@ class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class Reason(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Message providing the reason why the given name is invalid. """ INVALID = "Invalid" ALREADY_EXISTS = "AlreadyExists" -class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class State(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The state of the resource. """ @@ -295,7 +280,7 @@ class State(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STARTING = "Starting" UPDATING = "Updating" -class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Status(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of operation. """ @@ -304,7 +289,7 @@ class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" RUNNING = "Running" -class Type(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of resource, for instance Microsoft.Kusto/clusters/databases. """ diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_models.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_models.py deleted file mode 100644 index da08d0d94d6b..000000000000 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_models.py +++ /dev/null @@ -1,3118 +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. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AcceptedAudiences(msrest.serialization.Model): - """Represents an accepted audience trusted by the cluster. - - :param value: GUID or valid URL representing an accepted audience. - :type value: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AcceptedAudiences, self).__init__(**kwargs) - self.value = kwargs.get('value', 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 AttachedDatabaseConfiguration(ProxyResource): - """Class representing an attached database configuration. - - 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 location: Resource location. - :type location: str - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - :param database_name: The name of the database which you would like to attach, use * if you - want to follow all current and future databases. - :type database_name: str - :param cluster_resource_id: The resource id of the cluster where the databases you would like - to attach reside. - :type cluster_resource_id: str - :ivar attached_database_names: The list of databases from the clusterResourceId which are - currently attached to the cluster. - :vartype attached_database_names: list[str] - :param default_principals_modification_kind: The default principals modification kind. Possible - values include: "Union", "Replace", "None". - :type default_principals_modification_kind: str or - ~kusto_management_client.models.DefaultPrincipalsModificationKind - :param table_level_sharing_properties: Table level sharing specifications. - :type table_level_sharing_properties: - ~kusto_management_client.models.TableLevelSharingProperties - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'attached_database_names': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, - 'cluster_resource_id': {'key': 'properties.clusterResourceId', 'type': 'str'}, - 'attached_database_names': {'key': 'properties.attachedDatabaseNames', 'type': '[str]'}, - 'default_principals_modification_kind': {'key': 'properties.defaultPrincipalsModificationKind', 'type': 'str'}, - 'table_level_sharing_properties': {'key': 'properties.tableLevelSharingProperties', 'type': 'TableLevelSharingProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(AttachedDatabaseConfiguration, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.provisioning_state = None - self.database_name = kwargs.get('database_name', None) - self.cluster_resource_id = kwargs.get('cluster_resource_id', None) - self.attached_database_names = None - self.default_principals_modification_kind = kwargs.get('default_principals_modification_kind', None) - self.table_level_sharing_properties = kwargs.get('table_level_sharing_properties', None) - - -class AttachedDatabaseConfigurationListResult(msrest.serialization.Model): - """The list attached database configurations operation response. - - :param value: The list of attached database configurations. - :type value: list[~kusto_management_client.models.AttachedDatabaseConfiguration] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AttachedDatabaseConfiguration]'}, - } - - def __init__( - self, - **kwargs - ): - super(AttachedDatabaseConfigurationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class AttachedDatabaseConfigurationsCheckNameRequest(msrest.serialization.Model): - """The result returned from a AttachedDatabaseConfigurations check name availability request. - - 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 name: Required. Attached database resource name. - :type name: str - :ivar type: The type of resource, for instance - Microsoft.Kusto/clusters/attachedDatabaseConfigurations. Has constant value: - "Microsoft.Kusto/clusters/attachedDatabaseConfigurations". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" - - def __init__( - self, - **kwargs - ): - super(AttachedDatabaseConfigurationsCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class AzureCapacity(msrest.serialization.Model): - """Azure capacity definition. - - All required parameters must be populated in order to send to Azure. - - :param scale_type: Required. Scale type. Possible values include: "automatic", "manual", - "none". - :type scale_type: str or ~kusto_management_client.models.AzureScaleType - :param minimum: Required. Minimum allowed capacity. - :type minimum: int - :param maximum: Required. Maximum allowed capacity. - :type maximum: int - :param default: Required. The default capacity that would be used. - :type default: int - """ - - _validation = { - 'scale_type': {'required': True}, - 'minimum': {'required': True}, - 'maximum': {'required': True}, - 'default': {'required': True}, - } - - _attribute_map = { - 'scale_type': {'key': 'scaleType', 'type': 'str'}, - 'minimum': {'key': 'minimum', 'type': 'int'}, - 'maximum': {'key': 'maximum', 'type': 'int'}, - 'default': {'key': 'default', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureCapacity, self).__init__(**kwargs) - self.scale_type = kwargs['scale_type'] - self.minimum = kwargs['minimum'] - self.maximum = kwargs['maximum'] - self.default = kwargs['default'] - - -class AzureResourceSku(msrest.serialization.Model): - """Azure resource SKU definition. - - :param resource_type: Resource Namespace and Type. - :type resource_type: str - :param sku: The SKU details. - :type sku: ~kusto_management_client.models.AzureSku - :param capacity: The number of instances of the cluster. - :type capacity: ~kusto_management_client.models.AzureCapacity - """ - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'AzureSku'}, - 'capacity': {'key': 'capacity', 'type': 'AzureCapacity'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureResourceSku, self).__init__(**kwargs) - self.resource_type = kwargs.get('resource_type', None) - self.sku = kwargs.get('sku', None) - self.capacity = kwargs.get('capacity', None) - - -class AzureSku(msrest.serialization.Model): - """Azure SKU definition. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. SKU name. Possible values include: "Standard_DS13_v2+1TB_PS", - "Standard_DS13_v2+2TB_PS", "Standard_DS14_v2+3TB_PS", "Standard_DS14_v2+4TB_PS", - "Standard_D13_v2", "Standard_D14_v2", "Standard_L8s", "Standard_L16s", "Standard_L8s_v2", - "Standard_L16s_v2", "Standard_D11_v2", "Standard_D12_v2", "Standard_L4s", "Dev(No - SLA)_Standard_D11_v2", "Standard_E64i_v3", "Standard_E80ids_v4", "Standard_E2a_v4", - "Standard_E4a_v4", "Standard_E8a_v4", "Standard_E16a_v4", "Standard_E8as_v4+1TB_PS", - "Standard_E8as_v4+2TB_PS", "Standard_E16as_v4+3TB_PS", "Standard_E16as_v4+4TB_PS", "Dev(No - SLA)_Standard_E2a_v4". - :type name: str or ~kusto_management_client.models.AzureSkuName - :param capacity: The number of instances of the cluster. - :type capacity: int - :param tier: Required. SKU tier. Possible values include: "Basic", "Standard". - :type tier: str or ~kusto_management_client.models.AzureSkuTier - """ - - _validation = { - 'name': {'required': True}, - 'tier': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - 'tier': {'key': 'tier', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureSku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.capacity = kwargs.get('capacity', None) - self.tier = kwargs['tier'] - - -class CheckNameRequest(msrest.serialization.Model): - """The result returned from a database check name availability request. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Resource name. - :type name: str - :param type: Required. The type of resource, for instance Microsoft.Kusto/clusters/databases. - Possible values include: "Microsoft.Kusto/clusters/databases", - "Microsoft.Kusto/clusters/attachedDatabaseConfigurations". - :type type: str or ~kusto_management_client.models.Type - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - self.type = kwargs['type'] - - -class CheckNameResult(msrest.serialization.Model): - """The result returned from a check name availability request. - - :param name_available: Specifies a Boolean value that indicates if the name is available. - :type name_available: bool - :param name: The name that was checked. - :type name: str - :param message: Message indicating an unavailable name due to a conflict, or a description of - the naming rules that are violated. - :type message: str - :param reason: Message providing the reason why the given name is invalid. Possible values - include: "Invalid", "AlreadyExists". - :type reason: str or ~kusto_management_client.models.Reason - """ - - _attribute_map = { - 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, - 'name': {'key': 'name', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'reason': {'key': 'reason', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckNameResult, self).__init__(**kwargs) - self.name_available = kwargs.get('name_available', None) - self.name = kwargs.get('name', None) - self.message = kwargs.get('message', None) - self.reason = kwargs.get('reason', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from Kusto. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for displaying in a - user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in - error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~kusto_management_client.models.CloudErrorBody] - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.target = kwargs.get('target', None) - self.details = kwargs.get('details', None) - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /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 tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class Cluster(TrackedResource): - """Class representing a Kusto cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param sku: Required. The SKU of the cluster. - :type sku: ~kusto_management_client.models.AzureSku - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~kusto_management_client.models.SystemData - :param zones: The availability zones of the cluster. - :type zones: list[str] - :param identity: The identity of the cluster, if configured. - :type identity: ~kusto_management_client.models.Identity - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", - "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". - :vartype state: str or ~kusto_management_client.models.State - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - :ivar uri: The cluster URI. - :vartype uri: str - :ivar data_ingestion_uri: The cluster data ingestion URI. - :vartype data_ingestion_uri: str - :ivar state_reason: The reason for the cluster's current state. - :vartype state_reason: str - :param trusted_external_tenants: The cluster's external tenants. - :type trusted_external_tenants: list[~kusto_management_client.models.TrustedExternalTenant] - :param optimized_autoscale: Optimized auto scale definition. - :type optimized_autoscale: ~kusto_management_client.models.OptimizedAutoscale - :param enable_disk_encryption: A boolean value that indicates if the cluster's disks are - encrypted. - :type enable_disk_encryption: bool - :param enable_streaming_ingest: A boolean value that indicates if the streaming ingest is - enabled. - :type enable_streaming_ingest: bool - :param virtual_network_configuration: Virtual network definition. - :type virtual_network_configuration: - ~kusto_management_client.models.VirtualNetworkConfiguration - :param key_vault_properties: KeyVault properties for the cluster encryption. - :type key_vault_properties: ~kusto_management_client.models.KeyVaultProperties - :param enable_purge: A boolean value that indicates if the purge operations are enabled. - :type enable_purge: bool - :ivar language_extensions: List of the cluster's language extensions. - :vartype language_extensions: ~kusto_management_client.models.LanguageExtensionsList - :param enable_double_encryption: A boolean value that indicates if double encryption is - enabled. - :type enable_double_encryption: bool - :param public_network_access: Public network access to the cluster is enabled by default. When - disabled, only private endpoint connection to the cluster is allowed. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :type public_network_access: str or ~kusto_management_client.models.PublicNetworkAccess - :param allowed_ip_range_list: The list of ips in the format of CIDR allowed to connect to the - cluster. - :type allowed_ip_range_list: list[str] - :param engine_type: The engine type. Possible values include: "V2", "V3". Default value: "V3". - :type engine_type: str or ~kusto_management_client.models.EngineType - :param accepted_audiences: The cluster's accepted audiences. - :type accepted_audiences: list[~kusto_management_client.models.AcceptedAudiences] - :param enable_auto_stop: A boolean value that indicates if the cluster could be automatically - stopped (due to lack of data or no activity for many days). - :type enable_auto_stop: bool - :param restrict_outbound_network_access: Whether or not to restrict outbound network access. - Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: - "Enabled", "Disabled". - :type restrict_outbound_network_access: str or - ~kusto_management_client.models.ClusterNetworkAccessFlag - :param allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from - Cluster. - :type allowed_fqdn_list: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'sku': {'required': True}, - 'system_data': {'readonly': True}, - 'etag': {'readonly': True}, - 'state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'uri': {'readonly': True}, - 'data_ingestion_uri': {'readonly': True}, - 'state_reason': {'readonly': True}, - 'language_extensions': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'AzureSku'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'uri': {'key': 'properties.uri', 'type': 'str'}, - 'data_ingestion_uri': {'key': 'properties.dataIngestionUri', 'type': 'str'}, - 'state_reason': {'key': 'properties.stateReason', 'type': 'str'}, - 'trusted_external_tenants': {'key': 'properties.trustedExternalTenants', 'type': '[TrustedExternalTenant]'}, - 'optimized_autoscale': {'key': 'properties.optimizedAutoscale', 'type': 'OptimizedAutoscale'}, - 'enable_disk_encryption': {'key': 'properties.enableDiskEncryption', 'type': 'bool'}, - 'enable_streaming_ingest': {'key': 'properties.enableStreamingIngest', 'type': 'bool'}, - 'virtual_network_configuration': {'key': 'properties.virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, - 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'KeyVaultProperties'}, - 'enable_purge': {'key': 'properties.enablePurge', 'type': 'bool'}, - 'language_extensions': {'key': 'properties.languageExtensions', 'type': 'LanguageExtensionsList'}, - 'enable_double_encryption': {'key': 'properties.enableDoubleEncryption', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'allowed_ip_range_list': {'key': 'properties.allowedIpRangeList', 'type': '[str]'}, - 'engine_type': {'key': 'properties.engineType', 'type': 'str'}, - 'accepted_audiences': {'key': 'properties.acceptedAudiences', 'type': '[AcceptedAudiences]'}, - 'enable_auto_stop': {'key': 'properties.enableAutoStop', 'type': 'bool'}, - 'restrict_outbound_network_access': {'key': 'properties.restrictOutboundNetworkAccess', 'type': 'str'}, - 'allowed_fqdn_list': {'key': 'properties.allowedFqdnList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(Cluster, self).__init__(**kwargs) - self.sku = kwargs['sku'] - self.system_data = None - self.zones = kwargs.get('zones', None) - self.identity = kwargs.get('identity', None) - self.etag = None - self.state = None - self.provisioning_state = None - self.uri = None - self.data_ingestion_uri = None - self.state_reason = None - self.trusted_external_tenants = kwargs.get('trusted_external_tenants', None) - self.optimized_autoscale = kwargs.get('optimized_autoscale', None) - self.enable_disk_encryption = kwargs.get('enable_disk_encryption', False) - self.enable_streaming_ingest = kwargs.get('enable_streaming_ingest', False) - self.virtual_network_configuration = kwargs.get('virtual_network_configuration', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - self.enable_purge = kwargs.get('enable_purge', False) - self.language_extensions = None - self.enable_double_encryption = kwargs.get('enable_double_encryption', False) - self.public_network_access = kwargs.get('public_network_access', "Enabled") - self.allowed_ip_range_list = kwargs.get('allowed_ip_range_list', None) - self.engine_type = kwargs.get('engine_type', "V3") - self.accepted_audiences = kwargs.get('accepted_audiences', None) - self.enable_auto_stop = kwargs.get('enable_auto_stop', True) - self.restrict_outbound_network_access = kwargs.get('restrict_outbound_network_access', None) - self.allowed_fqdn_list = kwargs.get('allowed_fqdn_list', None) - - -class ClusterCheckNameRequest(msrest.serialization.Model): - """The result returned from a cluster check name availability request. - - 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 name: Required. Cluster name. - :type name: str - :ivar type: The type of resource, Microsoft.Kusto/clusters. Has constant value: - "Microsoft.Kusto/clusters". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Kusto/clusters" - - def __init__( - self, - **kwargs - ): - super(ClusterCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class ClusterListResult(msrest.serialization.Model): - """The list Kusto clusters operation response. - - :param value: The list of Kusto clusters. - :type value: list[~kusto_management_client.models.Cluster] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Cluster]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ClusterPrincipalAssignment(ProxyResource): - """Class representing a cluster principal assignment. - - 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 principal_id: The principal ID assigned to the cluster principal. It can be a user - email, application ID, or security group name. - :type principal_id: str - :param role: Cluster principal role. Possible values include: "AllDatabasesAdmin", - "AllDatabasesViewer". - :type role: str or ~kusto_management_client.models.ClusterPrincipalRole - :param tenant_id: The tenant id of the principal. - :type tenant_id: str - :param principal_type: Principal type. Possible values include: "App", "Group", "User". - :type principal_type: str or ~kusto_management_client.models.PrincipalType - :ivar tenant_name: The tenant name of the principal. - :vartype tenant_name: str - :ivar principal_name: The principal name. - :vartype principal_name: str - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'tenant_name': {'readonly': True}, - 'principal_name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, - 'role': {'key': 'properties.role', 'type': 'str'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, - 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, - 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterPrincipalAssignment, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.role = kwargs.get('role', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.principal_type = kwargs.get('principal_type', None) - self.tenant_name = None - self.principal_name = None - self.provisioning_state = None - - -class ClusterPrincipalAssignmentCheckNameRequest(msrest.serialization.Model): - """A principal assignment check name availability request. - - 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 name: Required. Principal Assignment resource name. - :type name: str - :ivar type: The type of resource, Microsoft.Kusto/clusters/principalAssignments. Has constant - value: "Microsoft.Kusto/clusters/principalAssignments". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Kusto/clusters/principalAssignments" - - def __init__( - self, - **kwargs - ): - super(ClusterPrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class ClusterPrincipalAssignmentListResult(msrest.serialization.Model): - """The list Kusto cluster principal assignments operation response. - - :param value: The list of Kusto cluster principal assignments. - :type value: list[~kusto_management_client.models.ClusterPrincipalAssignment] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ClusterPrincipalAssignment]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterPrincipalAssignmentListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ClusterUpdate(Resource): - """Class representing an update to a Kusto cluster. - - 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 tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Resource location. - :type location: str - :param sku: The SKU of the cluster. - :type sku: ~kusto_management_client.models.AzureSku - :param identity: The identity of the cluster, if configured. - :type identity: ~kusto_management_client.models.Identity - :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", - "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". - :vartype state: str or ~kusto_management_client.models.State - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - :ivar uri: The cluster URI. - :vartype uri: str - :ivar data_ingestion_uri: The cluster data ingestion URI. - :vartype data_ingestion_uri: str - :ivar state_reason: The reason for the cluster's current state. - :vartype state_reason: str - :param trusted_external_tenants: The cluster's external tenants. - :type trusted_external_tenants: list[~kusto_management_client.models.TrustedExternalTenant] - :param optimized_autoscale: Optimized auto scale definition. - :type optimized_autoscale: ~kusto_management_client.models.OptimizedAutoscale - :param enable_disk_encryption: A boolean value that indicates if the cluster's disks are - encrypted. - :type enable_disk_encryption: bool - :param enable_streaming_ingest: A boolean value that indicates if the streaming ingest is - enabled. - :type enable_streaming_ingest: bool - :param virtual_network_configuration: Virtual network definition. - :type virtual_network_configuration: - ~kusto_management_client.models.VirtualNetworkConfiguration - :param key_vault_properties: KeyVault properties for the cluster encryption. - :type key_vault_properties: ~kusto_management_client.models.KeyVaultProperties - :param enable_purge: A boolean value that indicates if the purge operations are enabled. - :type enable_purge: bool - :ivar language_extensions: List of the cluster's language extensions. - :vartype language_extensions: ~kusto_management_client.models.LanguageExtensionsList - :param enable_double_encryption: A boolean value that indicates if double encryption is - enabled. - :type enable_double_encryption: bool - :param public_network_access: Public network access to the cluster is enabled by default. When - disabled, only private endpoint connection to the cluster is allowed. Possible values include: - "Enabled", "Disabled". Default value: "Enabled". - :type public_network_access: str or ~kusto_management_client.models.PublicNetworkAccess - :param allowed_ip_range_list: The list of ips in the format of CIDR allowed to connect to the - cluster. - :type allowed_ip_range_list: list[str] - :param engine_type: The engine type. Possible values include: "V2", "V3". Default value: "V3". - :type engine_type: str or ~kusto_management_client.models.EngineType - :param accepted_audiences: The cluster's accepted audiences. - :type accepted_audiences: list[~kusto_management_client.models.AcceptedAudiences] - :param enable_auto_stop: A boolean value that indicates if the cluster could be automatically - stopped (due to lack of data or no activity for many days). - :type enable_auto_stop: bool - :param restrict_outbound_network_access: Whether or not to restrict outbound network access. - Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: - "Enabled", "Disabled". - :type restrict_outbound_network_access: str or - ~kusto_management_client.models.ClusterNetworkAccessFlag - :param allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from - Cluster. - :type allowed_fqdn_list: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'uri': {'readonly': True}, - 'data_ingestion_uri': {'readonly': True}, - 'state_reason': {'readonly': True}, - 'language_extensions': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'sku': {'key': 'sku', 'type': 'AzureSku'}, - 'identity': {'key': 'identity', 'type': 'Identity'}, - 'state': {'key': 'properties.state', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'uri': {'key': 'properties.uri', 'type': 'str'}, - 'data_ingestion_uri': {'key': 'properties.dataIngestionUri', 'type': 'str'}, - 'state_reason': {'key': 'properties.stateReason', 'type': 'str'}, - 'trusted_external_tenants': {'key': 'properties.trustedExternalTenants', 'type': '[TrustedExternalTenant]'}, - 'optimized_autoscale': {'key': 'properties.optimizedAutoscale', 'type': 'OptimizedAutoscale'}, - 'enable_disk_encryption': {'key': 'properties.enableDiskEncryption', 'type': 'bool'}, - 'enable_streaming_ingest': {'key': 'properties.enableStreamingIngest', 'type': 'bool'}, - 'virtual_network_configuration': {'key': 'properties.virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, - 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'KeyVaultProperties'}, - 'enable_purge': {'key': 'properties.enablePurge', 'type': 'bool'}, - 'language_extensions': {'key': 'properties.languageExtensions', 'type': 'LanguageExtensionsList'}, - 'enable_double_encryption': {'key': 'properties.enableDoubleEncryption', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - 'allowed_ip_range_list': {'key': 'properties.allowedIpRangeList', 'type': '[str]'}, - 'engine_type': {'key': 'properties.engineType', 'type': 'str'}, - 'accepted_audiences': {'key': 'properties.acceptedAudiences', 'type': '[AcceptedAudiences]'}, - 'enable_auto_stop': {'key': 'properties.enableAutoStop', 'type': 'bool'}, - 'restrict_outbound_network_access': {'key': 'properties.restrictOutboundNetworkAccess', 'type': 'str'}, - 'allowed_fqdn_list': {'key': 'properties.allowedFqdnList', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterUpdate, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs.get('location', None) - self.sku = kwargs.get('sku', None) - self.identity = kwargs.get('identity', None) - self.state = None - self.provisioning_state = None - self.uri = None - self.data_ingestion_uri = None - self.state_reason = None - self.trusted_external_tenants = kwargs.get('trusted_external_tenants', None) - self.optimized_autoscale = kwargs.get('optimized_autoscale', None) - self.enable_disk_encryption = kwargs.get('enable_disk_encryption', False) - self.enable_streaming_ingest = kwargs.get('enable_streaming_ingest', False) - self.virtual_network_configuration = kwargs.get('virtual_network_configuration', None) - self.key_vault_properties = kwargs.get('key_vault_properties', None) - self.enable_purge = kwargs.get('enable_purge', False) - self.language_extensions = None - self.enable_double_encryption = kwargs.get('enable_double_encryption', False) - self.public_network_access = kwargs.get('public_network_access', "Enabled") - self.allowed_ip_range_list = kwargs.get('allowed_ip_range_list', None) - self.engine_type = kwargs.get('engine_type', "V3") - self.accepted_audiences = kwargs.get('accepted_audiences', None) - self.enable_auto_stop = kwargs.get('enable_auto_stop', True) - self.restrict_outbound_network_access = kwargs.get('restrict_outbound_network_access', None) - self.allowed_fqdn_list = kwargs.get('allowed_fqdn_list', None) - - -class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): - """ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client id of user assigned identity. - :vartype client_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class Database(ProxyResource): - """Class representing a Kusto database. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ReadOnlyFollowingDatabase, ReadWriteDatabase. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the database.Constant filled by server. Possible values - include: "ReadWrite", "ReadOnlyFollowing". - :type kind: str or ~kusto_management_client.models.Kind - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'ReadOnlyFollowing': 'ReadOnlyFollowingDatabase', 'ReadWrite': 'ReadWriteDatabase'} - } - - def __init__( - self, - **kwargs - ): - super(Database, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.kind = 'Database' # type: str - - -class DatabaseListResult(msrest.serialization.Model): - """The list Kusto databases operation response. - - :param value: The list of Kusto databases. - :type value: list[~kusto_management_client.models.Database] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Database]'}, - } - - def __init__( - self, - **kwargs - ): - super(DatabaseListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class DatabasePrincipal(msrest.serialization.Model): - """A class representing database principal entity. - - 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 role: Required. Database principal role. Possible values include: "Admin", "Ingestor", - "Monitor", "User", "UnrestrictedViewer", "Viewer". - :type role: str or ~kusto_management_client.models.DatabasePrincipalRole - :param name: Required. Database principal name. - :type name: str - :param type: Required. Database principal type. Possible values include: "App", "Group", - "User". - :type type: str or ~kusto_management_client.models.DatabasePrincipalType - :param fqn: Database principal fully qualified name. - :type fqn: str - :param email: Database principal email if exists. - :type email: str - :param app_id: Application id - relevant only for application principal type. - :type app_id: str - :ivar tenant_name: The tenant name of the principal. - :vartype tenant_name: str - """ - - _validation = { - 'role': {'required': True}, - 'name': {'required': True}, - 'type': {'required': True}, - 'tenant_name': {'readonly': True}, - } - - _attribute_map = { - 'role': {'key': 'role', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'fqn': {'key': 'fqn', 'type': 'str'}, - 'email': {'key': 'email', 'type': 'str'}, - 'app_id': {'key': 'appId', 'type': 'str'}, - 'tenant_name': {'key': 'tenantName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DatabasePrincipal, self).__init__(**kwargs) - self.role = kwargs['role'] - self.name = kwargs['name'] - self.type = kwargs['type'] - self.fqn = kwargs.get('fqn', None) - self.email = kwargs.get('email', None) - self.app_id = kwargs.get('app_id', None) - self.tenant_name = None - - -class DatabasePrincipalAssignment(ProxyResource): - """Class representing a database principal assignment. - - 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 principal_id: The principal ID assigned to the database principal. It can be a user - email, application ID, or security group name. - :type principal_id: str - :param role: Database principal role. Possible values include: "Admin", "Ingestor", "Monitor", - "User", "UnrestrictedViewer", "Viewer". - :type role: str or ~kusto_management_client.models.DatabasePrincipalRole - :param tenant_id: The tenant id of the principal. - :type tenant_id: str - :param principal_type: Principal type. Possible values include: "App", "Group", "User". - :type principal_type: str or ~kusto_management_client.models.PrincipalType - :ivar tenant_name: The tenant name of the principal. - :vartype tenant_name: str - :ivar principal_name: The principal name. - :vartype principal_name: str - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'tenant_name': {'readonly': True}, - 'principal_name': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, - 'role': {'key': 'properties.role', 'type': 'str'}, - 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, - 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, - 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, - 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DatabasePrincipalAssignment, self).__init__(**kwargs) - self.principal_id = kwargs.get('principal_id', None) - self.role = kwargs.get('role', None) - self.tenant_id = kwargs.get('tenant_id', None) - self.principal_type = kwargs.get('principal_type', None) - self.tenant_name = None - self.principal_name = None - self.provisioning_state = None - - -class DatabasePrincipalAssignmentCheckNameRequest(msrest.serialization.Model): - """A principal assignment check name availability request. - - 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 name: Required. Principal Assignment resource name. - :type name: str - :ivar type: The type of resource, Microsoft.Kusto/clusters/databases/principalAssignments. Has - constant value: "Microsoft.Kusto/clusters/databases/principalAssignments". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Kusto/clusters/databases/principalAssignments" - - def __init__( - self, - **kwargs - ): - super(DatabasePrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class DatabasePrincipalAssignmentListResult(msrest.serialization.Model): - """The list Kusto database principal assignments operation response. - - :param value: The list of Kusto database principal assignments. - :type value: list[~kusto_management_client.models.DatabasePrincipalAssignment] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DatabasePrincipalAssignment]'}, - } - - def __init__( - self, - **kwargs - ): - super(DatabasePrincipalAssignmentListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class DatabasePrincipalListRequest(msrest.serialization.Model): - """The list Kusto database principals operation request. - - :param value: The list of Kusto database principals. - :type value: list[~kusto_management_client.models.DatabasePrincipal] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DatabasePrincipal]'}, - } - - def __init__( - self, - **kwargs - ): - super(DatabasePrincipalListRequest, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class DatabasePrincipalListResult(msrest.serialization.Model): - """The list Kusto database principals operation response. - - :param value: The list of Kusto database principals. - :type value: list[~kusto_management_client.models.DatabasePrincipal] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DatabasePrincipal]'}, - } - - def __init__( - self, - **kwargs - ): - super(DatabasePrincipalListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class DatabaseStatistics(msrest.serialization.Model): - """A class that contains database statistics information. - - :param size: The database size - the total size of compressed data and index in bytes. - :type size: float - """ - - _attribute_map = { - 'size': {'key': 'size', 'type': 'float'}, - } - - def __init__( - self, - **kwargs - ): - super(DatabaseStatistics, self).__init__(**kwargs) - self.size = kwargs.get('size', None) - - -class DataConnection(ProxyResource): - """Class representing an data connection. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: EventGridDataConnection, EventHubDataConnection, IotHubDataConnection. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. - Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~kusto_management_client.models.DataConnectionKind - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - } - - _subtype_map = { - 'kind': {'EventGrid': 'EventGridDataConnection', 'EventHub': 'EventHubDataConnection', 'IotHub': 'IotHubDataConnection'} - } - - def __init__( - self, - **kwargs - ): - super(DataConnection, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.kind = 'DataConnection' # type: str - - -class DataConnectionCheckNameRequest(msrest.serialization.Model): - """A data connection check name availability request. - - 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 name: Required. Data Connection name. - :type name: str - :ivar type: The type of resource, Microsoft.Kusto/clusters/databases/dataConnections. Has - constant value: "Microsoft.Kusto/clusters/databases/dataConnections". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Kusto/clusters/databases/dataConnections" - - def __init__( - self, - **kwargs - ): - super(DataConnectionCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class DataConnectionListResult(msrest.serialization.Model): - """The list Kusto data connections operation response. - - :param value: The list of Kusto data connections. - :type value: list[~kusto_management_client.models.DataConnection] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(DataConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class DataConnectionValidation(msrest.serialization.Model): - """Class representing an data connection validation. - - :param data_connection_name: The name of the data connection. - :type data_connection_name: str - :param properties: The data connection properties to validate. - :type properties: ~kusto_management_client.models.DataConnection - """ - - _attribute_map = { - 'data_connection_name': {'key': 'dataConnectionName', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'DataConnection'}, - } - - def __init__( - self, - **kwargs - ): - super(DataConnectionValidation, self).__init__(**kwargs) - self.data_connection_name = kwargs.get('data_connection_name', None) - self.properties = kwargs.get('properties', None) - - -class DataConnectionValidationListResult(msrest.serialization.Model): - """The list Kusto data connection validation result. - - :param value: The list of Kusto data connection validation errors. - :type value: list[~kusto_management_client.models.DataConnectionValidationResult] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[DataConnectionValidationResult]'}, - } - - def __init__( - self, - **kwargs - ): - super(DataConnectionValidationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class DataConnectionValidationResult(msrest.serialization.Model): - """The result returned from a data connection validation request. - - :param error_message: A message which indicates a problem in data connection validation. - :type error_message: str - """ - - _attribute_map = { - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DataConnectionValidationResult, self).__init__(**kwargs) - self.error_message = kwargs.get('error_message', None) - - -class DiagnoseVirtualNetworkResult(msrest.serialization.Model): - """DiagnoseVirtualNetworkResult. - - :param findings: The list of network connectivity diagnostic finding. - :type findings: list[str] - """ - - _attribute_map = { - 'findings': {'key': 'findings', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(DiagnoseVirtualNetworkResult, self).__init__(**kwargs) - self.findings = kwargs.get('findings', None) - - -class EndpointDependency(msrest.serialization.Model): - """A domain name that a service is reached at, including details of the current connection status. - - :param domain_name: The domain name of the dependency. - :type domain_name: str - :param endpoint_details: The ports used when connecting to DomainName. - :type endpoint_details: list[~kusto_management_client.models.EndpointDetail] - """ - - _attribute_map = { - 'domain_name': {'key': 'domainName', 'type': 'str'}, - 'endpoint_details': {'key': 'endpointDetails', 'type': '[EndpointDetail]'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointDependency, self).__init__(**kwargs) - self.domain_name = kwargs.get('domain_name', None) - self.endpoint_details = kwargs.get('endpoint_details', None) - - -class EndpointDetail(msrest.serialization.Model): - """Current TCP connectivity information from the Kusto cluster to a single endpoint. - - :param port: The port an endpoint is connected to. - :type port: int - """ - - _attribute_map = { - 'port': {'key': 'port', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointDetail, self).__init__(**kwargs) - self.port = kwargs.get('port', None) - - -class EventGridDataConnection(DataConnection): - """Class representing an Event Grid data connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. - Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~kusto_management_client.models.DataConnectionKind - :param storage_account_resource_id: The resource ID of the storage account where the data - resides. - :type storage_account_resource_id: str - :param event_hub_resource_id: The resource ID where the event grid is configured to send - events. - :type event_hub_resource_id: str - :param consumer_group: The event hub consumer group. - :type consumer_group: str - :param table_name: The table where the data should be ingested. Optionally the table - information can be added to each message. - :type table_name: str - :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the - mapping information can be added to each message. - :type mapping_rule_name: str - :param data_format: The data format of the message. Optionally the data format can be added to - each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", - "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", - "W3CLOGFILE". - :type data_format: str or ~kusto_management_client.models.EventGridDataFormat - :param ignore_first_record: A Boolean value that, if set to true, indicates that ingestion - should ignore the first record of every file. - :type ignore_first_record: bool - :param blob_storage_event_type: The name of blob storage event type to process. Possible values - include: "Microsoft.Storage.BlobCreated", "Microsoft.Storage.BlobRenamed". - :type blob_storage_event_type: str or ~kusto_management_client.models.BlobStorageEventType - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, - 'event_hub_resource_id': {'key': 'properties.eventHubResourceId', 'type': 'str'}, - 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, - 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, - 'ignore_first_record': {'key': 'properties.ignoreFirstRecord', 'type': 'bool'}, - 'blob_storage_event_type': {'key': 'properties.blobStorageEventType', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventGridDataConnection, self).__init__(**kwargs) - self.kind = 'EventGrid' # type: str - self.storage_account_resource_id = kwargs.get('storage_account_resource_id', None) - self.event_hub_resource_id = kwargs.get('event_hub_resource_id', None) - self.consumer_group = kwargs.get('consumer_group', None) - self.table_name = kwargs.get('table_name', None) - self.mapping_rule_name = kwargs.get('mapping_rule_name', None) - self.data_format = kwargs.get('data_format', None) - self.ignore_first_record = kwargs.get('ignore_first_record', None) - self.blob_storage_event_type = kwargs.get('blob_storage_event_type', None) - self.provisioning_state = None - - -class EventHubDataConnection(DataConnection): - """Class representing an event hub data connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. - Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~kusto_management_client.models.DataConnectionKind - :param event_hub_resource_id: The resource ID of the event hub to be used to create a data - connection. - :type event_hub_resource_id: str - :param consumer_group: The event hub consumer group. - :type consumer_group: str - :param table_name: The table where the data should be ingested. Optionally the table - information can be added to each message. - :type table_name: str - :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the - mapping information can be added to each message. - :type mapping_rule_name: str - :param data_format: The data format of the message. Optionally the data format can be added to - each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", - "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", - "W3CLOGFILE". - :type data_format: str or ~kusto_management_client.models.EventHubDataFormat - :param event_system_properties: System properties of the event hub. - :type event_system_properties: list[str] - :param compression: The event hub messages compression type. Possible values include: "None", - "GZip". Default value: "None". - :type compression: str or ~kusto_management_client.models.Compression - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - :param managed_identity_resource_id: The resource ID of a managed identity (system or user - assigned) to be used to authenticate with event hub. - :type managed_identity_resource_id: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'event_hub_resource_id': {'key': 'properties.eventHubResourceId', 'type': 'str'}, - 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, - 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, - 'event_system_properties': {'key': 'properties.eventSystemProperties', 'type': '[str]'}, - 'compression': {'key': 'properties.compression', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'managed_identity_resource_id': {'key': 'properties.managedIdentityResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(EventHubDataConnection, self).__init__(**kwargs) - self.kind = 'EventHub' # type: str - self.event_hub_resource_id = kwargs.get('event_hub_resource_id', None) - self.consumer_group = kwargs.get('consumer_group', None) - self.table_name = kwargs.get('table_name', None) - self.mapping_rule_name = kwargs.get('mapping_rule_name', None) - self.data_format = kwargs.get('data_format', None) - self.event_system_properties = kwargs.get('event_system_properties', None) - self.compression = kwargs.get('compression', "None") - self.provisioning_state = None - self.managed_identity_resource_id = kwargs.get('managed_identity_resource_id', None) - - -class FollowerDatabaseDefinition(msrest.serialization.Model): - """A class representing follower database request. - - 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 cluster_resource_id: Required. Resource id of the cluster that follows a database owned - by this cluster. - :type cluster_resource_id: str - :param attached_database_configuration_name: Required. Resource name of the attached database - configuration in the follower cluster. - :type attached_database_configuration_name: str - :ivar database_name: The database name owned by this cluster that was followed. * in case - following all databases. - :vartype database_name: str - """ - - _validation = { - 'cluster_resource_id': {'required': True}, - 'attached_database_configuration_name': {'required': True}, - 'database_name': {'readonly': True}, - } - - _attribute_map = { - 'cluster_resource_id': {'key': 'clusterResourceId', 'type': 'str'}, - 'attached_database_configuration_name': {'key': 'attachedDatabaseConfigurationName', 'type': 'str'}, - 'database_name': {'key': 'databaseName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FollowerDatabaseDefinition, self).__init__(**kwargs) - self.cluster_resource_id = kwargs['cluster_resource_id'] - self.attached_database_configuration_name = kwargs['attached_database_configuration_name'] - self.database_name = None - - -class FollowerDatabaseListResult(msrest.serialization.Model): - """The list Kusto database principals operation response. - - :param value: The list of follower database result. - :type value: list[~kusto_management_client.models.FollowerDatabaseDefinition] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FollowerDatabaseDefinition]'}, - } - - def __init__( - self, - **kwargs - ): - super(FollowerDatabaseListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', 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. - - All required parameters must be populated in order to send to Azure. - - :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: Required. The type of managed identity used. The type 'SystemAssigned, - UserAssigned' includes both an implicitly created identity and a set of user-assigned - identities. The type 'None' will remove all identities. Possible values include: "None", - "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned". - :type type: str or ~kusto_management_client.models.IdentityType - :param user_assigned_identities: The list of user identities associated with the Kusto cluster. - The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~kusto_management_client.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - 'type': {'required': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties}'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs['type'] - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class IotHubDataConnection(DataConnection): - """Class representing an iot hub data connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. - Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~kusto_management_client.models.DataConnectionKind - :param iot_hub_resource_id: The resource ID of the Iot hub to be used to create a data - connection. - :type iot_hub_resource_id: str - :param consumer_group: The iot hub consumer group. - :type consumer_group: str - :param table_name: The table where the data should be ingested. Optionally the table - information can be added to each message. - :type table_name: str - :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the - mapping information can be added to each message. - :type mapping_rule_name: str - :param data_format: The data format of the message. Optionally the data format can be added to - each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", - "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", - "W3CLOGFILE". - :type data_format: str or ~kusto_management_client.models.IotHubDataFormat - :param event_system_properties: System properties of the iot hub. - :type event_system_properties: list[str] - :param shared_access_policy_name: The name of the share access policy. - :type shared_access_policy_name: str - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'iot_hub_resource_id': {'key': 'properties.iotHubResourceId', 'type': 'str'}, - 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, - 'table_name': {'key': 'properties.tableName', 'type': 'str'}, - 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, - 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, - 'event_system_properties': {'key': 'properties.eventSystemProperties', 'type': '[str]'}, - 'shared_access_policy_name': {'key': 'properties.sharedAccessPolicyName', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(IotHubDataConnection, self).__init__(**kwargs) - self.kind = 'IotHub' # type: str - self.iot_hub_resource_id = kwargs.get('iot_hub_resource_id', None) - self.consumer_group = kwargs.get('consumer_group', None) - self.table_name = kwargs.get('table_name', None) - self.mapping_rule_name = kwargs.get('mapping_rule_name', None) - self.data_format = kwargs.get('data_format', None) - self.event_system_properties = kwargs.get('event_system_properties', None) - self.shared_access_policy_name = kwargs.get('shared_access_policy_name', None) - self.provisioning_state = None - - -class KeyVaultProperties(msrest.serialization.Model): - """Properties of the key vault. - - :param key_name: The name of the key vault key. - :type key_name: str - :param key_version: The version of the key vault key. - :type key_version: str - :param key_vault_uri: The Uri of the key vault. - :type key_vault_uri: str - :param user_identity: The user assigned identity (ARM resource id) that has access to the key. - :type user_identity: str - """ - - _attribute_map = { - 'key_name': {'key': 'keyName', 'type': 'str'}, - 'key_version': {'key': 'keyVersion', 'type': 'str'}, - 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, - 'user_identity': {'key': 'userIdentity', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyVaultProperties, self).__init__(**kwargs) - self.key_name = kwargs.get('key_name', None) - self.key_version = kwargs.get('key_version', None) - self.key_vault_uri = kwargs.get('key_vault_uri', None) - self.user_identity = kwargs.get('user_identity', None) - - -class LanguageExtension(msrest.serialization.Model): - """The language extension object. - - :param language_extension_name: The language extension name. Possible values include: "PYTHON", - "R". - :type language_extension_name: str or ~kusto_management_client.models.LanguageExtensionName - """ - - _attribute_map = { - 'language_extension_name': {'key': 'languageExtensionName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LanguageExtension, self).__init__(**kwargs) - self.language_extension_name = kwargs.get('language_extension_name', None) - - -class LanguageExtensionsList(msrest.serialization.Model): - """The list of language extension objects. - - :param value: The list of language extensions. - :type value: list[~kusto_management_client.models.LanguageExtension] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[LanguageExtension]'}, - } - - def __init__( - self, - **kwargs - ): - super(LanguageExtensionsList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ListResourceSkusResult(msrest.serialization.Model): - """List of available SKUs for a Kusto Cluster. - - :param value: The collection of available SKUs for an existing resource. - :type value: list[~kusto_management_client.models.AzureResourceSku] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[AzureResourceSku]'}, - } - - def __init__( - self, - **kwargs - ): - super(ListResourceSkusResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ManagedPrivateEndpoint(ProxyResource): - """Class representing a managed private endpoint. - - 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: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~kusto_management_client.models.SystemData - :param private_link_resource_id: The ARM resource ID of the resource for which the managed - private endpoint is created. - :type private_link_resource_id: str - :param private_link_resource_region: The region of the resource to which the managed private - endpoint is created. - :type private_link_resource_region: str - :param group_id: The groupId in which the managed private endpoint is created. - :type group_id: str - :param request_message: The user request message. - :type request_message: str - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'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'}, - 'private_link_resource_id': {'key': 'properties.privateLinkResourceId', 'type': 'str'}, - 'private_link_resource_region': {'key': 'properties.privateLinkResourceRegion', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'request_message': {'key': 'properties.requestMessage', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedPrivateEndpoint, self).__init__(**kwargs) - self.system_data = None - self.private_link_resource_id = kwargs.get('private_link_resource_id', None) - self.private_link_resource_region = kwargs.get('private_link_resource_region', None) - self.group_id = kwargs.get('group_id', None) - self.request_message = kwargs.get('request_message', None) - self.provisioning_state = None - - -class ManagedPrivateEndpointListResult(msrest.serialization.Model): - """The list managed private endpoints operation response. - - :param value: The list of managed private endpoints. - :type value: list[~kusto_management_client.models.ManagedPrivateEndpoint] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ManagedPrivateEndpoint]'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedPrivateEndpointListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class ManagedPrivateEndpointsCheckNameRequest(msrest.serialization.Model): - """The result returned from a managedPrivateEndpoints check name availability request. - - 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 name: Required. Managed private endpoint resource name. - :type name: str - :ivar type: The type of resource, for instance - Microsoft.Kusto/clusters/managedPrivateEndpoints. Has constant value: - "Microsoft.Kusto/clusters/managedPrivateEndpoints". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Kusto/clusters/managedPrivateEndpoints" - - def __init__( - self, - **kwargs - ): - super(ManagedPrivateEndpointsCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class Operation(msrest.serialization.Model): - """A REST API operation. - - :param name: This is of the format {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operation. - :type display: ~kusto_management_client.models.OperationDisplay - :param origin: The intended executor of the operation. - :type origin: str - :param properties: Any object. - :type properties: any - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.properties = kwargs.get('properties', None) - - -class OperationDisplay(msrest.serialization.Model): - """The object that describes the operation. - - :param provider: Friendly name of the resource provider. - :type provider: str - :param operation: For example: read, write, delete. - :type operation: str - :param resource: The resource type on which the operation is performed. - :type resource: str - :param description: The friendly name of the operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.operation = kwargs.get('operation', None) - self.resource = kwargs.get('resource', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. - - :param value: The list of operations supported by the resource provider. - :type value: list[~kusto_management_client.models.Operation] - :param next_link: The URL to get the next set of operation list results if there are any. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class OperationResult(msrest.serialization.Model): - """Operation Result Entity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: ID of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar status: status of the Operation result. Possible values include: "Succeeded", "Canceled", - "Failed", "Running". - :vartype status: str or ~kusto_management_client.models.Status - :param start_time: The operation start time. - :type start_time: ~datetime.datetime - :param end_time: The operation end time. - :type end_time: ~datetime.datetime - :param percent_complete: Percentage completed. - :type percent_complete: float - :param code: The code of the error. - :type code: str - :param message: The error message. - :type message: str - :param operation_kind: The kind of the operation. - :type operation_kind: str - :param operation_state: The state of the operation. - :type operation_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'percent_complete': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, - 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, - 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, - 'code': {'key': 'error.code', 'type': 'str'}, - 'message': {'key': 'error.message', 'type': 'str'}, - 'operation_kind': {'key': 'properties.operationKind', 'type': 'str'}, - 'operation_state': {'key': 'properties.operationState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResult, self).__init__(**kwargs) - self.id = None - self.name = None - self.status = None - self.start_time = kwargs.get('start_time', None) - self.end_time = kwargs.get('end_time', None) - self.percent_complete = kwargs.get('percent_complete', None) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - self.operation_kind = kwargs.get('operation_kind', None) - self.operation_state = kwargs.get('operation_state', None) - - -class OptimizedAutoscale(msrest.serialization.Model): - """A class that contains the optimized auto scale definition. - - All required parameters must be populated in order to send to Azure. - - :param version: Required. The version of the template defined, for instance 1. - :type version: int - :param is_enabled: Required. A boolean value that indicate if the optimized autoscale feature - is enabled or not. - :type is_enabled: bool - :param minimum: Required. Minimum allowed instances count. - :type minimum: int - :param maximum: Required. Maximum allowed instances count. - :type maximum: int - """ - - _validation = { - 'version': {'required': True}, - 'is_enabled': {'required': True}, - 'minimum': {'required': True}, - 'maximum': {'required': True}, - } - - _attribute_map = { - 'version': {'key': 'version', 'type': 'int'}, - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - 'minimum': {'key': 'minimum', 'type': 'int'}, - 'maximum': {'key': 'maximum', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(OptimizedAutoscale, self).__init__(**kwargs) - self.version = kwargs['version'] - self.is_enabled = kwargs['is_enabled'] - self.minimum = kwargs['minimum'] - self.maximum = kwargs['maximum'] - - -class OutboundNetworkDependenciesEndpoint(ProxyResource): - """Endpoints accessed for a common purpose that the Kusto Service Environment requires outbound network access to. - - 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 etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :param category: The type of service accessed by the Kusto Service Environment, e.g., Azure - Storage, Azure SQL Database, and Azure Active Directory. - :type category: str - :param endpoints: The endpoints that the Kusto Service Environment reaches the service at. - :type endpoints: list[~kusto_management_client.models.EndpointDependency] - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'category': {'key': 'properties.category', 'type': 'str'}, - 'endpoints': {'key': 'properties.endpoints', 'type': '[EndpointDependency]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OutboundNetworkDependenciesEndpoint, self).__init__(**kwargs) - self.etag = None - self.category = kwargs.get('category', None) - self.endpoints = kwargs.get('endpoints', None) - self.provisioning_state = None - - -class OutboundNetworkDependenciesEndpointListResult(msrest.serialization.Model): - """Collection of Outbound Environment Endpoints. - - 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 value: Required. Collection of resources. - :type value: list[~kusto_management_client.models.OutboundNetworkDependenciesEndpoint] - :ivar next_link: Link to next page of resources. - :vartype next_link: str - """ - - _validation = { - 'value': {'required': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OutboundNetworkDependenciesEndpoint]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OutboundNetworkDependenciesEndpointListResult, self).__init__(**kwargs) - self.value = kwargs['value'] - self.next_link = None - - -class PrivateEndpointConnection(ProxyResource): - """A private endpoint connection. - - 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: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~kusto_management_client.models.SystemData - :ivar private_endpoint: Private endpoint which the connection belongs to. - :vartype private_endpoint: ~kusto_management_client.models.PrivateEndpointProperty - :param private_link_service_connection_state: Connection State of the Private Endpoint - Connection. - :type private_link_service_connection_state: - ~kusto_management_client.models.PrivateLinkServiceConnectionStateProperty - :ivar group_id: Group id of the private endpoint. - :vartype group_id: str - :ivar provisioning_state: Provisioning state of the private endpoint. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'private_endpoint': {'readonly': True}, - 'group_id': {'readonly': True}, - 'provisioning_state': {'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'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.system_data = None - self.private_endpoint = None - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.group_id = None - self.provisioning_state = None - - -class PrivateEndpointConnectionListResult(msrest.serialization.Model): - """A list of private endpoint connections. - - :param value: Array of private endpoint connections. - :type value: list[~kusto_management_client.models.PrivateEndpointConnection] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateEndpointProperty(msrest.serialization.Model): - """Private endpoint which the connection belongs to. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource id of the private endpoint. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointProperty, self).__init__(**kwargs) - self.id = None - - -class PrivateLinkResource(Resource): - """A private link resource. - - 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: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~kusto_management_client.models.SystemData - :ivar group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :ivar required_zone_names: The private link resource required zone names. - :vartype required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - 'required_zone_names': {'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'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.system_data = None - self.group_id = None - self.required_members = None - self.required_zone_names = None - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - :param value: Array of private link resources. - :type value: list[~kusto_management_client.models.PrivateLinkResource] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class PrivateLinkServiceConnectionStateProperty(msrest.serialization.Model): - """Connection State of the Private Endpoint Connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param status: The private link service connection status. - :type status: str - :param description: The private link service connection description. - :type description: str - :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ - disconnect). - :vartype actions_required: str - """ - - _validation = { - 'actions_required': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = None - - -class ReadOnlyFollowingDatabase(Database): - """Class representing a read only following database. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the database.Constant filled by server. Possible values - include: "ReadWrite", "ReadOnlyFollowing". - :type kind: str or ~kusto_management_client.models.Kind - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - :ivar soft_delete_period: The time the data should be kept before it stops being accessible to - queries in TimeSpan. - :vartype soft_delete_period: ~datetime.timedelta - :param hot_cache_period: The time the data should be kept in cache for fast queries in - TimeSpan. - :type hot_cache_period: ~datetime.timedelta - :ivar statistics: The statistics of the database. - :vartype statistics: ~kusto_management_client.models.DatabaseStatistics - :ivar leader_cluster_resource_id: The name of the leader cluster. - :vartype leader_cluster_resource_id: str - :ivar attached_database_configuration_name: The name of the attached database configuration - cluster. - :vartype attached_database_configuration_name: str - :ivar principals_modification_kind: The principals modification kind of the database. Possible - values include: "Union", "Replace", "None". - :vartype principals_modification_kind: str or - ~kusto_management_client.models.PrincipalsModificationKind - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'soft_delete_period': {'readonly': True}, - 'statistics': {'readonly': True}, - 'leader_cluster_resource_id': {'readonly': True}, - 'attached_database_configuration_name': {'readonly': True}, - 'principals_modification_kind': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, - 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, - 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, - 'leader_cluster_resource_id': {'key': 'properties.leaderClusterResourceId', 'type': 'str'}, - 'attached_database_configuration_name': {'key': 'properties.attachedDatabaseConfigurationName', 'type': 'str'}, - 'principals_modification_kind': {'key': 'properties.principalsModificationKind', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReadOnlyFollowingDatabase, self).__init__(**kwargs) - self.kind = 'ReadOnlyFollowing' # type: str - self.provisioning_state = None - self.soft_delete_period = None - self.hot_cache_period = kwargs.get('hot_cache_period', None) - self.statistics = None - self.leader_cluster_resource_id = None - self.attached_database_configuration_name = None - self.principals_modification_kind = None - - -class ReadWriteDatabase(Database): - """Class representing a read write database. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the database.Constant filled by server. Possible values - include: "ReadWrite", "ReadOnlyFollowing". - :type kind: str or ~kusto_management_client.models.Kind - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - :param soft_delete_period: The time the data should be kept before it stops being accessible to - queries in TimeSpan. - :type soft_delete_period: ~datetime.timedelta - :param hot_cache_period: The time the data should be kept in cache for fast queries in - TimeSpan. - :type hot_cache_period: ~datetime.timedelta - :ivar statistics: The statistics of the database. - :vartype statistics: ~kusto_management_client.models.DatabaseStatistics - :ivar is_followed: Indicates whether the database is followed. - :vartype is_followed: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'statistics': {'readonly': True}, - 'is_followed': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, - 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, - 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, - 'is_followed': {'key': 'properties.isFollowed', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ReadWriteDatabase, self).__init__(**kwargs) - self.kind = 'ReadWrite' # type: str - self.provisioning_state = None - self.soft_delete_period = kwargs.get('soft_delete_period', None) - self.hot_cache_period = kwargs.get('hot_cache_period', None) - self.statistics = None - self.is_followed = None - - -class Script(ProxyResource): - """Class representing a database script. - - 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: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~kusto_management_client.models.SystemData - :param script_url: The url to the KQL script blob file. - :type script_url: str - :param script_url_sas_token: The SaS token. - :type script_url_sas_token: str - :param force_update_tag: A unique string. If changed the script will be applied again. - :type force_update_tag: str - :param continue_on_errors: Flag that indicates whether to continue if one of the command fails. - :type continue_on_errors: bool - :ivar provisioning_state: The provisioned state of the resource. Possible values include: - "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". - :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'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'}, - 'script_url': {'key': 'properties.scriptUrl', 'type': 'str'}, - 'script_url_sas_token': {'key': 'properties.scriptUrlSasToken', 'type': 'str'}, - 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, - 'continue_on_errors': {'key': 'properties.continueOnErrors', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Script, self).__init__(**kwargs) - self.system_data = None - self.script_url = kwargs.get('script_url', None) - self.script_url_sas_token = kwargs.get('script_url_sas_token', None) - self.force_update_tag = kwargs.get('force_update_tag', None) - self.continue_on_errors = kwargs.get('continue_on_errors', False) - self.provisioning_state = None - - -class ScriptCheckNameRequest(msrest.serialization.Model): - """A script name availability request. - - 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 name: Required. Script name. - :type name: str - :ivar type: The type of resource, Microsoft.Kusto/clusters/databases/scripts. Has constant - value: "Microsoft.Kusto/clusters/databases/scripts". - :vartype type: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True, 'constant': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - type = "Microsoft.Kusto/clusters/databases/scripts" - - def __init__( - self, - **kwargs - ): - super(ScriptCheckNameRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - - -class ScriptListResult(msrest.serialization.Model): - """The list Kusto database script operation response. - - :param value: The list of Kusto scripts. - :type value: list[~kusto_management_client.models.Script] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Script]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScriptListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class SkuDescription(msrest.serialization.Model): - """The Kusto SKU description of given resource type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The resource type. - :vartype resource_type: str - :ivar name: The name of the SKU. - :vartype name: str - :ivar tier: The tier of the SKU. - :vartype tier: str - :ivar locations: The set of locations that the SKU is available. - :vartype locations: list[str] - :ivar location_info: Locations and zones. - :vartype location_info: list[~kusto_management_client.models.SkuLocationInfoItem] - :ivar restrictions: The restrictions because of which SKU cannot be used. - :vartype restrictions: list[any] - """ - - _validation = { - 'resource_type': {'readonly': True}, - 'name': {'readonly': True}, - 'tier': {'readonly': True}, - 'locations': {'readonly': True}, - 'location_info': {'readonly': True}, - 'restrictions': {'readonly': True}, - } - - _attribute_map = { - 'resource_type': {'key': 'resourceType', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'locations': {'key': 'locations', 'type': '[str]'}, - 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfoItem]'}, - 'restrictions': {'key': 'restrictions', 'type': '[object]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuDescription, self).__init__(**kwargs) - self.resource_type = None - self.name = None - self.tier = None - self.locations = None - self.location_info = None - self.restrictions = None - - -class SkuDescriptionList(msrest.serialization.Model): - """The list of the EngagementFabric SKU descriptions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: SKU descriptions. - :vartype value: list[~kusto_management_client.models.SkuDescription] - """ - - _validation = { - 'value': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SkuDescription]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuDescriptionList, self).__init__(**kwargs) - self.value = None - - -class SkuLocationInfoItem(msrest.serialization.Model): - """The locations and zones info for SKU. - - All required parameters must be populated in order to send to Azure. - - :param location: Required. The available location of the SKU. - :type location: str - :param zones: The available zone of the SKU. - :type zones: list[str] - """ - - _validation = { - 'location': {'required': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'zones': {'key': 'zones', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(SkuLocationInfoItem, self).__init__(**kwargs) - self.location = kwargs['location'] - self.zones = kwargs.get('zones', 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 ~kusto_management_client.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 ~kusto_management_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class TableLevelSharingProperties(msrest.serialization.Model): - """Tables that will be included and excluded in the follower database. - - :param tables_to_include: List of tables to include in the follower database. - :type tables_to_include: list[str] - :param tables_to_exclude: List of tables to exclude from the follower database. - :type tables_to_exclude: list[str] - :param external_tables_to_include: List of external tables to include in the follower database. - :type external_tables_to_include: list[str] - :param external_tables_to_exclude: List of external tables exclude from the follower database. - :type external_tables_to_exclude: list[str] - :param materialized_views_to_include: List of materialized views to include in the follower - database. - :type materialized_views_to_include: list[str] - :param materialized_views_to_exclude: List of materialized views exclude from the follower - database. - :type materialized_views_to_exclude: list[str] - """ - - _attribute_map = { - 'tables_to_include': {'key': 'tablesToInclude', 'type': '[str]'}, - 'tables_to_exclude': {'key': 'tablesToExclude', 'type': '[str]'}, - 'external_tables_to_include': {'key': 'externalTablesToInclude', 'type': '[str]'}, - 'external_tables_to_exclude': {'key': 'externalTablesToExclude', 'type': '[str]'}, - 'materialized_views_to_include': {'key': 'materializedViewsToInclude', 'type': '[str]'}, - 'materialized_views_to_exclude': {'key': 'materializedViewsToExclude', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(TableLevelSharingProperties, self).__init__(**kwargs) - self.tables_to_include = kwargs.get('tables_to_include', None) - self.tables_to_exclude = kwargs.get('tables_to_exclude', None) - self.external_tables_to_include = kwargs.get('external_tables_to_include', None) - self.external_tables_to_exclude = kwargs.get('external_tables_to_exclude', None) - self.materialized_views_to_include = kwargs.get('materialized_views_to_include', None) - self.materialized_views_to_exclude = kwargs.get('materialized_views_to_exclude', None) - - -class TrustedExternalTenant(msrest.serialization.Model): - """Represents a tenant ID that is trusted by the cluster. - - :param value: GUID representing an external tenant. - :type value: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrustedExternalTenant, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class VirtualNetworkConfiguration(msrest.serialization.Model): - """A class that contains virtual network definition. - - All required parameters must be populated in order to send to Azure. - - :param subnet_id: Required. The subnet resource id. - :type subnet_id: str - :param engine_public_ip_id: Required. Engine service's public IP address resource id. - :type engine_public_ip_id: str - :param data_management_public_ip_id: Required. Data management's service public IP address - resource id. - :type data_management_public_ip_id: str - """ - - _validation = { - 'subnet_id': {'required': True}, - 'engine_public_ip_id': {'required': True}, - 'data_management_public_ip_id': {'required': True}, - } - - _attribute_map = { - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, - 'engine_public_ip_id': {'key': 'enginePublicIpId', 'type': 'str'}, - 'data_management_public_ip_id': {'key': 'dataManagementPublicIpId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VirtualNetworkConfiguration, self).__init__(**kwargs) - self.subnet_id = kwargs['subnet_id'] - self.engine_public_ip_id = kwargs['engine_public_ip_id'] - self.data_management_public_ip_id = kwargs['data_management_public_ip_id'] diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_models_py3.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_models_py3.py index 426241adbfbd..ad8a3d0a76a6 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_models_py3.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/models/_models_py3.py @@ -17,8 +17,8 @@ class AcceptedAudiences(msrest.serialization.Model): """Represents an accepted audience trusted by the cluster. - :param value: GUID or valid URL representing an accepted audience. - :type value: str + :ivar value: GUID or valid URL representing an accepted audience. + :vartype value: str """ _attribute_map = { @@ -31,6 +31,10 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword value: GUID or valid URL representing an accepted audience. + :paramtype value: str + """ super(AcceptedAudiences, self).__init__(**kwargs) self.value = value @@ -66,6 +70,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -103,6 +109,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -119,26 +127,26 @@ class AttachedDatabaseConfiguration(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str + :ivar location: Resource location. + :vartype location: str :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - :param database_name: The name of the database which you would like to attach, use * if you - want to follow all current and future databases. - :type database_name: str - :param cluster_resource_id: The resource id of the cluster where the databases you would like - to attach reside. - :type cluster_resource_id: str + :ivar database_name: The name of the database which you would like to attach, use * if you want + to follow all current and future databases. + :vartype database_name: str + :ivar cluster_resource_id: The resource id of the cluster where the databases you would like to + attach reside. + :vartype cluster_resource_id: str :ivar attached_database_names: The list of databases from the clusterResourceId which are currently attached to the cluster. :vartype attached_database_names: list[str] - :param default_principals_modification_kind: The default principals modification kind. Possible + :ivar default_principals_modification_kind: The default principals modification kind. Possible values include: "Union", "Replace", "None". - :type default_principals_modification_kind: str or + :vartype default_principals_modification_kind: str or ~kusto_management_client.models.DefaultPrincipalsModificationKind - :param table_level_sharing_properties: Table level sharing specifications. - :type table_level_sharing_properties: + :ivar table_level_sharing_properties: Table level sharing specifications. + :vartype table_level_sharing_properties: ~kusto_management_client.models.TableLevelSharingProperties """ @@ -173,6 +181,23 @@ def __init__( table_level_sharing_properties: Optional["TableLevelSharingProperties"] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword database_name: The name of the database which you would like to attach, use * if you + want to follow all current and future databases. + :paramtype database_name: str + :keyword cluster_resource_id: The resource id of the cluster where the databases you would like + to attach reside. + :paramtype cluster_resource_id: str + :keyword default_principals_modification_kind: The default principals modification kind. + Possible values include: "Union", "Replace", "None". + :paramtype default_principals_modification_kind: str or + ~kusto_management_client.models.DefaultPrincipalsModificationKind + :keyword table_level_sharing_properties: Table level sharing specifications. + :paramtype table_level_sharing_properties: + ~kusto_management_client.models.TableLevelSharingProperties + """ super(AttachedDatabaseConfiguration, self).__init__(**kwargs) self.location = location self.provisioning_state = None @@ -186,8 +211,8 @@ def __init__( class AttachedDatabaseConfigurationListResult(msrest.serialization.Model): """The list attached database configurations operation response. - :param value: The list of attached database configurations. - :type value: list[~kusto_management_client.models.AttachedDatabaseConfiguration] + :ivar value: The list of attached database configurations. + :vartype value: list[~kusto_management_client.models.AttachedDatabaseConfiguration] """ _attribute_map = { @@ -200,6 +225,10 @@ def __init__( value: Optional[List["AttachedDatabaseConfiguration"]] = None, **kwargs ): + """ + :keyword value: The list of attached database configurations. + :paramtype value: list[~kusto_management_client.models.AttachedDatabaseConfiguration] + """ super(AttachedDatabaseConfigurationListResult, self).__init__(**kwargs) self.value = value @@ -211,8 +240,8 @@ class AttachedDatabaseConfigurationsCheckNameRequest(msrest.serialization.Model) All required parameters must be populated in order to send to Azure. - :param name: Required. Attached database resource name. - :type name: str + :ivar name: Required. Attached database resource name. + :vartype name: str :ivar type: The type of resource, for instance Microsoft.Kusto/clusters/attachedDatabaseConfigurations. Has constant value: "Microsoft.Kusto/clusters/attachedDatabaseConfigurations". @@ -237,6 +266,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Attached database resource name. + :paramtype name: str + """ super(AttachedDatabaseConfigurationsCheckNameRequest, self).__init__(**kwargs) self.name = name @@ -246,15 +279,14 @@ class AzureCapacity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param scale_type: Required. Scale type. Possible values include: "automatic", "manual", - "none". - :type scale_type: str or ~kusto_management_client.models.AzureScaleType - :param minimum: Required. Minimum allowed capacity. - :type minimum: int - :param maximum: Required. Maximum allowed capacity. - :type maximum: int - :param default: Required. The default capacity that would be used. - :type default: int + :ivar scale_type: Required. Scale type. Possible values include: "automatic", "manual", "none". + :vartype scale_type: str or ~kusto_management_client.models.AzureScaleType + :ivar minimum: Required. Minimum allowed capacity. + :vartype minimum: int + :ivar maximum: Required. Maximum allowed capacity. + :vartype maximum: int + :ivar default: Required. The default capacity that would be used. + :vartype default: int """ _validation = { @@ -280,6 +312,17 @@ def __init__( default: int, **kwargs ): + """ + :keyword scale_type: Required. Scale type. Possible values include: "automatic", "manual", + "none". + :paramtype scale_type: str or ~kusto_management_client.models.AzureScaleType + :keyword minimum: Required. Minimum allowed capacity. + :paramtype minimum: int + :keyword maximum: Required. Maximum allowed capacity. + :paramtype maximum: int + :keyword default: Required. The default capacity that would be used. + :paramtype default: int + """ super(AzureCapacity, self).__init__(**kwargs) self.scale_type = scale_type self.minimum = minimum @@ -290,12 +333,12 @@ def __init__( class AzureResourceSku(msrest.serialization.Model): """Azure resource SKU definition. - :param resource_type: Resource Namespace and Type. - :type resource_type: str - :param sku: The SKU details. - :type sku: ~kusto_management_client.models.AzureSku - :param capacity: The number of instances of the cluster. - :type capacity: ~kusto_management_client.models.AzureCapacity + :ivar resource_type: Resource Namespace and Type. + :vartype resource_type: str + :ivar sku: The SKU details. + :vartype sku: ~kusto_management_client.models.AzureSku + :ivar capacity: The number of instances of the cluster. + :vartype capacity: ~kusto_management_client.models.AzureCapacity """ _attribute_map = { @@ -312,6 +355,14 @@ def __init__( capacity: Optional["AzureCapacity"] = None, **kwargs ): + """ + :keyword resource_type: Resource Namespace and Type. + :paramtype resource_type: str + :keyword sku: The SKU details. + :paramtype sku: ~kusto_management_client.models.AzureSku + :keyword capacity: The number of instances of the cluster. + :paramtype capacity: ~kusto_management_client.models.AzureCapacity + """ super(AzureResourceSku, self).__init__(**kwargs) self.resource_type = resource_type self.sku = sku @@ -323,7 +374,7 @@ class AzureSku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. SKU name. Possible values include: "Standard_DS13_v2+1TB_PS", + :ivar name: Required. SKU name. Possible values include: "Standard_DS13_v2+1TB_PS", "Standard_DS13_v2+2TB_PS", "Standard_DS14_v2+3TB_PS", "Standard_DS14_v2+4TB_PS", "Standard_D13_v2", "Standard_D14_v2", "Standard_L8s", "Standard_L16s", "Standard_L8s_v2", "Standard_L16s_v2", "Standard_D11_v2", "Standard_D12_v2", "Standard_L4s", "Dev(No @@ -331,11 +382,11 @@ class AzureSku(msrest.serialization.Model): "Standard_E4a_v4", "Standard_E8a_v4", "Standard_E16a_v4", "Standard_E8as_v4+1TB_PS", "Standard_E8as_v4+2TB_PS", "Standard_E16as_v4+3TB_PS", "Standard_E16as_v4+4TB_PS", "Dev(No SLA)_Standard_E2a_v4". - :type name: str or ~kusto_management_client.models.AzureSkuName - :param capacity: The number of instances of the cluster. - :type capacity: int - :param tier: Required. SKU tier. Possible values include: "Basic", "Standard". - :type tier: str or ~kusto_management_client.models.AzureSkuTier + :vartype name: str or ~kusto_management_client.models.AzureSkuName + :ivar capacity: The number of instances of the cluster. + :vartype capacity: int + :ivar tier: Required. SKU tier. Possible values include: "Basic", "Standard". + :vartype tier: str or ~kusto_management_client.models.AzureSkuTier """ _validation = { @@ -357,6 +408,21 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Required. SKU name. Possible values include: "Standard_DS13_v2+1TB_PS", + "Standard_DS13_v2+2TB_PS", "Standard_DS14_v2+3TB_PS", "Standard_DS14_v2+4TB_PS", + "Standard_D13_v2", "Standard_D14_v2", "Standard_L8s", "Standard_L16s", "Standard_L8s_v2", + "Standard_L16s_v2", "Standard_D11_v2", "Standard_D12_v2", "Standard_L4s", "Dev(No + SLA)_Standard_D11_v2", "Standard_E64i_v3", "Standard_E80ids_v4", "Standard_E2a_v4", + "Standard_E4a_v4", "Standard_E8a_v4", "Standard_E16a_v4", "Standard_E8as_v4+1TB_PS", + "Standard_E8as_v4+2TB_PS", "Standard_E16as_v4+3TB_PS", "Standard_E16as_v4+4TB_PS", "Dev(No + SLA)_Standard_E2a_v4". + :paramtype name: str or ~kusto_management_client.models.AzureSkuName + :keyword capacity: The number of instances of the cluster. + :paramtype capacity: int + :keyword tier: Required. SKU tier. Possible values include: "Basic", "Standard". + :paramtype tier: str or ~kusto_management_client.models.AzureSkuTier + """ super(AzureSku, self).__init__(**kwargs) self.name = name self.capacity = capacity @@ -368,12 +434,12 @@ class CheckNameRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Resource name. - :type name: str - :param type: Required. The type of resource, for instance Microsoft.Kusto/clusters/databases. + :ivar name: Required. Resource name. + :vartype name: str + :ivar type: Required. The type of resource, for instance Microsoft.Kusto/clusters/databases. Possible values include: "Microsoft.Kusto/clusters/databases", "Microsoft.Kusto/clusters/attachedDatabaseConfigurations". - :type type: str or ~kusto_management_client.models.Type + :vartype type: str or ~kusto_management_client.models.Type """ _validation = { @@ -393,6 +459,14 @@ def __init__( type: Union[str, "Type"], **kwargs ): + """ + :keyword name: Required. Resource name. + :paramtype name: str + :keyword type: Required. The type of resource, for instance Microsoft.Kusto/clusters/databases. + Possible values include: "Microsoft.Kusto/clusters/databases", + "Microsoft.Kusto/clusters/attachedDatabaseConfigurations". + :paramtype type: str or ~kusto_management_client.models.Type + """ super(CheckNameRequest, self).__init__(**kwargs) self.name = name self.type = type @@ -401,16 +475,16 @@ def __init__( class CheckNameResult(msrest.serialization.Model): """The result returned from a check name availability request. - :param name_available: Specifies a Boolean value that indicates if the name is available. - :type name_available: bool - :param name: The name that was checked. - :type name: str - :param message: Message indicating an unavailable name due to a conflict, or a description of + :ivar name_available: Specifies a Boolean value that indicates if the name is available. + :vartype name_available: bool + :ivar name: The name that was checked. + :vartype name: str + :ivar message: Message indicating an unavailable name due to a conflict, or a description of the naming rules that are violated. - :type message: str - :param reason: Message providing the reason why the given name is invalid. Possible values + :vartype message: str + :ivar reason: Message providing the reason why the given name is invalid. Possible values include: "Invalid", "AlreadyExists". - :type reason: str or ~kusto_management_client.models.Reason + :vartype reason: str or ~kusto_management_client.models.Reason """ _attribute_map = { @@ -429,6 +503,18 @@ def __init__( reason: Optional[Union[str, "Reason"]] = None, **kwargs ): + """ + :keyword name_available: Specifies a Boolean value that indicates if the name is available. + :paramtype name_available: bool + :keyword name: The name that was checked. + :paramtype name: str + :keyword message: Message indicating an unavailable name due to a conflict, or a description of + the naming rules that are violated. + :paramtype message: str + :keyword reason: Message providing the reason why the given name is invalid. Possible values + include: "Invalid", "AlreadyExists". + :paramtype reason: str or ~kusto_management_client.models.Reason + """ super(CheckNameResult, self).__init__(**kwargs) self.name_available = name_available self.name = name @@ -439,17 +525,17 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from Kusto. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for displaying in a - user interface. - :type message: str - :param target: The target of the particular error. For example, the name of the property in + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for displaying in a user + interface. + :vartype message: str + :ivar target: The target of the particular error. For example, the name of the property in error. - :type target: str - :param details: A list of additional details about the error. - :type details: list[~kusto_management_client.models.CloudErrorBody] + :vartype target: str + :ivar details: A list of additional details about the error. + :vartype details: list[~kusto_management_client.models.CloudErrorBody] """ _attribute_map = { @@ -468,6 +554,19 @@ def __init__( details: Optional[List["CloudErrorBody"]] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for displaying in a + user interface. + :paramtype message: str + :keyword target: The target of the particular error. For example, the name of the property in + error. + :paramtype target: str + :keyword details: A list of additional details about the error. + :paramtype details: list[~kusto_management_client.models.CloudErrorBody] + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -490,10 +589,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -518,6 +617,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -538,18 +643,18 @@ class Cluster(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :param sku: Required. The SKU of the cluster. - :type sku: ~kusto_management_client.models.AzureSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar sku: Required. The SKU of the cluster. + :vartype sku: ~kusto_management_client.models.AzureSku :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~kusto_management_client.models.SystemData - :param zones: The availability zones of the cluster. - :type zones: list[str] - :param identity: The identity of the cluster, if configured. - :type identity: ~kusto_management_client.models.Identity + :ivar zones: The availability zones of the cluster. + :vartype zones: list[str] + :ivar identity: The identity of the cluster, if configured. + :vartype identity: ~kusto_management_client.models.Identity :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", @@ -564,50 +669,49 @@ class Cluster(TrackedResource): :vartype data_ingestion_uri: str :ivar state_reason: The reason for the cluster's current state. :vartype state_reason: str - :param trusted_external_tenants: The cluster's external tenants. - :type trusted_external_tenants: list[~kusto_management_client.models.TrustedExternalTenant] - :param optimized_autoscale: Optimized auto scale definition. - :type optimized_autoscale: ~kusto_management_client.models.OptimizedAutoscale - :param enable_disk_encryption: A boolean value that indicates if the cluster's disks are + :ivar trusted_external_tenants: The cluster's external tenants. + :vartype trusted_external_tenants: list[~kusto_management_client.models.TrustedExternalTenant] + :ivar optimized_autoscale: Optimized auto scale definition. + :vartype optimized_autoscale: ~kusto_management_client.models.OptimizedAutoscale + :ivar enable_disk_encryption: A boolean value that indicates if the cluster's disks are encrypted. - :type enable_disk_encryption: bool - :param enable_streaming_ingest: A boolean value that indicates if the streaming ingest is + :vartype enable_disk_encryption: bool + :ivar enable_streaming_ingest: A boolean value that indicates if the streaming ingest is enabled. - :type enable_streaming_ingest: bool - :param virtual_network_configuration: Virtual network definition. - :type virtual_network_configuration: + :vartype enable_streaming_ingest: bool + :ivar virtual_network_configuration: Virtual network definition. + :vartype virtual_network_configuration: ~kusto_management_client.models.VirtualNetworkConfiguration - :param key_vault_properties: KeyVault properties for the cluster encryption. - :type key_vault_properties: ~kusto_management_client.models.KeyVaultProperties - :param enable_purge: A boolean value that indicates if the purge operations are enabled. - :type enable_purge: bool + :ivar key_vault_properties: KeyVault properties for the cluster encryption. + :vartype key_vault_properties: ~kusto_management_client.models.KeyVaultProperties + :ivar enable_purge: A boolean value that indicates if the purge operations are enabled. + :vartype enable_purge: bool :ivar language_extensions: List of the cluster's language extensions. :vartype language_extensions: ~kusto_management_client.models.LanguageExtensionsList - :param enable_double_encryption: A boolean value that indicates if double encryption is - enabled. - :type enable_double_encryption: bool - :param public_network_access: Public network access to the cluster is enabled by default. When + :ivar enable_double_encryption: A boolean value that indicates if double encryption is enabled. + :vartype enable_double_encryption: bool + :ivar public_network_access: Public network access to the cluster is enabled by default. When disabled, only private endpoint connection to the cluster is allowed. Possible values include: "Enabled", "Disabled". Default value: "Enabled". - :type public_network_access: str or ~kusto_management_client.models.PublicNetworkAccess - :param allowed_ip_range_list: The list of ips in the format of CIDR allowed to connect to the + :vartype public_network_access: str or ~kusto_management_client.models.PublicNetworkAccess + :ivar allowed_ip_range_list: The list of ips in the format of CIDR allowed to connect to the cluster. - :type allowed_ip_range_list: list[str] - :param engine_type: The engine type. Possible values include: "V2", "V3". Default value: "V3". - :type engine_type: str or ~kusto_management_client.models.EngineType - :param accepted_audiences: The cluster's accepted audiences. - :type accepted_audiences: list[~kusto_management_client.models.AcceptedAudiences] - :param enable_auto_stop: A boolean value that indicates if the cluster could be automatically + :vartype allowed_ip_range_list: list[str] + :ivar engine_type: The engine type. Possible values include: "V2", "V3". Default value: "V3". + :vartype engine_type: str or ~kusto_management_client.models.EngineType + :ivar accepted_audiences: The cluster's accepted audiences. + :vartype accepted_audiences: list[~kusto_management_client.models.AcceptedAudiences] + :ivar enable_auto_stop: A boolean value that indicates if the cluster could be automatically stopped (due to lack of data or no activity for many days). - :type enable_auto_stop: bool - :param restrict_outbound_network_access: Whether or not to restrict outbound network access. + :vartype enable_auto_stop: bool + :ivar restrict_outbound_network_access: Whether or not to restrict outbound network access. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type restrict_outbound_network_access: str or + :vartype restrict_outbound_network_access: str or ~kusto_management_client.models.ClusterNetworkAccessFlag - :param allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from + :ivar allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from Cluster. - :type allowed_fqdn_list: list[str] + :vartype allowed_fqdn_list: list[str] """ _validation = { @@ -685,6 +789,62 @@ def __init__( allowed_fqdn_list: Optional[List[str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword sku: Required. The SKU of the cluster. + :paramtype sku: ~kusto_management_client.models.AzureSku + :keyword zones: The availability zones of the cluster. + :paramtype zones: list[str] + :keyword identity: The identity of the cluster, if configured. + :paramtype identity: ~kusto_management_client.models.Identity + :keyword trusted_external_tenants: The cluster's external tenants. + :paramtype trusted_external_tenants: + list[~kusto_management_client.models.TrustedExternalTenant] + :keyword optimized_autoscale: Optimized auto scale definition. + :paramtype optimized_autoscale: ~kusto_management_client.models.OptimizedAutoscale + :keyword enable_disk_encryption: A boolean value that indicates if the cluster's disks are + encrypted. + :paramtype enable_disk_encryption: bool + :keyword enable_streaming_ingest: A boolean value that indicates if the streaming ingest is + enabled. + :paramtype enable_streaming_ingest: bool + :keyword virtual_network_configuration: Virtual network definition. + :paramtype virtual_network_configuration: + ~kusto_management_client.models.VirtualNetworkConfiguration + :keyword key_vault_properties: KeyVault properties for the cluster encryption. + :paramtype key_vault_properties: ~kusto_management_client.models.KeyVaultProperties + :keyword enable_purge: A boolean value that indicates if the purge operations are enabled. + :paramtype enable_purge: bool + :keyword enable_double_encryption: A boolean value that indicates if double encryption is + enabled. + :paramtype enable_double_encryption: bool + :keyword public_network_access: Public network access to the cluster is enabled by default. + When disabled, only private endpoint connection to the cluster is allowed. Possible values + include: "Enabled", "Disabled". Default value: "Enabled". + :paramtype public_network_access: str or ~kusto_management_client.models.PublicNetworkAccess + :keyword allowed_ip_range_list: The list of ips in the format of CIDR allowed to connect to the + cluster. + :paramtype allowed_ip_range_list: list[str] + :keyword engine_type: The engine type. Possible values include: "V2", "V3". Default value: + "V3". + :paramtype engine_type: str or ~kusto_management_client.models.EngineType + :keyword accepted_audiences: The cluster's accepted audiences. + :paramtype accepted_audiences: list[~kusto_management_client.models.AcceptedAudiences] + :keyword enable_auto_stop: A boolean value that indicates if the cluster could be automatically + stopped (due to lack of data or no activity for many days). + :paramtype enable_auto_stop: bool + :keyword restrict_outbound_network_access: Whether or not to restrict outbound network access. + Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: + "Enabled", "Disabled". + :paramtype restrict_outbound_network_access: str or + ~kusto_management_client.models.ClusterNetworkAccessFlag + :keyword allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from + Cluster. + :paramtype allowed_fqdn_list: list[str] + """ super(Cluster, self).__init__(tags=tags, location=location, **kwargs) self.sku = sku self.system_data = None @@ -721,8 +881,8 @@ class ClusterCheckNameRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Cluster name. - :type name: str + :ivar name: Required. Cluster name. + :vartype name: str :ivar type: The type of resource, Microsoft.Kusto/clusters. Has constant value: "Microsoft.Kusto/clusters". :vartype type: str @@ -746,6 +906,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Cluster name. + :paramtype name: str + """ super(ClusterCheckNameRequest, self).__init__(**kwargs) self.name = name @@ -753,8 +917,8 @@ def __init__( class ClusterListResult(msrest.serialization.Model): """The list Kusto clusters operation response. - :param value: The list of Kusto clusters. - :type value: list[~kusto_management_client.models.Cluster] + :ivar value: The list of Kusto clusters. + :vartype value: list[~kusto_management_client.models.Cluster] """ _attribute_map = { @@ -767,6 +931,10 @@ def __init__( value: Optional[List["Cluster"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto clusters. + :paramtype value: list[~kusto_management_client.models.Cluster] + """ super(ClusterListResult, self).__init__(**kwargs) self.value = value @@ -784,16 +952,16 @@ class ClusterPrincipalAssignment(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param principal_id: The principal ID assigned to the cluster principal. It can be a user - email, application ID, or security group name. - :type principal_id: str - :param role: Cluster principal role. Possible values include: "AllDatabasesAdmin", + :ivar principal_id: The principal ID assigned to the cluster principal. It can be a user email, + application ID, or security group name. + :vartype principal_id: str + :ivar role: Cluster principal role. Possible values include: "AllDatabasesAdmin", "AllDatabasesViewer". - :type role: str or ~kusto_management_client.models.ClusterPrincipalRole - :param tenant_id: The tenant id of the principal. - :type tenant_id: str - :param principal_type: Principal type. Possible values include: "App", "Group", "User". - :type principal_type: str or ~kusto_management_client.models.PrincipalType + :vartype role: str or ~kusto_management_client.models.ClusterPrincipalRole + :ivar tenant_id: The tenant id of the principal. + :vartype tenant_id: str + :ivar principal_type: Principal type. Possible values include: "App", "Group", "User". + :vartype principal_type: str or ~kusto_management_client.models.PrincipalType :ivar tenant_name: The tenant name of the principal. :vartype tenant_name: str :ivar principal_name: The principal name. @@ -834,6 +1002,18 @@ def __init__( principal_type: Optional[Union[str, "PrincipalType"]] = None, **kwargs ): + """ + :keyword principal_id: The principal ID assigned to the cluster principal. It can be a user + email, application ID, or security group name. + :paramtype principal_id: str + :keyword role: Cluster principal role. Possible values include: "AllDatabasesAdmin", + "AllDatabasesViewer". + :paramtype role: str or ~kusto_management_client.models.ClusterPrincipalRole + :keyword tenant_id: The tenant id of the principal. + :paramtype tenant_id: str + :keyword principal_type: Principal type. Possible values include: "App", "Group", "User". + :paramtype principal_type: str or ~kusto_management_client.models.PrincipalType + """ super(ClusterPrincipalAssignment, self).__init__(**kwargs) self.principal_id = principal_id self.role = role @@ -851,8 +1031,8 @@ class ClusterPrincipalAssignmentCheckNameRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Principal Assignment resource name. - :type name: str + :ivar name: Required. Principal Assignment resource name. + :vartype name: str :ivar type: The type of resource, Microsoft.Kusto/clusters/principalAssignments. Has constant value: "Microsoft.Kusto/clusters/principalAssignments". :vartype type: str @@ -876,6 +1056,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Principal Assignment resource name. + :paramtype name: str + """ super(ClusterPrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) self.name = name @@ -883,8 +1067,8 @@ def __init__( class ClusterPrincipalAssignmentListResult(msrest.serialization.Model): """The list Kusto cluster principal assignments operation response. - :param value: The list of Kusto cluster principal assignments. - :type value: list[~kusto_management_client.models.ClusterPrincipalAssignment] + :ivar value: The list of Kusto cluster principal assignments. + :vartype value: list[~kusto_management_client.models.ClusterPrincipalAssignment] """ _attribute_map = { @@ -897,6 +1081,10 @@ def __init__( value: Optional[List["ClusterPrincipalAssignment"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto cluster principal assignments. + :paramtype value: list[~kusto_management_client.models.ClusterPrincipalAssignment] + """ super(ClusterPrincipalAssignmentListResult, self).__init__(**kwargs) self.value = value @@ -914,14 +1102,14 @@ class ClusterUpdate(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Resource location. - :type location: str - :param sku: The SKU of the cluster. - :type sku: ~kusto_management_client.models.AzureSku - :param identity: The identity of the cluster, if configured. - :type identity: ~kusto_management_client.models.Identity + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Resource location. + :vartype location: str + :ivar sku: The SKU of the cluster. + :vartype sku: ~kusto_management_client.models.AzureSku + :ivar identity: The identity of the cluster, if configured. + :vartype identity: ~kusto_management_client.models.Identity :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". :vartype state: str or ~kusto_management_client.models.State @@ -934,50 +1122,49 @@ class ClusterUpdate(Resource): :vartype data_ingestion_uri: str :ivar state_reason: The reason for the cluster's current state. :vartype state_reason: str - :param trusted_external_tenants: The cluster's external tenants. - :type trusted_external_tenants: list[~kusto_management_client.models.TrustedExternalTenant] - :param optimized_autoscale: Optimized auto scale definition. - :type optimized_autoscale: ~kusto_management_client.models.OptimizedAutoscale - :param enable_disk_encryption: A boolean value that indicates if the cluster's disks are + :ivar trusted_external_tenants: The cluster's external tenants. + :vartype trusted_external_tenants: list[~kusto_management_client.models.TrustedExternalTenant] + :ivar optimized_autoscale: Optimized auto scale definition. + :vartype optimized_autoscale: ~kusto_management_client.models.OptimizedAutoscale + :ivar enable_disk_encryption: A boolean value that indicates if the cluster's disks are encrypted. - :type enable_disk_encryption: bool - :param enable_streaming_ingest: A boolean value that indicates if the streaming ingest is + :vartype enable_disk_encryption: bool + :ivar enable_streaming_ingest: A boolean value that indicates if the streaming ingest is enabled. - :type enable_streaming_ingest: bool - :param virtual_network_configuration: Virtual network definition. - :type virtual_network_configuration: + :vartype enable_streaming_ingest: bool + :ivar virtual_network_configuration: Virtual network definition. + :vartype virtual_network_configuration: ~kusto_management_client.models.VirtualNetworkConfiguration - :param key_vault_properties: KeyVault properties for the cluster encryption. - :type key_vault_properties: ~kusto_management_client.models.KeyVaultProperties - :param enable_purge: A boolean value that indicates if the purge operations are enabled. - :type enable_purge: bool + :ivar key_vault_properties: KeyVault properties for the cluster encryption. + :vartype key_vault_properties: ~kusto_management_client.models.KeyVaultProperties + :ivar enable_purge: A boolean value that indicates if the purge operations are enabled. + :vartype enable_purge: bool :ivar language_extensions: List of the cluster's language extensions. :vartype language_extensions: ~kusto_management_client.models.LanguageExtensionsList - :param enable_double_encryption: A boolean value that indicates if double encryption is - enabled. - :type enable_double_encryption: bool - :param public_network_access: Public network access to the cluster is enabled by default. When + :ivar enable_double_encryption: A boolean value that indicates if double encryption is enabled. + :vartype enable_double_encryption: bool + :ivar public_network_access: Public network access to the cluster is enabled by default. When disabled, only private endpoint connection to the cluster is allowed. Possible values include: "Enabled", "Disabled". Default value: "Enabled". - :type public_network_access: str or ~kusto_management_client.models.PublicNetworkAccess - :param allowed_ip_range_list: The list of ips in the format of CIDR allowed to connect to the + :vartype public_network_access: str or ~kusto_management_client.models.PublicNetworkAccess + :ivar allowed_ip_range_list: The list of ips in the format of CIDR allowed to connect to the cluster. - :type allowed_ip_range_list: list[str] - :param engine_type: The engine type. Possible values include: "V2", "V3". Default value: "V3". - :type engine_type: str or ~kusto_management_client.models.EngineType - :param accepted_audiences: The cluster's accepted audiences. - :type accepted_audiences: list[~kusto_management_client.models.AcceptedAudiences] - :param enable_auto_stop: A boolean value that indicates if the cluster could be automatically + :vartype allowed_ip_range_list: list[str] + :ivar engine_type: The engine type. Possible values include: "V2", "V3". Default value: "V3". + :vartype engine_type: str or ~kusto_management_client.models.EngineType + :ivar accepted_audiences: The cluster's accepted audiences. + :vartype accepted_audiences: list[~kusto_management_client.models.AcceptedAudiences] + :ivar enable_auto_stop: A boolean value that indicates if the cluster could be automatically stopped (due to lack of data or no activity for many days). - :type enable_auto_stop: bool - :param restrict_outbound_network_access: Whether or not to restrict outbound network access. + :vartype enable_auto_stop: bool + :ivar restrict_outbound_network_access: Whether or not to restrict outbound network access. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: "Enabled", "Disabled". - :type restrict_outbound_network_access: str or + :vartype restrict_outbound_network_access: str or ~kusto_management_client.models.ClusterNetworkAccessFlag - :param allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from + :ivar allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from Cluster. - :type allowed_fqdn_list: list[str] + :vartype allowed_fqdn_list: list[str] """ _validation = { @@ -1047,6 +1234,60 @@ def __init__( allowed_fqdn_list: Optional[List[str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Resource location. + :paramtype location: str + :keyword sku: The SKU of the cluster. + :paramtype sku: ~kusto_management_client.models.AzureSku + :keyword identity: The identity of the cluster, if configured. + :paramtype identity: ~kusto_management_client.models.Identity + :keyword trusted_external_tenants: The cluster's external tenants. + :paramtype trusted_external_tenants: + list[~kusto_management_client.models.TrustedExternalTenant] + :keyword optimized_autoscale: Optimized auto scale definition. + :paramtype optimized_autoscale: ~kusto_management_client.models.OptimizedAutoscale + :keyword enable_disk_encryption: A boolean value that indicates if the cluster's disks are + encrypted. + :paramtype enable_disk_encryption: bool + :keyword enable_streaming_ingest: A boolean value that indicates if the streaming ingest is + enabled. + :paramtype enable_streaming_ingest: bool + :keyword virtual_network_configuration: Virtual network definition. + :paramtype virtual_network_configuration: + ~kusto_management_client.models.VirtualNetworkConfiguration + :keyword key_vault_properties: KeyVault properties for the cluster encryption. + :paramtype key_vault_properties: ~kusto_management_client.models.KeyVaultProperties + :keyword enable_purge: A boolean value that indicates if the purge operations are enabled. + :paramtype enable_purge: bool + :keyword enable_double_encryption: A boolean value that indicates if double encryption is + enabled. + :paramtype enable_double_encryption: bool + :keyword public_network_access: Public network access to the cluster is enabled by default. + When disabled, only private endpoint connection to the cluster is allowed. Possible values + include: "Enabled", "Disabled". Default value: "Enabled". + :paramtype public_network_access: str or ~kusto_management_client.models.PublicNetworkAccess + :keyword allowed_ip_range_list: The list of ips in the format of CIDR allowed to connect to the + cluster. + :paramtype allowed_ip_range_list: list[str] + :keyword engine_type: The engine type. Possible values include: "V2", "V3". Default value: + "V3". + :paramtype engine_type: str or ~kusto_management_client.models.EngineType + :keyword accepted_audiences: The cluster's accepted audiences. + :paramtype accepted_audiences: list[~kusto_management_client.models.AcceptedAudiences] + :keyword enable_auto_stop: A boolean value that indicates if the cluster could be automatically + stopped (due to lack of data or no activity for many days). + :paramtype enable_auto_stop: bool + :keyword restrict_outbound_network_access: Whether or not to restrict outbound network access. + Value is optional but if passed in, must be 'Enabled' or 'Disabled'. Possible values include: + "Enabled", "Disabled". + :paramtype restrict_outbound_network_access: str or + ~kusto_management_client.models.ClusterNetworkAccessFlag + :keyword allowed_fqdn_list: List of allowed FQDNs(Fully Qualified Domain Name) for egress from + Cluster. + :paramtype allowed_fqdn_list: list[str] + """ super(ClusterUpdate, self).__init__(**kwargs) self.tags = tags self.location = location @@ -1100,6 +1341,8 @@ def __init__( self, **kwargs ): + """ + """ super(ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -1123,11 +1366,11 @@ class Database(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the database.Constant filled by server. Possible values - include: "ReadWrite", "ReadOnlyFollowing". - :type kind: str or ~kusto_management_client.models.Kind + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the database.Constant filled by server. Possible values include: + "ReadWrite", "ReadOnlyFollowing". + :vartype kind: str or ~kusto_management_client.models.Kind """ _validation = { @@ -1155,6 +1398,10 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + """ super(Database, self).__init__(**kwargs) self.location = location self.kind = 'Database' # type: str @@ -1163,8 +1410,8 @@ def __init__( class DatabaseListResult(msrest.serialization.Model): """The list Kusto databases operation response. - :param value: The list of Kusto databases. - :type value: list[~kusto_management_client.models.Database] + :ivar value: The list of Kusto databases. + :vartype value: list[~kusto_management_client.models.Database] """ _attribute_map = { @@ -1177,6 +1424,10 @@ def __init__( value: Optional[List["Database"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto databases. + :paramtype value: list[~kusto_management_client.models.Database] + """ super(DatabaseListResult, self).__init__(**kwargs) self.value = value @@ -1188,20 +1439,19 @@ class DatabasePrincipal(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param role: Required. Database principal role. Possible values include: "Admin", "Ingestor", + :ivar role: Required. Database principal role. Possible values include: "Admin", "Ingestor", "Monitor", "User", "UnrestrictedViewer", "Viewer". - :type role: str or ~kusto_management_client.models.DatabasePrincipalRole - :param name: Required. Database principal name. - :type name: str - :param type: Required. Database principal type. Possible values include: "App", "Group", - "User". - :type type: str or ~kusto_management_client.models.DatabasePrincipalType - :param fqn: Database principal fully qualified name. - :type fqn: str - :param email: Database principal email if exists. - :type email: str - :param app_id: Application id - relevant only for application principal type. - :type app_id: str + :vartype role: str or ~kusto_management_client.models.DatabasePrincipalRole + :ivar name: Required. Database principal name. + :vartype name: str + :ivar type: Required. Database principal type. Possible values include: "App", "Group", "User". + :vartype type: str or ~kusto_management_client.models.DatabasePrincipalType + :ivar fqn: Database principal fully qualified name. + :vartype fqn: str + :ivar email: Database principal email if exists. + :vartype email: str + :ivar app_id: Application id - relevant only for application principal type. + :vartype app_id: str :ivar tenant_name: The tenant name of the principal. :vartype tenant_name: str """ @@ -1234,6 +1484,22 @@ def __init__( app_id: Optional[str] = None, **kwargs ): + """ + :keyword role: Required. Database principal role. Possible values include: "Admin", "Ingestor", + "Monitor", "User", "UnrestrictedViewer", "Viewer". + :paramtype role: str or ~kusto_management_client.models.DatabasePrincipalRole + :keyword name: Required. Database principal name. + :paramtype name: str + :keyword type: Required. Database principal type. Possible values include: "App", "Group", + "User". + :paramtype type: str or ~kusto_management_client.models.DatabasePrincipalType + :keyword fqn: Database principal fully qualified name. + :paramtype fqn: str + :keyword email: Database principal email if exists. + :paramtype email: str + :keyword app_id: Application id - relevant only for application principal type. + :paramtype app_id: str + """ super(DatabasePrincipal, self).__init__(**kwargs) self.role = role self.name = name @@ -1257,16 +1523,16 @@ class DatabasePrincipalAssignment(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param principal_id: The principal ID assigned to the database principal. It can be a user + :ivar principal_id: The principal ID assigned to the database principal. It can be a user email, application ID, or security group name. - :type principal_id: str - :param role: Database principal role. Possible values include: "Admin", "Ingestor", "Monitor", + :vartype principal_id: str + :ivar role: Database principal role. Possible values include: "Admin", "Ingestor", "Monitor", "User", "UnrestrictedViewer", "Viewer". - :type role: str or ~kusto_management_client.models.DatabasePrincipalRole - :param tenant_id: The tenant id of the principal. - :type tenant_id: str - :param principal_type: Principal type. Possible values include: "App", "Group", "User". - :type principal_type: str or ~kusto_management_client.models.PrincipalType + :vartype role: str or ~kusto_management_client.models.DatabasePrincipalRole + :ivar tenant_id: The tenant id of the principal. + :vartype tenant_id: str + :ivar principal_type: Principal type. Possible values include: "App", "Group", "User". + :vartype principal_type: str or ~kusto_management_client.models.PrincipalType :ivar tenant_name: The tenant name of the principal. :vartype tenant_name: str :ivar principal_name: The principal name. @@ -1307,6 +1573,18 @@ def __init__( principal_type: Optional[Union[str, "PrincipalType"]] = None, **kwargs ): + """ + :keyword principal_id: The principal ID assigned to the database principal. It can be a user + email, application ID, or security group name. + :paramtype principal_id: str + :keyword role: Database principal role. Possible values include: "Admin", "Ingestor", + "Monitor", "User", "UnrestrictedViewer", "Viewer". + :paramtype role: str or ~kusto_management_client.models.DatabasePrincipalRole + :keyword tenant_id: The tenant id of the principal. + :paramtype tenant_id: str + :keyword principal_type: Principal type. Possible values include: "App", "Group", "User". + :paramtype principal_type: str or ~kusto_management_client.models.PrincipalType + """ super(DatabasePrincipalAssignment, self).__init__(**kwargs) self.principal_id = principal_id self.role = role @@ -1324,8 +1602,8 @@ class DatabasePrincipalAssignmentCheckNameRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Principal Assignment resource name. - :type name: str + :ivar name: Required. Principal Assignment resource name. + :vartype name: str :ivar type: The type of resource, Microsoft.Kusto/clusters/databases/principalAssignments. Has constant value: "Microsoft.Kusto/clusters/databases/principalAssignments". :vartype type: str @@ -1349,6 +1627,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Principal Assignment resource name. + :paramtype name: str + """ super(DatabasePrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) self.name = name @@ -1356,8 +1638,8 @@ def __init__( class DatabasePrincipalAssignmentListResult(msrest.serialization.Model): """The list Kusto database principal assignments operation response. - :param value: The list of Kusto database principal assignments. - :type value: list[~kusto_management_client.models.DatabasePrincipalAssignment] + :ivar value: The list of Kusto database principal assignments. + :vartype value: list[~kusto_management_client.models.DatabasePrincipalAssignment] """ _attribute_map = { @@ -1370,6 +1652,10 @@ def __init__( value: Optional[List["DatabasePrincipalAssignment"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto database principal assignments. + :paramtype value: list[~kusto_management_client.models.DatabasePrincipalAssignment] + """ super(DatabasePrincipalAssignmentListResult, self).__init__(**kwargs) self.value = value @@ -1377,8 +1663,8 @@ def __init__( class DatabasePrincipalListRequest(msrest.serialization.Model): """The list Kusto database principals operation request. - :param value: The list of Kusto database principals. - :type value: list[~kusto_management_client.models.DatabasePrincipal] + :ivar value: The list of Kusto database principals. + :vartype value: list[~kusto_management_client.models.DatabasePrincipal] """ _attribute_map = { @@ -1391,6 +1677,10 @@ def __init__( value: Optional[List["DatabasePrincipal"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto database principals. + :paramtype value: list[~kusto_management_client.models.DatabasePrincipal] + """ super(DatabasePrincipalListRequest, self).__init__(**kwargs) self.value = value @@ -1398,8 +1688,8 @@ def __init__( class DatabasePrincipalListResult(msrest.serialization.Model): """The list Kusto database principals operation response. - :param value: The list of Kusto database principals. - :type value: list[~kusto_management_client.models.DatabasePrincipal] + :ivar value: The list of Kusto database principals. + :vartype value: list[~kusto_management_client.models.DatabasePrincipal] """ _attribute_map = { @@ -1412,6 +1702,10 @@ def __init__( value: Optional[List["DatabasePrincipal"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto database principals. + :paramtype value: list[~kusto_management_client.models.DatabasePrincipal] + """ super(DatabasePrincipalListResult, self).__init__(**kwargs) self.value = value @@ -1419,8 +1713,8 @@ def __init__( class DatabaseStatistics(msrest.serialization.Model): """A class that contains database statistics information. - :param size: The database size - the total size of compressed data and index in bytes. - :type size: float + :ivar size: The database size - the total size of compressed data and index in bytes. + :vartype size: float """ _attribute_map = { @@ -1433,6 +1727,10 @@ def __init__( size: Optional[float] = None, **kwargs ): + """ + :keyword size: The database size - the total size of compressed data and index in bytes. + :paramtype size: float + """ super(DatabaseStatistics, self).__init__(**kwargs) self.size = size @@ -1455,11 +1753,11 @@ class DataConnection(ProxyResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the endpoint for the data connection.Constant filled by server. Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~kusto_management_client.models.DataConnectionKind + :vartype kind: str or ~kusto_management_client.models.DataConnectionKind """ _validation = { @@ -1487,6 +1785,10 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + """ super(DataConnection, self).__init__(**kwargs) self.location = location self.kind = 'DataConnection' # type: str @@ -1499,8 +1801,8 @@ class DataConnectionCheckNameRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Data Connection name. - :type name: str + :ivar name: Required. Data Connection name. + :vartype name: str :ivar type: The type of resource, Microsoft.Kusto/clusters/databases/dataConnections. Has constant value: "Microsoft.Kusto/clusters/databases/dataConnections". :vartype type: str @@ -1524,6 +1826,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Data Connection name. + :paramtype name: str + """ super(DataConnectionCheckNameRequest, self).__init__(**kwargs) self.name = name @@ -1531,8 +1837,8 @@ def __init__( class DataConnectionListResult(msrest.serialization.Model): """The list Kusto data connections operation response. - :param value: The list of Kusto data connections. - :type value: list[~kusto_management_client.models.DataConnection] + :ivar value: The list of Kusto data connections. + :vartype value: list[~kusto_management_client.models.DataConnection] """ _attribute_map = { @@ -1545,6 +1851,10 @@ def __init__( value: Optional[List["DataConnection"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto data connections. + :paramtype value: list[~kusto_management_client.models.DataConnection] + """ super(DataConnectionListResult, self).__init__(**kwargs) self.value = value @@ -1552,10 +1862,10 @@ def __init__( class DataConnectionValidation(msrest.serialization.Model): """Class representing an data connection validation. - :param data_connection_name: The name of the data connection. - :type data_connection_name: str - :param properties: The data connection properties to validate. - :type properties: ~kusto_management_client.models.DataConnection + :ivar data_connection_name: The name of the data connection. + :vartype data_connection_name: str + :ivar properties: The data connection properties to validate. + :vartype properties: ~kusto_management_client.models.DataConnection """ _attribute_map = { @@ -1570,6 +1880,12 @@ def __init__( properties: Optional["DataConnection"] = None, **kwargs ): + """ + :keyword data_connection_name: The name of the data connection. + :paramtype data_connection_name: str + :keyword properties: The data connection properties to validate. + :paramtype properties: ~kusto_management_client.models.DataConnection + """ super(DataConnectionValidation, self).__init__(**kwargs) self.data_connection_name = data_connection_name self.properties = properties @@ -1578,8 +1894,8 @@ def __init__( class DataConnectionValidationListResult(msrest.serialization.Model): """The list Kusto data connection validation result. - :param value: The list of Kusto data connection validation errors. - :type value: list[~kusto_management_client.models.DataConnectionValidationResult] + :ivar value: The list of Kusto data connection validation errors. + :vartype value: list[~kusto_management_client.models.DataConnectionValidationResult] """ _attribute_map = { @@ -1592,6 +1908,10 @@ def __init__( value: Optional[List["DataConnectionValidationResult"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto data connection validation errors. + :paramtype value: list[~kusto_management_client.models.DataConnectionValidationResult] + """ super(DataConnectionValidationListResult, self).__init__(**kwargs) self.value = value @@ -1599,8 +1919,8 @@ def __init__( class DataConnectionValidationResult(msrest.serialization.Model): """The result returned from a data connection validation request. - :param error_message: A message which indicates a problem in data connection validation. - :type error_message: str + :ivar error_message: A message which indicates a problem in data connection validation. + :vartype error_message: str """ _attribute_map = { @@ -1613,6 +1933,10 @@ def __init__( error_message: Optional[str] = None, **kwargs ): + """ + :keyword error_message: A message which indicates a problem in data connection validation. + :paramtype error_message: str + """ super(DataConnectionValidationResult, self).__init__(**kwargs) self.error_message = error_message @@ -1620,8 +1944,8 @@ def __init__( class DiagnoseVirtualNetworkResult(msrest.serialization.Model): """DiagnoseVirtualNetworkResult. - :param findings: The list of network connectivity diagnostic finding. - :type findings: list[str] + :ivar findings: The list of network connectivity diagnostic finding. + :vartype findings: list[str] """ _attribute_map = { @@ -1634,6 +1958,10 @@ def __init__( findings: Optional[List[str]] = None, **kwargs ): + """ + :keyword findings: The list of network connectivity diagnostic finding. + :paramtype findings: list[str] + """ super(DiagnoseVirtualNetworkResult, self).__init__(**kwargs) self.findings = findings @@ -1641,10 +1969,10 @@ def __init__( class EndpointDependency(msrest.serialization.Model): """A domain name that a service is reached at, including details of the current connection status. - :param domain_name: The domain name of the dependency. - :type domain_name: str - :param endpoint_details: The ports used when connecting to DomainName. - :type endpoint_details: list[~kusto_management_client.models.EndpointDetail] + :ivar domain_name: The domain name of the dependency. + :vartype domain_name: str + :ivar endpoint_details: The ports used when connecting to DomainName. + :vartype endpoint_details: list[~kusto_management_client.models.EndpointDetail] """ _attribute_map = { @@ -1659,6 +1987,12 @@ def __init__( endpoint_details: Optional[List["EndpointDetail"]] = None, **kwargs ): + """ + :keyword domain_name: The domain name of the dependency. + :paramtype domain_name: str + :keyword endpoint_details: The ports used when connecting to DomainName. + :paramtype endpoint_details: list[~kusto_management_client.models.EndpointDetail] + """ super(EndpointDependency, self).__init__(**kwargs) self.domain_name = domain_name self.endpoint_details = endpoint_details @@ -1667,8 +2001,8 @@ def __init__( class EndpointDetail(msrest.serialization.Model): """Current TCP connectivity information from the Kusto cluster to a single endpoint. - :param port: The port an endpoint is connected to. - :type port: int + :ivar port: The port an endpoint is connected to. + :vartype port: int """ _attribute_map = { @@ -1681,6 +2015,10 @@ def __init__( port: Optional[int] = None, **kwargs ): + """ + :keyword port: The port an endpoint is connected to. + :paramtype port: int + """ super(EndpointDetail, self).__init__(**kwargs) self.port = port @@ -1700,36 +2038,35 @@ class EventGridDataConnection(DataConnection): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the endpoint for the data connection.Constant filled by server. Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~kusto_management_client.models.DataConnectionKind - :param storage_account_resource_id: The resource ID of the storage account where the data + :vartype kind: str or ~kusto_management_client.models.DataConnectionKind + :ivar storage_account_resource_id: The resource ID of the storage account where the data resides. - :type storage_account_resource_id: str - :param event_hub_resource_id: The resource ID where the event grid is configured to send - events. - :type event_hub_resource_id: str - :param consumer_group: The event hub consumer group. - :type consumer_group: str - :param table_name: The table where the data should be ingested. Optionally the table + :vartype storage_account_resource_id: str + :ivar event_hub_resource_id: The resource ID where the event grid is configured to send events. + :vartype event_hub_resource_id: str + :ivar consumer_group: The event hub consumer group. + :vartype consumer_group: str + :ivar table_name: The table where the data should be ingested. Optionally the table information + can be added to each message. + :vartype table_name: str + :ivar mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. - :type table_name: str - :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the - mapping information can be added to each message. - :type mapping_rule_name: str - :param data_format: The data format of the message. Optionally the data format can be added to + :vartype mapping_rule_name: str + :ivar data_format: The data format of the message. Optionally the data format can be added to each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", "W3CLOGFILE". - :type data_format: str or ~kusto_management_client.models.EventGridDataFormat - :param ignore_first_record: A Boolean value that, if set to true, indicates that ingestion + :vartype data_format: str or ~kusto_management_client.models.EventGridDataFormat + :ivar ignore_first_record: A Boolean value that, if set to true, indicates that ingestion should ignore the first record of every file. - :type ignore_first_record: bool - :param blob_storage_event_type: The name of blob storage event type to process. Possible values + :vartype ignore_first_record: bool + :ivar blob_storage_event_type: The name of blob storage event type to process. Possible values include: "Microsoft.Storage.BlobCreated", "Microsoft.Storage.BlobRenamed". - :type blob_storage_event_type: str or ~kusto_management_client.models.BlobStorageEventType + :vartype blob_storage_event_type: str or ~kusto_management_client.models.BlobStorageEventType :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState @@ -1774,6 +2111,35 @@ def __init__( blob_storage_event_type: Optional[Union[str, "BlobStorageEventType"]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword storage_account_resource_id: The resource ID of the storage account where the data + resides. + :paramtype storage_account_resource_id: str + :keyword event_hub_resource_id: The resource ID where the event grid is configured to send + events. + :paramtype event_hub_resource_id: str + :keyword consumer_group: The event hub consumer group. + :paramtype consumer_group: str + :keyword table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :paramtype table_name: str + :keyword mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :paramtype mapping_rule_name: str + :keyword data_format: The data format of the message. Optionally the data format can be added + to each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", + "W3CLOGFILE". + :paramtype data_format: str or ~kusto_management_client.models.EventGridDataFormat + :keyword ignore_first_record: A Boolean value that, if set to true, indicates that ingestion + should ignore the first record of every file. + :paramtype ignore_first_record: bool + :keyword blob_storage_event_type: The name of blob storage event type to process. Possible + values include: "Microsoft.Storage.BlobCreated", "Microsoft.Storage.BlobRenamed". + :paramtype blob_storage_event_type: str or ~kusto_management_client.models.BlobStorageEventType + """ super(EventGridDataConnection, self).__init__(location=location, **kwargs) self.kind = 'EventGrid' # type: str self.storage_account_resource_id = storage_account_resource_id @@ -1802,38 +2168,38 @@ class EventHubDataConnection(DataConnection): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the endpoint for the data connection.Constant filled by server. Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~kusto_management_client.models.DataConnectionKind - :param event_hub_resource_id: The resource ID of the event hub to be used to create a data + :vartype kind: str or ~kusto_management_client.models.DataConnectionKind + :ivar event_hub_resource_id: The resource ID of the event hub to be used to create a data connection. - :type event_hub_resource_id: str - :param consumer_group: The event hub consumer group. - :type consumer_group: str - :param table_name: The table where the data should be ingested. Optionally the table + :vartype event_hub_resource_id: str + :ivar consumer_group: The event hub consumer group. + :vartype consumer_group: str + :ivar table_name: The table where the data should be ingested. Optionally the table information + can be added to each message. + :vartype table_name: str + :ivar mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. - :type table_name: str - :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the - mapping information can be added to each message. - :type mapping_rule_name: str - :param data_format: The data format of the message. Optionally the data format can be added to + :vartype mapping_rule_name: str + :ivar data_format: The data format of the message. Optionally the data format can be added to each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", "W3CLOGFILE". - :type data_format: str or ~kusto_management_client.models.EventHubDataFormat - :param event_system_properties: System properties of the event hub. - :type event_system_properties: list[str] - :param compression: The event hub messages compression type. Possible values include: "None", + :vartype data_format: str or ~kusto_management_client.models.EventHubDataFormat + :ivar event_system_properties: System properties of the event hub. + :vartype event_system_properties: list[str] + :ivar compression: The event hub messages compression type. Possible values include: "None", "GZip". Default value: "None". - :type compression: str or ~kusto_management_client.models.Compression + :vartype compression: str or ~kusto_management_client.models.Compression :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - :param managed_identity_resource_id: The resource ID of a managed identity (system or user + :ivar managed_identity_resource_id: The resource ID of a managed identity (system or user assigned) to be used to authenticate with event hub. - :type managed_identity_resource_id: str + :vartype managed_identity_resource_id: str """ _validation = { @@ -1875,6 +2241,34 @@ def __init__( managed_identity_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword event_hub_resource_id: The resource ID of the event hub to be used to create a data + connection. + :paramtype event_hub_resource_id: str + :keyword consumer_group: The event hub consumer group. + :paramtype consumer_group: str + :keyword table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :paramtype table_name: str + :keyword mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :paramtype mapping_rule_name: str + :keyword data_format: The data format of the message. Optionally the data format can be added + to each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", + "W3CLOGFILE". + :paramtype data_format: str or ~kusto_management_client.models.EventHubDataFormat + :keyword event_system_properties: System properties of the event hub. + :paramtype event_system_properties: list[str] + :keyword compression: The event hub messages compression type. Possible values include: "None", + "GZip". Default value: "None". + :paramtype compression: str or ~kusto_management_client.models.Compression + :keyword managed_identity_resource_id: The resource ID of a managed identity (system or user + assigned) to be used to authenticate with event hub. + :paramtype managed_identity_resource_id: str + """ super(EventHubDataConnection, self).__init__(location=location, **kwargs) self.kind = 'EventHub' # type: str self.event_hub_resource_id = event_hub_resource_id @@ -1895,12 +2289,12 @@ class FollowerDatabaseDefinition(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param cluster_resource_id: Required. Resource id of the cluster that follows a database owned + :ivar cluster_resource_id: Required. Resource id of the cluster that follows a database owned by this cluster. - :type cluster_resource_id: str - :param attached_database_configuration_name: Required. Resource name of the attached database + :vartype cluster_resource_id: str + :ivar attached_database_configuration_name: Required. Resource name of the attached database configuration in the follower cluster. - :type attached_database_configuration_name: str + :vartype attached_database_configuration_name: str :ivar database_name: The database name owned by this cluster that was followed. * in case following all databases. :vartype database_name: str @@ -1925,6 +2319,14 @@ def __init__( attached_database_configuration_name: str, **kwargs ): + """ + :keyword cluster_resource_id: Required. Resource id of the cluster that follows a database + owned by this cluster. + :paramtype cluster_resource_id: str + :keyword attached_database_configuration_name: Required. Resource name of the attached database + configuration in the follower cluster. + :paramtype attached_database_configuration_name: str + """ super(FollowerDatabaseDefinition, self).__init__(**kwargs) self.cluster_resource_id = cluster_resource_id self.attached_database_configuration_name = attached_database_configuration_name @@ -1934,8 +2336,8 @@ def __init__( class FollowerDatabaseListResult(msrest.serialization.Model): """The list Kusto database principals operation response. - :param value: The list of follower database result. - :type value: list[~kusto_management_client.models.FollowerDatabaseDefinition] + :ivar value: The list of follower database result. + :vartype value: list[~kusto_management_client.models.FollowerDatabaseDefinition] """ _attribute_map = { @@ -1948,6 +2350,10 @@ def __init__( value: Optional[List["FollowerDatabaseDefinition"]] = None, **kwargs ): + """ + :keyword value: The list of follower database result. + :paramtype value: list[~kusto_management_client.models.FollowerDatabaseDefinition] + """ super(FollowerDatabaseListResult, self).__init__(**kwargs) self.value = value @@ -1963,15 +2369,15 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: Required. The type of managed identity used. The type 'SystemAssigned, + :ivar type: Required. The type of managed identity used. The type 'SystemAssigned, UserAssigned' includes both an implicitly created identity and a set of user-assigned identities. The type 'None' will remove all identities. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned". - :type type: str or ~kusto_management_client.models.IdentityType - :param user_assigned_identities: The list of user identities associated with the Kusto cluster. + :vartype type: str or ~kusto_management_client.models.IdentityType + :ivar user_assigned_identities: The list of user identities associated with the Kusto cluster. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~kusto_management_client.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ @@ -1995,6 +2401,18 @@ def __init__( user_assigned_identities: Optional[Dict[str, "ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, **kwargs ): + """ + :keyword type: Required. The type of managed identity used. The type 'SystemAssigned, + UserAssigned' includes both an implicitly created identity and a set of user-assigned + identities. The type 'None' will remove all identities. Possible values include: "None", + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned". + :paramtype type: str or ~kusto_management_client.models.IdentityType + :keyword user_assigned_identities: The list of user identities associated with the Kusto + cluster. The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~kusto_management_client.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2017,31 +2435,31 @@ class IotHubDataConnection(DataConnection): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the endpoint for the data connection.Constant filled by server. Possible values include: "EventHub", "EventGrid", "IotHub". - :type kind: str or ~kusto_management_client.models.DataConnectionKind - :param iot_hub_resource_id: The resource ID of the Iot hub to be used to create a data + :vartype kind: str or ~kusto_management_client.models.DataConnectionKind + :ivar iot_hub_resource_id: The resource ID of the Iot hub to be used to create a data connection. - :type iot_hub_resource_id: str - :param consumer_group: The iot hub consumer group. - :type consumer_group: str - :param table_name: The table where the data should be ingested. Optionally the table + :vartype iot_hub_resource_id: str + :ivar consumer_group: The iot hub consumer group. + :vartype consumer_group: str + :ivar table_name: The table where the data should be ingested. Optionally the table information + can be added to each message. + :vartype table_name: str + :ivar mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message. - :type table_name: str - :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the - mapping information can be added to each message. - :type mapping_rule_name: str - :param data_format: The data format of the message. Optionally the data format can be added to + :vartype mapping_rule_name: str + :ivar data_format: The data format of the message. Optionally the data format can be added to each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", "W3CLOGFILE". - :type data_format: str or ~kusto_management_client.models.IotHubDataFormat - :param event_system_properties: System properties of the iot hub. - :type event_system_properties: list[str] - :param shared_access_policy_name: The name of the share access policy. - :type shared_access_policy_name: str + :vartype data_format: str or ~kusto_management_client.models.IotHubDataFormat + :ivar event_system_properties: System properties of the iot hub. + :vartype event_system_properties: list[str] + :ivar shared_access_policy_name: The name of the share access policy. + :vartype shared_access_policy_name: str :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState @@ -2084,6 +2502,30 @@ def __init__( shared_access_policy_name: Optional[str] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword iot_hub_resource_id: The resource ID of the Iot hub to be used to create a data + connection. + :paramtype iot_hub_resource_id: str + :keyword consumer_group: The iot hub consumer group. + :paramtype consumer_group: str + :keyword table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :paramtype table_name: str + :keyword mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :paramtype mapping_rule_name: str + :keyword data_format: The data format of the message. Optionally the data format can be added + to each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC", "APACHEAVRO", + "W3CLOGFILE". + :paramtype data_format: str or ~kusto_management_client.models.IotHubDataFormat + :keyword event_system_properties: System properties of the iot hub. + :paramtype event_system_properties: list[str] + :keyword shared_access_policy_name: The name of the share access policy. + :paramtype shared_access_policy_name: str + """ super(IotHubDataConnection, self).__init__(location=location, **kwargs) self.kind = 'IotHub' # type: str self.iot_hub_resource_id = iot_hub_resource_id @@ -2099,14 +2541,14 @@ def __init__( class KeyVaultProperties(msrest.serialization.Model): """Properties of the key vault. - :param key_name: The name of the key vault key. - :type key_name: str - :param key_version: The version of the key vault key. - :type key_version: str - :param key_vault_uri: The Uri of the key vault. - :type key_vault_uri: str - :param user_identity: The user assigned identity (ARM resource id) that has access to the key. - :type user_identity: str + :ivar key_name: The name of the key vault key. + :vartype key_name: str + :ivar key_version: The version of the key vault key. + :vartype key_version: str + :ivar key_vault_uri: The Uri of the key vault. + :vartype key_vault_uri: str + :ivar user_identity: The user assigned identity (ARM resource id) that has access to the key. + :vartype user_identity: str """ _attribute_map = { @@ -2125,6 +2567,17 @@ def __init__( user_identity: Optional[str] = None, **kwargs ): + """ + :keyword key_name: The name of the key vault key. + :paramtype key_name: str + :keyword key_version: The version of the key vault key. + :paramtype key_version: str + :keyword key_vault_uri: The Uri of the key vault. + :paramtype key_vault_uri: str + :keyword user_identity: The user assigned identity (ARM resource id) that has access to the + key. + :paramtype user_identity: str + """ super(KeyVaultProperties, self).__init__(**kwargs) self.key_name = key_name self.key_version = key_version @@ -2135,9 +2588,9 @@ def __init__( class LanguageExtension(msrest.serialization.Model): """The language extension object. - :param language_extension_name: The language extension name. Possible values include: "PYTHON", + :ivar language_extension_name: The language extension name. Possible values include: "PYTHON", "R". - :type language_extension_name: str or ~kusto_management_client.models.LanguageExtensionName + :vartype language_extension_name: str or ~kusto_management_client.models.LanguageExtensionName """ _attribute_map = { @@ -2150,6 +2603,12 @@ def __init__( language_extension_name: Optional[Union[str, "LanguageExtensionName"]] = None, **kwargs ): + """ + :keyword language_extension_name: The language extension name. Possible values include: + "PYTHON", "R". + :paramtype language_extension_name: str or + ~kusto_management_client.models.LanguageExtensionName + """ super(LanguageExtension, self).__init__(**kwargs) self.language_extension_name = language_extension_name @@ -2157,8 +2616,8 @@ def __init__( class LanguageExtensionsList(msrest.serialization.Model): """The list of language extension objects. - :param value: The list of language extensions. - :type value: list[~kusto_management_client.models.LanguageExtension] + :ivar value: The list of language extensions. + :vartype value: list[~kusto_management_client.models.LanguageExtension] """ _attribute_map = { @@ -2171,6 +2630,10 @@ def __init__( value: Optional[List["LanguageExtension"]] = None, **kwargs ): + """ + :keyword value: The list of language extensions. + :paramtype value: list[~kusto_management_client.models.LanguageExtension] + """ super(LanguageExtensionsList, self).__init__(**kwargs) self.value = value @@ -2178,8 +2641,8 @@ def __init__( class ListResourceSkusResult(msrest.serialization.Model): """List of available SKUs for a Kusto Cluster. - :param value: The collection of available SKUs for an existing resource. - :type value: list[~kusto_management_client.models.AzureResourceSku] + :ivar value: The collection of available SKUs for an existing resource. + :vartype value: list[~kusto_management_client.models.AzureResourceSku] """ _attribute_map = { @@ -2192,6 +2655,10 @@ def __init__( value: Optional[List["AzureResourceSku"]] = None, **kwargs ): + """ + :keyword value: The collection of available SKUs for an existing resource. + :paramtype value: list[~kusto_management_client.models.AzureResourceSku] + """ super(ListResourceSkusResult, self).__init__(**kwargs) self.value = value @@ -2211,16 +2678,16 @@ class ManagedPrivateEndpoint(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~kusto_management_client.models.SystemData - :param private_link_resource_id: The ARM resource ID of the resource for which the managed + :ivar private_link_resource_id: The ARM resource ID of the resource for which the managed private endpoint is created. - :type private_link_resource_id: str - :param private_link_resource_region: The region of the resource to which the managed private + :vartype private_link_resource_id: str + :ivar private_link_resource_region: The region of the resource to which the managed private endpoint is created. - :type private_link_resource_region: str - :param group_id: The groupId in which the managed private endpoint is created. - :type group_id: str - :param request_message: The user request message. - :type request_message: str + :vartype private_link_resource_region: str + :ivar group_id: The groupId in which the managed private endpoint is created. + :vartype group_id: str + :ivar request_message: The user request message. + :vartype request_message: str :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState @@ -2255,6 +2722,18 @@ def __init__( request_message: Optional[str] = None, **kwargs ): + """ + :keyword private_link_resource_id: The ARM resource ID of the resource for which the managed + private endpoint is created. + :paramtype private_link_resource_id: str + :keyword private_link_resource_region: The region of the resource to which the managed private + endpoint is created. + :paramtype private_link_resource_region: str + :keyword group_id: The groupId in which the managed private endpoint is created. + :paramtype group_id: str + :keyword request_message: The user request message. + :paramtype request_message: str + """ super(ManagedPrivateEndpoint, self).__init__(**kwargs) self.system_data = None self.private_link_resource_id = private_link_resource_id @@ -2267,8 +2746,8 @@ def __init__( class ManagedPrivateEndpointListResult(msrest.serialization.Model): """The list managed private endpoints operation response. - :param value: The list of managed private endpoints. - :type value: list[~kusto_management_client.models.ManagedPrivateEndpoint] + :ivar value: The list of managed private endpoints. + :vartype value: list[~kusto_management_client.models.ManagedPrivateEndpoint] """ _attribute_map = { @@ -2281,6 +2760,10 @@ def __init__( value: Optional[List["ManagedPrivateEndpoint"]] = None, **kwargs ): + """ + :keyword value: The list of managed private endpoints. + :paramtype value: list[~kusto_management_client.models.ManagedPrivateEndpoint] + """ super(ManagedPrivateEndpointListResult, self).__init__(**kwargs) self.value = value @@ -2292,8 +2775,8 @@ class ManagedPrivateEndpointsCheckNameRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Managed private endpoint resource name. - :type name: str + :ivar name: Required. Managed private endpoint resource name. + :vartype name: str :ivar type: The type of resource, for instance Microsoft.Kusto/clusters/managedPrivateEndpoints. Has constant value: "Microsoft.Kusto/clusters/managedPrivateEndpoints". @@ -2318,6 +2801,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Managed private endpoint resource name. + :paramtype name: str + """ super(ManagedPrivateEndpointsCheckNameRequest, self).__init__(**kwargs) self.name = name @@ -2325,14 +2812,14 @@ def __init__( class Operation(msrest.serialization.Model): """A REST API operation. - :param name: This is of the format {provider}/{resource}/{operation}. - :type name: str - :param display: The object that describes the operation. - :type display: ~kusto_management_client.models.OperationDisplay - :param origin: The intended executor of the operation. - :type origin: str - :param properties: Any object. - :type properties: any + :ivar name: This is of the format {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that describes the operation. + :vartype display: ~kusto_management_client.models.OperationDisplay + :ivar origin: The intended executor of the operation. + :vartype origin: str + :ivar properties: Any object. + :vartype properties: any """ _attribute_map = { @@ -2351,6 +2838,16 @@ def __init__( properties: Optional[Any] = None, **kwargs ): + """ + :keyword name: This is of the format {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that describes the operation. + :paramtype display: ~kusto_management_client.models.OperationDisplay + :keyword origin: The intended executor of the operation. + :paramtype origin: str + :keyword properties: Any object. + :paramtype properties: any + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -2361,14 +2858,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """The object that describes the operation. - :param provider: Friendly name of the resource provider. - :type provider: str - :param operation: For example: read, write, delete. - :type operation: str - :param resource: The resource type on which the operation is performed. - :type resource: str - :param description: The friendly name of the operation. - :type description: str + :ivar provider: Friendly name of the resource provider. + :vartype provider: str + :ivar operation: For example: read, write, delete. + :vartype operation: str + :ivar resource: The resource type on which the operation is performed. + :vartype resource: str + :ivar description: The friendly name of the operation. + :vartype description: str """ _attribute_map = { @@ -2387,6 +2884,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Friendly name of the resource provider. + :paramtype provider: str + :keyword operation: For example: read, write, delete. + :paramtype operation: str + :keyword resource: The resource type on which the operation is performed. + :paramtype resource: str + :keyword description: The friendly name of the operation. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.operation = operation @@ -2397,10 +2904,10 @@ def __init__( class OperationListResult(msrest.serialization.Model): """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. - :param value: The list of operations supported by the resource provider. - :type value: list[~kusto_management_client.models.Operation] - :param next_link: The URL to get the next set of operation list results if there are any. - :type next_link: str + :ivar value: The list of operations supported by the resource provider. + :vartype value: list[~kusto_management_client.models.Operation] + :ivar next_link: The URL to get the next set of operation list results if there are any. + :vartype next_link: str """ _attribute_map = { @@ -2415,6 +2922,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of operations supported by the resource provider. + :paramtype value: list[~kusto_management_client.models.Operation] + :keyword next_link: The URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -2432,20 +2945,20 @@ class OperationResult(msrest.serialization.Model): :ivar status: status of the Operation result. Possible values include: "Succeeded", "Canceled", "Failed", "Running". :vartype status: str or ~kusto_management_client.models.Status - :param start_time: The operation start time. - :type start_time: ~datetime.datetime - :param end_time: The operation end time. - :type end_time: ~datetime.datetime - :param percent_complete: Percentage completed. - :type percent_complete: float - :param code: The code of the error. - :type code: str - :param message: The error message. - :type message: str - :param operation_kind: The kind of the operation. - :type operation_kind: str - :param operation_state: The state of the operation. - :type operation_state: str + :ivar start_time: The operation start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: The operation end time. + :vartype end_time: ~datetime.datetime + :ivar percent_complete: Percentage completed. + :vartype percent_complete: float + :ivar code: The code of the error. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar operation_kind: The kind of the operation. + :vartype operation_kind: str + :ivar operation_state: The state of the operation. + :vartype operation_state: str """ _validation = { @@ -2480,6 +2993,22 @@ def __init__( operation_state: Optional[str] = None, **kwargs ): + """ + :keyword start_time: The operation start time. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The operation end time. + :paramtype end_time: ~datetime.datetime + :keyword percent_complete: Percentage completed. + :paramtype percent_complete: float + :keyword code: The code of the error. + :paramtype code: str + :keyword message: The error message. + :paramtype message: str + :keyword operation_kind: The kind of the operation. + :paramtype operation_kind: str + :keyword operation_state: The state of the operation. + :paramtype operation_state: str + """ super(OperationResult, self).__init__(**kwargs) self.id = None self.name = None @@ -2498,15 +3027,15 @@ class OptimizedAutoscale(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param version: Required. The version of the template defined, for instance 1. - :type version: int - :param is_enabled: Required. A boolean value that indicate if the optimized autoscale feature - is enabled or not. - :type is_enabled: bool - :param minimum: Required. Minimum allowed instances count. - :type minimum: int - :param maximum: Required. Maximum allowed instances count. - :type maximum: int + :ivar version: Required. The version of the template defined, for instance 1. + :vartype version: int + :ivar is_enabled: Required. A boolean value that indicate if the optimized autoscale feature is + enabled or not. + :vartype is_enabled: bool + :ivar minimum: Required. Minimum allowed instances count. + :vartype minimum: int + :ivar maximum: Required. Maximum allowed instances count. + :vartype maximum: int """ _validation = { @@ -2532,6 +3061,17 @@ def __init__( maximum: int, **kwargs ): + """ + :keyword version: Required. The version of the template defined, for instance 1. + :paramtype version: int + :keyword is_enabled: Required. A boolean value that indicate if the optimized autoscale feature + is enabled or not. + :paramtype is_enabled: bool + :keyword minimum: Required. Minimum allowed instances count. + :paramtype minimum: int + :keyword maximum: Required. Maximum allowed instances count. + :paramtype maximum: int + """ super(OptimizedAutoscale, self).__init__(**kwargs) self.version = version self.is_enabled = is_enabled @@ -2554,11 +3094,11 @@ class OutboundNetworkDependenciesEndpoint(ProxyResource): :vartype type: str :ivar etag: A unique read-only string that changes whenever the resource is updated. :vartype etag: str - :param category: The type of service accessed by the Kusto Service Environment, e.g., Azure + :ivar category: The type of service accessed by the Kusto Service Environment, e.g., Azure Storage, Azure SQL Database, and Azure Active Directory. - :type category: str - :param endpoints: The endpoints that the Kusto Service Environment reaches the service at. - :type endpoints: list[~kusto_management_client.models.EndpointDependency] + :vartype category: str + :ivar endpoints: The endpoints that the Kusto Service Environment reaches the service at. + :vartype endpoints: list[~kusto_management_client.models.EndpointDependency] :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState @@ -2589,6 +3129,13 @@ def __init__( endpoints: Optional[List["EndpointDependency"]] = None, **kwargs ): + """ + :keyword category: The type of service accessed by the Kusto Service Environment, e.g., Azure + Storage, Azure SQL Database, and Azure Active Directory. + :paramtype category: str + :keyword endpoints: The endpoints that the Kusto Service Environment reaches the service at. + :paramtype endpoints: list[~kusto_management_client.models.EndpointDependency] + """ super(OutboundNetworkDependenciesEndpoint, self).__init__(**kwargs) self.etag = None self.category = category @@ -2603,8 +3150,8 @@ class OutboundNetworkDependenciesEndpointListResult(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param value: Required. Collection of resources. - :type value: list[~kusto_management_client.models.OutboundNetworkDependenciesEndpoint] + :ivar value: Required. Collection of resources. + :vartype value: list[~kusto_management_client.models.OutboundNetworkDependenciesEndpoint] :ivar next_link: Link to next page of resources. :vartype next_link: str """ @@ -2625,6 +3172,10 @@ def __init__( value: List["OutboundNetworkDependenciesEndpoint"], **kwargs ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~kusto_management_client.models.OutboundNetworkDependenciesEndpoint] + """ super(OutboundNetworkDependenciesEndpointListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -2647,9 +3198,9 @@ class PrivateEndpointConnection(ProxyResource): :vartype system_data: ~kusto_management_client.models.SystemData :ivar private_endpoint: Private endpoint which the connection belongs to. :vartype private_endpoint: ~kusto_management_client.models.PrivateEndpointProperty - :param private_link_service_connection_state: Connection State of the Private Endpoint + :ivar private_link_service_connection_state: Connection State of the Private Endpoint Connection. - :type private_link_service_connection_state: + :vartype private_link_service_connection_state: ~kusto_management_client.models.PrivateLinkServiceConnectionStateProperty :ivar group_id: Group id of the private endpoint. :vartype group_id: str @@ -2684,6 +3235,12 @@ def __init__( private_link_service_connection_state: Optional["PrivateLinkServiceConnectionStateProperty"] = None, **kwargs ): + """ + :keyword private_link_service_connection_state: Connection State of the Private Endpoint + Connection. + :paramtype private_link_service_connection_state: + ~kusto_management_client.models.PrivateLinkServiceConnectionStateProperty + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.system_data = None self.private_endpoint = None @@ -2695,8 +3252,8 @@ def __init__( class PrivateEndpointConnectionListResult(msrest.serialization.Model): """A list of private endpoint connections. - :param value: Array of private endpoint connections. - :type value: list[~kusto_management_client.models.PrivateEndpointConnection] + :ivar value: Array of private endpoint connections. + :vartype value: list[~kusto_management_client.models.PrivateEndpointConnection] """ _attribute_map = { @@ -2709,6 +3266,10 @@ def __init__( value: Optional[List["PrivateEndpointConnection"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: list[~kusto_management_client.models.PrivateEndpointConnection] + """ super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) self.value = value @@ -2734,6 +3295,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpointProperty, self).__init__(**kwargs) self.id = None @@ -2785,6 +3348,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateLinkResource, self).__init__(**kwargs) self.system_data = None self.group_id = None @@ -2795,8 +3360,8 @@ def __init__( class PrivateLinkResourceListResult(msrest.serialization.Model): """A list of private link resources. - :param value: Array of private link resources. - :type value: list[~kusto_management_client.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~kusto_management_client.models.PrivateLinkResource] """ _attribute_map = { @@ -2809,6 +3374,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~kusto_management_client.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value @@ -2818,10 +3387,10 @@ class PrivateLinkServiceConnectionStateProperty(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param status: The private link service connection status. - :type status: str - :param description: The private link service connection description. - :type description: str + :ivar status: The private link service connection status. + :vartype status: str + :ivar description: The private link service connection description. + :vartype description: str :ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/ disconnect). :vartype actions_required: str @@ -2844,6 +3413,12 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword status: The private link service connection status. + :paramtype status: str + :keyword description: The private link service connection description. + :paramtype description: str + """ super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs) self.status = status self.description = description @@ -2865,20 +3440,19 @@ class ReadOnlyFollowingDatabase(Database): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the database.Constant filled by server. Possible values - include: "ReadWrite", "ReadOnlyFollowing". - :type kind: str or ~kusto_management_client.models.Kind + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the database.Constant filled by server. Possible values include: + "ReadWrite", "ReadOnlyFollowing". + :vartype kind: str or ~kusto_management_client.models.Kind :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState :ivar soft_delete_period: The time the data should be kept before it stops being accessible to queries in TimeSpan. :vartype soft_delete_period: ~datetime.timedelta - :param hot_cache_period: The time the data should be kept in cache for fast queries in - TimeSpan. - :type hot_cache_period: ~datetime.timedelta + :ivar hot_cache_period: The time the data should be kept in cache for fast queries in TimeSpan. + :vartype hot_cache_period: ~datetime.timedelta :ivar statistics: The statistics of the database. :vartype statistics: ~kusto_management_client.models.DatabaseStatistics :ivar leader_cluster_resource_id: The name of the leader cluster. @@ -2927,6 +3501,13 @@ def __init__( hot_cache_period: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword hot_cache_period: The time the data should be kept in cache for fast queries in + TimeSpan. + :paramtype hot_cache_period: ~datetime.timedelta + """ super(ReadOnlyFollowingDatabase, self).__init__(location=location, **kwargs) self.kind = 'ReadOnlyFollowing' # type: str self.provisioning_state = None @@ -2953,20 +3534,19 @@ class ReadWriteDatabase(Database): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location. - :type location: str - :param kind: Required. Kind of the database.Constant filled by server. Possible values - include: "ReadWrite", "ReadOnlyFollowing". - :type kind: str or ~kusto_management_client.models.Kind + :ivar location: Resource location. + :vartype location: str + :ivar kind: Required. Kind of the database.Constant filled by server. Possible values include: + "ReadWrite", "ReadOnlyFollowing". + :vartype kind: str or ~kusto_management_client.models.Kind :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState - :param soft_delete_period: The time the data should be kept before it stops being accessible to + :ivar soft_delete_period: The time the data should be kept before it stops being accessible to queries in TimeSpan. - :type soft_delete_period: ~datetime.timedelta - :param hot_cache_period: The time the data should be kept in cache for fast queries in - TimeSpan. - :type hot_cache_period: ~datetime.timedelta + :vartype soft_delete_period: ~datetime.timedelta + :ivar hot_cache_period: The time the data should be kept in cache for fast queries in TimeSpan. + :vartype hot_cache_period: ~datetime.timedelta :ivar statistics: The statistics of the database. :vartype statistics: ~kusto_management_client.models.DatabaseStatistics :ivar is_followed: Indicates whether the database is followed. @@ -3004,6 +3584,16 @@ def __init__( hot_cache_period: Optional[datetime.timedelta] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword soft_delete_period: The time the data should be kept before it stops being accessible + to queries in TimeSpan. + :paramtype soft_delete_period: ~datetime.timedelta + :keyword hot_cache_period: The time the data should be kept in cache for fast queries in + TimeSpan. + :paramtype hot_cache_period: ~datetime.timedelta + """ super(ReadWriteDatabase, self).__init__(location=location, **kwargs) self.kind = 'ReadWrite' # type: str self.provisioning_state = None @@ -3028,14 +3618,14 @@ class Script(ProxyResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~kusto_management_client.models.SystemData - :param script_url: The url to the KQL script blob file. - :type script_url: str - :param script_url_sas_token: The SaS token. - :type script_url_sas_token: str - :param force_update_tag: A unique string. If changed the script will be applied again. - :type force_update_tag: str - :param continue_on_errors: Flag that indicates whether to continue if one of the command fails. - :type continue_on_errors: bool + :ivar script_url: The url to the KQL script blob file. + :vartype script_url: str + :ivar script_url_sas_token: The SaS token. + :vartype script_url_sas_token: str + :ivar force_update_tag: A unique string. If changed the script will be applied again. + :vartype force_update_tag: str + :ivar continue_on_errors: Flag that indicates whether to continue if one of the command fails. + :vartype continue_on_errors: bool :ivar provisioning_state: The provisioned state of the resource. Possible values include: "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". :vartype provisioning_state: str or ~kusto_management_client.models.ProvisioningState @@ -3070,6 +3660,17 @@ def __init__( continue_on_errors: Optional[bool] = False, **kwargs ): + """ + :keyword script_url: The url to the KQL script blob file. + :paramtype script_url: str + :keyword script_url_sas_token: The SaS token. + :paramtype script_url_sas_token: str + :keyword force_update_tag: A unique string. If changed the script will be applied again. + :paramtype force_update_tag: str + :keyword continue_on_errors: Flag that indicates whether to continue if one of the command + fails. + :paramtype continue_on_errors: bool + """ super(Script, self).__init__(**kwargs) self.system_data = None self.script_url = script_url @@ -3086,8 +3687,8 @@ class ScriptCheckNameRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Script name. - :type name: str + :ivar name: Required. Script name. + :vartype name: str :ivar type: The type of resource, Microsoft.Kusto/clusters/databases/scripts. Has constant value: "Microsoft.Kusto/clusters/databases/scripts". :vartype type: str @@ -3111,6 +3712,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. Script name. + :paramtype name: str + """ super(ScriptCheckNameRequest, self).__init__(**kwargs) self.name = name @@ -3118,8 +3723,8 @@ def __init__( class ScriptListResult(msrest.serialization.Model): """The list Kusto database script operation response. - :param value: The list of Kusto scripts. - :type value: list[~kusto_management_client.models.Script] + :ivar value: The list of Kusto scripts. + :vartype value: list[~kusto_management_client.models.Script] """ _attribute_map = { @@ -3132,6 +3737,10 @@ def __init__( value: Optional[List["Script"]] = None, **kwargs ): + """ + :keyword value: The list of Kusto scripts. + :paramtype value: list[~kusto_management_client.models.Script] + """ super(ScriptListResult, self).__init__(**kwargs) self.value = value @@ -3177,6 +3786,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuDescription, self).__init__(**kwargs) self.resource_type = None self.name = None @@ -3207,6 +3818,8 @@ def __init__( self, **kwargs ): + """ + """ super(SkuDescriptionList, self).__init__(**kwargs) self.value = None @@ -3216,10 +3829,10 @@ class SkuLocationInfoItem(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. The available location of the SKU. - :type location: str - :param zones: The available zone of the SKU. - :type zones: list[str] + :ivar location: Required. The available location of the SKU. + :vartype location: str + :ivar zones: The available zone of the SKU. + :vartype zones: list[str] """ _validation = { @@ -3238,6 +3851,12 @@ def __init__( zones: Optional[List[str]] = None, **kwargs ): + """ + :keyword location: Required. The available location of the SKU. + :paramtype location: str + :keyword zones: The available zone of the SKU. + :paramtype zones: list[str] + """ super(SkuLocationInfoItem, self).__init__(**kwargs) self.location = location self.zones = zones @@ -3246,20 +3865,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~kusto_management_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~kusto_management_client.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~kusto_management_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~kusto_management_client.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -3282,6 +3901,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~kusto_management_client.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 ~kusto_management_client.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 @@ -3294,20 +3929,20 @@ def __init__( class TableLevelSharingProperties(msrest.serialization.Model): """Tables that will be included and excluded in the follower database. - :param tables_to_include: List of tables to include in the follower database. - :type tables_to_include: list[str] - :param tables_to_exclude: List of tables to exclude from the follower database. - :type tables_to_exclude: list[str] - :param external_tables_to_include: List of external tables to include in the follower database. - :type external_tables_to_include: list[str] - :param external_tables_to_exclude: List of external tables exclude from the follower database. - :type external_tables_to_exclude: list[str] - :param materialized_views_to_include: List of materialized views to include in the follower + :ivar tables_to_include: List of tables to include in the follower database. + :vartype tables_to_include: list[str] + :ivar tables_to_exclude: List of tables to exclude from the follower database. + :vartype tables_to_exclude: list[str] + :ivar external_tables_to_include: List of external tables to include in the follower database. + :vartype external_tables_to_include: list[str] + :ivar external_tables_to_exclude: List of external tables exclude from the follower database. + :vartype external_tables_to_exclude: list[str] + :ivar materialized_views_to_include: List of materialized views to include in the follower database. - :type materialized_views_to_include: list[str] - :param materialized_views_to_exclude: List of materialized views exclude from the follower + :vartype materialized_views_to_include: list[str] + :ivar materialized_views_to_exclude: List of materialized views exclude from the follower database. - :type materialized_views_to_exclude: list[str] + :vartype materialized_views_to_exclude: list[str] """ _attribute_map = { @@ -3330,6 +3965,24 @@ def __init__( materialized_views_to_exclude: Optional[List[str]] = None, **kwargs ): + """ + :keyword tables_to_include: List of tables to include in the follower database. + :paramtype tables_to_include: list[str] + :keyword tables_to_exclude: List of tables to exclude from the follower database. + :paramtype tables_to_exclude: list[str] + :keyword external_tables_to_include: List of external tables to include in the follower + database. + :paramtype external_tables_to_include: list[str] + :keyword external_tables_to_exclude: List of external tables exclude from the follower + database. + :paramtype external_tables_to_exclude: list[str] + :keyword materialized_views_to_include: List of materialized views to include in the follower + database. + :paramtype materialized_views_to_include: list[str] + :keyword materialized_views_to_exclude: List of materialized views exclude from the follower + database. + :paramtype materialized_views_to_exclude: list[str] + """ super(TableLevelSharingProperties, self).__init__(**kwargs) self.tables_to_include = tables_to_include self.tables_to_exclude = tables_to_exclude @@ -3342,8 +3995,8 @@ def __init__( class TrustedExternalTenant(msrest.serialization.Model): """Represents a tenant ID that is trusted by the cluster. - :param value: GUID representing an external tenant. - :type value: str + :ivar value: GUID representing an external tenant. + :vartype value: str """ _attribute_map = { @@ -3356,6 +4009,10 @@ def __init__( value: Optional[str] = None, **kwargs ): + """ + :keyword value: GUID representing an external tenant. + :paramtype value: str + """ super(TrustedExternalTenant, self).__init__(**kwargs) self.value = value @@ -3365,13 +4022,13 @@ class VirtualNetworkConfiguration(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param subnet_id: Required. The subnet resource id. - :type subnet_id: str - :param engine_public_ip_id: Required. Engine service's public IP address resource id. - :type engine_public_ip_id: str - :param data_management_public_ip_id: Required. Data management's service public IP address + :ivar subnet_id: Required. The subnet resource id. + :vartype subnet_id: str + :ivar engine_public_ip_id: Required. Engine service's public IP address resource id. + :vartype engine_public_ip_id: str + :ivar data_management_public_ip_id: Required. Data management's service public IP address resource id. - :type data_management_public_ip_id: str + :vartype data_management_public_ip_id: str """ _validation = { @@ -3394,6 +4051,15 @@ def __init__( data_management_public_ip_id: str, **kwargs ): + """ + :keyword subnet_id: Required. The subnet resource id. + :paramtype subnet_id: str + :keyword engine_public_ip_id: Required. Engine service's public IP address resource id. + :paramtype engine_public_ip_id: str + :keyword data_management_public_ip_id: Required. Data management's service public IP address + resource id. + :paramtype data_management_public_ip_id: str + """ super(VirtualNetworkConfiguration, self).__init__(**kwargs) self.subnet_id = subnet_id self.engine_public_ip_id = engine_public_ip_id diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_attached_database_configurations_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_attached_database_configurations_operations.py index 61e0f13ae945..3e37c9a48ede 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_attached_database_configurations_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_attached_database_configurations_operations.py @@ -5,25 +5,227 @@ # 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_check_name_availability_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurationCheckNameAvailability') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_cluster_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + cluster_name: str, + attached_database_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "attachedDatabaseConfigurationName": _SERIALIZER.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + cluster_name: str, + attached_database_configuration_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "attachedDatabaseConfigurationName": _SERIALIZER.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + cluster_name: str, + attached_database_configuration_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "attachedDatabaseConfigurationName": _SERIALIZER.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class AttachedDatabaseConfigurationsOperations(object): """AttachedDatabaseConfigurationsOperations operations. @@ -47,14 +249,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - resource_group_name, # type: str - cluster_name, # type: str - resource_name, # type: "_models.AttachedDatabaseConfigurationsCheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + resource_group_name: str, + cluster_name: str, + resource_name: "_models.AttachedDatabaseConfigurationsCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the attached database configuration resource name is valid and is not already in use. @@ -63,7 +265,8 @@ def check_name_availability( :param cluster_name: The name of the Kusto cluster. :type cluster_name: str :param resource_name: The name of the resource. - :type resource_name: ~kusto_management_client.models.AttachedDatabaseConfigurationsCheckNameRequest + :type resource_name: + ~kusto_management_client.models.AttachedDatabaseConfigurationsCheckNameRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameResult, or the result of cls(response) :rtype: ~kusto_management_client.models.CheckNameResult @@ -74,32 +277,22 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(resource_name, 'AttachedDatabaseConfigurationsCheckNameRequest') + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(resource_name, 'AttachedDatabaseConfigurationsCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -113,15 +306,17 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurationCheckNameAvailability'} # type: ignore + + @distributed_trace def list_by_cluster( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.AttachedDatabaseConfigurationListResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.AttachedDatabaseConfigurationListResult"]: """Returns the list of attached database configurations of the given Kusto cluster. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -129,8 +324,10 @@ def list_by_cluster( :param cluster_name: The name of the Kusto 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 AttachedDatabaseConfigurationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.AttachedDatabaseConfigurationListResult] + :return: An iterator like instance of either AttachedDatabaseConfigurationListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~kusto_management_client.models.AttachedDatabaseConfigurationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfigurationListResult"] @@ -138,36 +335,33 @@ def list_by_cluster( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('AttachedDatabaseConfigurationListResult', pipeline_response) + deserialized = self._deserialize("AttachedDatabaseConfigurationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -185,19 +379,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - attached_database_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.AttachedDatabaseConfiguration" + resource_group_name: str, + cluster_name: str, + attached_database_configuration_name: str, + **kwargs: Any + ) -> "_models.AttachedDatabaseConfiguration": """Returns an attached database configuration. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -216,28 +411,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + attached_database_configuration_name=attached_database_configuration_name, + subscription_id=self._config.subscription_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 @@ -251,49 +436,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - attached_database_configuration_name, # type: str - parameters, # type: "_models.AttachedDatabaseConfiguration" - **kwargs # type: Any - ): - # type: (...) -> "_models.AttachedDatabaseConfiguration" + resource_group_name: str, + cluster_name: str, + attached_database_configuration_name: str, + parameters: "_models.AttachedDatabaseConfiguration", + **kwargs: Any + ) -> "_models.AttachedDatabaseConfiguration": cls = kwargs.pop('cls', None) # type: ClsType["_models.AttachedDatabaseConfiguration"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'AttachedDatabaseConfiguration') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + attached_database_configuration_name=attached_database_configuration_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'AttachedDatabaseConfiguration') - 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 @@ -314,17 +490,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - attached_database_configuration_name, # type: str - parameters, # type: "_models.AttachedDatabaseConfiguration" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.AttachedDatabaseConfiguration"] + resource_group_name: str, + cluster_name: str, + attached_database_configuration_name: str, + parameters: "_models.AttachedDatabaseConfiguration", + **kwargs: Any + ) -> LROPoller["_models.AttachedDatabaseConfiguration"]: """Creates or updates an attached database configuration. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -337,15 +515,20 @@ def begin_create_or_update( :type parameters: ~kusto_management_client.models.AttachedDatabaseConfiguration :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 AttachedDatabaseConfiguration or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.AttachedDatabaseConfiguration] - :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 AttachedDatabaseConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~kusto_management_client.models.AttachedDatabaseConfiguration] + :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.AttachedDatabaseConfiguration"] lro_delay = kwargs.pop( 'polling_interval', @@ -358,28 +541,21 @@ def begin_create_or_update( cluster_name=cluster_name, attached_database_configuration_name=attached_database_configuration_name, parameters=parameters, + 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('AttachedDatabaseConfiguration', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -391,43 +567,33 @@ 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/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - attached_database_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + attached_database_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-08-27" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + attached_database_configuration_name=attached_database_configuration_name, + subscription_id=self._config.subscription_id, + 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 @@ -440,14 +606,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - attached_database_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + attached_database_configuration_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the attached database configuration with the given name. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -458,15 +625,17 @@ def begin_delete( :type attached_database_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', @@ -481,22 +650,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'attachedDatabaseConfigurationName': self._serialize.url("attached_database_configuration_name", attached_database_configuration_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -508,4 +669,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_cluster_principal_assignments_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_cluster_principal_assignments_operations.py index eefbf7483a7e..6e58f37bebdb 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_cluster_principal_assignments_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_cluster_principal_assignments_operations.py @@ -5,25 +5,227 @@ # 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_check_name_availability_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkPrincipalAssignmentNameAvailability') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + 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_name: str, + principal_assignment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "principalAssignmentName": _SERIALIZER.url("principal_assignment_name", principal_assignment_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_name: str, + principal_assignment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "principalAssignmentName": _SERIALIZER.url("principal_assignment_name", principal_assignment_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_name: str, + principal_assignment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "principalAssignmentName": _SERIALIZER.url("principal_assignment_name", principal_assignment_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_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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 ClusterPrincipalAssignmentsOperations(object): """ClusterPrincipalAssignmentsOperations operations. @@ -47,14 +249,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - resource_group_name, # type: str - cluster_name, # type: str - principal_assignment_name, # type: "_models.ClusterPrincipalAssignmentCheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + resource_group_name: str, + cluster_name: str, + principal_assignment_name: "_models.ClusterPrincipalAssignmentCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the principal assignment name is valid and is not already in use. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -62,7 +264,8 @@ def check_name_availability( :param cluster_name: The name of the Kusto cluster. :type cluster_name: str :param principal_assignment_name: The name of the principal assignment. - :type principal_assignment_name: ~kusto_management_client.models.ClusterPrincipalAssignmentCheckNameRequest + :type principal_assignment_name: + ~kusto_management_client.models.ClusterPrincipalAssignmentCheckNameRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameResult, or the result of cls(response) :rtype: ~kusto_management_client.models.CheckNameResult @@ -73,32 +276,22 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(principal_assignment_name, 'ClusterPrincipalAssignmentCheckNameRequest') + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(principal_assignment_name, 'ClusterPrincipalAssignmentCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -112,16 +305,18 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkPrincipalAssignmentNameAvailability'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - principal_assignment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterPrincipalAssignment" + resource_group_name: str, + cluster_name: str, + principal_assignment_name: str, + **kwargs: Any + ) -> "_models.ClusterPrincipalAssignment": """Gets a Kusto cluster principalAssignment. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -140,28 +335,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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_name=cluster_name, + principal_assignment_name=principal_assignment_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 @@ -175,49 +360,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - principal_assignment_name, # type: str - parameters, # type: "_models.ClusterPrincipalAssignment" - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterPrincipalAssignment" + resource_group_name: str, + cluster_name: str, + principal_assignment_name: str, + parameters: "_models.ClusterPrincipalAssignment", + **kwargs: Any + ) -> "_models.ClusterPrincipalAssignment": cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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(parameters, 'ClusterPrincipalAssignment') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + principal_assignment_name=principal_assignment_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(parameters, 'ClusterPrincipalAssignment') - 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 @@ -235,17 +411,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - principal_assignment_name, # type: str - parameters, # type: "_models.ClusterPrincipalAssignment" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ClusterPrincipalAssignment"] + resource_group_name: str, + cluster_name: str, + principal_assignment_name: str, + parameters: "_models.ClusterPrincipalAssignment", + **kwargs: Any + ) -> LROPoller["_models.ClusterPrincipalAssignment"]: """Create a Kusto cluster principalAssignment. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -259,15 +437,20 @@ def begin_create_or_update( :type parameters: ~kusto_management_client.models.ClusterPrincipalAssignment :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 ClusterPrincipalAssignment or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.ClusterPrincipalAssignment] - :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 ClusterPrincipalAssignment or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~kusto_management_client.models.ClusterPrincipalAssignment] + :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.ClusterPrincipalAssignment"] lro_delay = kwargs.pop( 'polling_interval', @@ -280,28 +463,21 @@ def begin_create_or_update( cluster_name=cluster_name, principal_assignment_name=principal_assignment_name, parameters=parameters, + 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('ClusterPrincipalAssignment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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: @@ -313,43 +489,33 @@ 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/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - principal_assignment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + principal_assignment_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-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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_name=cluster_name, + principal_assignment_name=principal_assignment_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 @@ -362,14 +528,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - principal_assignment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + principal_assignment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Kusto cluster principalAssignment. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -380,15 +547,17 @@ def begin_delete( :type principal_assignment_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', @@ -403,22 +572,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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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: @@ -430,15 +591,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ClusterPrincipalAssignmentListResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ClusterPrincipalAssignmentListResult"]: """Lists all Kusto cluster principalAssignments. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -446,8 +608,10 @@ def list( :param cluster_name: The name of the Kusto 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 ClusterPrincipalAssignmentListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.ClusterPrincipalAssignmentListResult] + :return: An iterator like instance of either ClusterPrincipalAssignmentListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~kusto_management_client.models.ClusterPrincipalAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterPrincipalAssignmentListResult"] @@ -455,36 +619,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - '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_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_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('ClusterPrincipalAssignmentListResult', pipeline_response) + deserialized = self._deserialize("ClusterPrincipalAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -502,6 +663,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_clusters_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_clusters_operations.py index 9548cd4332da..c0d5fc083526 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_clusters_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_clusters_operations.py @@ -5,25 +5,709 @@ # 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( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + if if_none_match is not None: + header_parameters['If-None-Match'] = _SERIALIZER.header("if_none_match", if_none_match, 'str') + 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( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + if_match: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if if_match is not None: + header_parameters['If-Match'] = _SERIALIZER.header("if_match", if_match, 'str') + 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( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_stop_request_initial( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_start_request_initial( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_follower_databases_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listFollowerDatabases') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_detach_follower_databases_request_initial( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_diagnose_virtual_network_request_initial( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/diagnoseVirtualNetwork') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_skus_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_check_name_availability_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "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] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_skus_by_resource_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/skus') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_outbound_network_dependencies_endpoints_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/outboundNetworkDependenciesEndpoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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_list_language_extensions_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listLanguageExtensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_add_language_extensions_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_remove_language_extensions_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ClustersOperations(object): """ClustersOperations operations. @@ -47,13 +731,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.Cluster": """Gets a Kusto cluster. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -70,27 +754,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_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 @@ -104,53 +778,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.Cluster" - if_match=None, # type: Optional[str] - if_none_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + cluster_name: str, + parameters: "_models.Cluster", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.Cluster": cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - if if_none_match is not None: - header_parameters['If-None-Match'] = self._serialize.header("if_none_match", if_none_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Cluster') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Cluster') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + if_none_match=if_none_match, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -168,18 +831,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.Cluster" - if_match=None, # type: Optional[str] - if_none_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Cluster"] + resource_group_name: str, + cluster_name: str, + parameters: "_models.Cluster", + if_match: Optional[str] = None, + if_none_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller["_models.Cluster"]: """Create or update a Kusto cluster. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -197,15 +862,18 @@ def begin_create_or_update( :type if_none_match: 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 Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', @@ -219,27 +887,21 @@ def begin_create_or_update( parameters=parameters, if_match=if_match, if_none_match=if_none_match, + 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('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -251,50 +913,39 @@ 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/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterUpdate" - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + cluster_name: str, + parameters: "_models.ClusterUpdate", + if_match: Optional[str] = None, + **kwargs: Any + ) -> "_models.Cluster": cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - if if_match is not None: - header_parameters['If-Match'] = self._serialize.header("if_match", if_match, 'str') - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ClusterUpdate') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + if_match=if_match, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -315,17 +966,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterUpdate" - if_match=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Cluster"] + resource_group_name: str, + cluster_name: str, + parameters: "_models.ClusterUpdate", + if_match: Optional[str] = None, + **kwargs: Any + ) -> LROPoller["_models.Cluster"]: """Update a Kusto cluster. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -340,15 +993,18 @@ def begin_update( :type if_match: 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 Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', @@ -361,27 +1017,21 @@ def begin_update( cluster_name=cluster_name, parameters=parameters, if_match=if_match, + 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('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -393,41 +1043,31 @@ 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/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_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-08-27" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + 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 @@ -440,13 +1080,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Kusto cluster. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -455,15 +1096,17 @@ def begin_delete( :type cluster_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', @@ -477,21 +1120,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -503,41 +1139,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore def _stop_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_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-08-27" - accept = "application/json" - - # Construct URL - url = self._stop_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_stop_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self._stop_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -550,13 +1176,14 @@ def _stop_initial( _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop'} # type: ignore + + @distributed_trace def begin_stop( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Stops a Kusto cluster. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -565,15 +1192,17 @@ def begin_stop( :type cluster_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', @@ -587,21 +1216,14 @@ def begin_stop( 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -613,41 +1235,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop'} # type: ignore def _start_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_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-08-27" - accept = "application/json" - - # Construct URL - url = self._start_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self._start_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -660,13 +1272,14 @@ def _start_initial( _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start'} # type: ignore + + @distributed_trace def begin_start( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Starts a Kusto cluster. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -675,15 +1288,17 @@ def begin_start( :type cluster_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', @@ -697,21 +1312,14 @@ def begin_start( 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -723,15 +1331,16 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start'} # type: ignore + @distributed_trace def list_follower_databases( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.FollowerDatabaseListResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.FollowerDatabaseListResult"]: """Returns a list of databases that are owned by this cluster and were followed by another cluster. @@ -740,8 +1349,10 @@ def list_follower_databases( :param cluster_name: The name of the Kusto 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 FollowerDatabaseListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.FollowerDatabaseListResult] + :return: An iterator like instance of either FollowerDatabaseListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~kusto_management_client.models.FollowerDatabaseListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.FollowerDatabaseListResult"] @@ -749,36 +1360,33 @@ def list_follower_databases( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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_follower_databases.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_follower_databases_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self.list_follower_databases.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_follower_databases_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('FollowerDatabaseListResult', pipeline_response) + deserialized = self._deserialize("FollowerDatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -796,6 +1404,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -803,43 +1412,32 @@ def get_next(next_link=None): def _detach_follower_databases_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - follower_database_to_remove, # type: "_models.FollowerDatabaseDefinition" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + follower_database_to_remove: "_models.FollowerDatabaseDefinition", + **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-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._detach_follower_databases_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(follower_database_to_remove, 'FollowerDatabaseDefinition') + + request = build_detach_follower_databases_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._detach_follower_databases_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(follower_database_to_remove, 'FollowerDatabaseDefinition') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -852,14 +1450,15 @@ def _detach_follower_databases_initial( _detach_follower_databases_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases'} # type: ignore + + @distributed_trace def begin_detach_follower_databases( self, - resource_group_name, # type: str - cluster_name, # type: str - follower_database_to_remove, # type: "_models.FollowerDatabaseDefinition" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + follower_database_to_remove: "_models.FollowerDatabaseDefinition", + **kwargs: Any + ) -> LROPoller[None]: """Detaches all followers of a database owned by this cluster. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -870,15 +1469,18 @@ def begin_detach_follower_databases( :type follower_database_to_remove: ~kusto_management_client.models.FollowerDatabaseDefinition :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] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -890,24 +1492,18 @@ def begin_detach_follower_databases( resource_group_name=resource_group_name, cluster_name=cluster_name, follower_database_to_remove=follower_database_to_remove, + 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): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -919,41 +1515,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_detach_follower_databases.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases'} # type: ignore def _diagnose_virtual_network_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.DiagnoseVirtualNetworkResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Optional["_models.DiagnoseVirtualNetworkResult"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DiagnoseVirtualNetworkResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self._diagnose_virtual_network_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_diagnose_virtual_network_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self._diagnose_virtual_network_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -969,15 +1555,17 @@ def _diagnose_virtual_network_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _diagnose_virtual_network_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/diagnoseVirtualNetwork'} # type: ignore + + @distributed_trace def begin_diagnose_virtual_network( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DiagnoseVirtualNetworkResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller["_models.DiagnoseVirtualNetworkResult"]: """Diagnoses network connectivity status for external resources on which the service is dependent on. @@ -987,15 +1575,19 @@ def begin_diagnose_virtual_network( :type cluster_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. - :return: An instance of LROPoller that returns either DiagnoseVirtualNetworkResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.DiagnoseVirtualNetworkResult] - :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 DiagnoseVirtualNetworkResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~kusto_management_client.models.DiagnoseVirtualNetworkResult] + :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["_models.DiagnoseVirtualNetworkResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -1009,24 +1601,17 @@ def begin_diagnose_virtual_network( 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('DiagnoseVirtualNetworkResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1038,14 +1623,15 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_diagnose_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/diagnoseVirtualNetwork'} # type: ignore + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ClusterListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ClusterListResult"]: """Lists all Kusto clusters within a resource group. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -1060,35 +1646,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterListResult', pipeline_response) + deserialized = self._deserialize("ClusterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1106,16 +1688,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters'} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ClusterListResult"] + **kwargs: Any + ) -> Iterable["_models.ClusterListResult"]: """Lists all Kusto clusters within a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1128,34 +1711,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterListResult', pipeline_response) + deserialized = self._deserialize("ClusterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1173,16 +1751,17 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters'} # type: ignore + @distributed_trace def list_skus( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SkuDescriptionList"] + **kwargs: Any + ) -> Iterable["_models.SkuDescriptionList"]: """Lists eligible SKUs for Kusto resource provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1195,34 +1774,29 @@ def list_skus( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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_skus.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_request( + subscription_id=self._config.subscription_id, + template_url=self.list_skus.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_skus_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SkuDescriptionList', pipeline_response) + deserialized = self._deserialize("SkuDescriptionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1240,18 +1814,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_skus.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus'} # type: ignore + @distributed_trace def check_name_availability( self, - location, # type: str - cluster_name, # type: "_models.ClusterCheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + location: str, + cluster_name: "_models.ClusterCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the cluster name is valid and is not already in use. :param location: Azure location (region) name. @@ -1268,31 +1843,21 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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') + 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(cluster_name, 'ClusterCheckNameRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(cluster_name, 'ClusterCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1306,15 +1871,17 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_skus_by_resource( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ListResourceSkusResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ListResourceSkusResult"]: """Returns the SKUs available for the provided resource. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -1322,7 +1889,8 @@ def list_skus_by_resource( :param cluster_name: The name of the Kusto 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 ListResourceSkusResult or the result of cls(response) + :return: An iterator like instance of either ListResourceSkusResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.ListResourceSkusResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1331,36 +1899,33 @@ def list_skus_by_resource( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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_skus_by_resource.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_skus_by_resource_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self.list_skus_by_resource.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_skus_by_resource_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ListResourceSkusResult', pipeline_response) + deserialized = self._deserialize("ListResourceSkusResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1378,18 +1943,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_skus_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/skus'} # type: ignore + @distributed_trace def list_outbound_network_dependencies_endpoints( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OutboundNetworkDependenciesEndpointListResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.OutboundNetworkDependenciesEndpointListResult"]: """Gets the network endpoints of all outbound dependencies of a Kusto cluster. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -1397,8 +1963,10 @@ def list_outbound_network_dependencies_endpoints( :param cluster_name: The name of the Kusto 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 OutboundNetworkDependenciesEndpointListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.OutboundNetworkDependenciesEndpointListResult] + :return: An iterator like instance of either OutboundNetworkDependenciesEndpointListResult or + the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~kusto_management_client.models.OutboundNetworkDependenciesEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OutboundNetworkDependenciesEndpointListResult"] @@ -1406,36 +1974,33 @@ def list_outbound_network_dependencies_endpoints( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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_outbound_network_dependencies_endpoints.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'), - '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_outbound_network_dependencies_endpoints_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.list_outbound_network_dependencies_endpoints.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_outbound_network_dependencies_endpoints_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('OutboundNetworkDependenciesEndpointListResult', pipeline_response) + deserialized = self._deserialize("OutboundNetworkDependenciesEndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1453,18 +2018,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_outbound_network_dependencies_endpoints.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/outboundNetworkDependenciesEndpoints'} # type: ignore + @distributed_trace def list_language_extensions( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.LanguageExtensionsList"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.LanguageExtensionsList"]: """Returns a list of language extensions that can run within KQL queries. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -1472,7 +2038,8 @@ def list_language_extensions( :param cluster_name: The name of the Kusto 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 LanguageExtensionsList or the result of cls(response) + :return: An iterator like instance of either LanguageExtensionsList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.LanguageExtensionsList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -1481,36 +2048,33 @@ def list_language_extensions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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_language_extensions.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'), - '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.post(url, query_parameters, header_parameters) + + request = build_list_language_extensions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + template_url=self.list_language_extensions.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_language_extensions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_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('LanguageExtensionsList', pipeline_response) + deserialized = self._deserialize("LanguageExtensionsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -1528,6 +2092,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -1535,43 +2100,32 @@ def get_next(next_link=None): def _add_language_extensions_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - language_extensions_to_add, # type: "_models.LanguageExtensionsList" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + language_extensions_to_add: "_models.LanguageExtensionsList", + **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-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._add_language_extensions_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'), - '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') + 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(language_extensions_to_add, 'LanguageExtensionsList') + + request = build_add_language_extensions_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self._add_language_extensions_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(language_extensions_to_add, 'LanguageExtensionsList') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1584,14 +2138,15 @@ def _add_language_extensions_initial( _add_language_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions'} # type: ignore + + @distributed_trace def begin_add_language_extensions( self, - resource_group_name, # type: str - cluster_name, # type: str - language_extensions_to_add, # type: "_models.LanguageExtensionsList" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + language_extensions_to_add: "_models.LanguageExtensionsList", + **kwargs: Any + ) -> LROPoller[None]: """Add a list of language extensions that can run within KQL queries. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -1602,15 +2157,18 @@ def begin_add_language_extensions( :type language_extensions_to_add: ~kusto_management_client.models.LanguageExtensionsList :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] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1622,24 +2180,18 @@ def begin_add_language_extensions( resource_group_name=resource_group_name, cluster_name=cluster_name, language_extensions_to_add=language_extensions_to_add, + 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): 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_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: @@ -1651,47 +2203,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_add_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions'} # type: ignore def _remove_language_extensions_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - language_extensions_to_remove, # type: "_models.LanguageExtensionsList" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + language_extensions_to_remove: "_models.LanguageExtensionsList", + **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-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._remove_language_extensions_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'), - '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') + 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(language_extensions_to_remove, 'LanguageExtensionsList') + + request = build_remove_language_extensions_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + content_type=content_type, + json=_json, + template_url=self._remove_language_extensions_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(language_extensions_to_remove, 'LanguageExtensionsList') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1704,14 +2246,15 @@ def _remove_language_extensions_initial( _remove_language_extensions_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions'} # type: ignore + + @distributed_trace def begin_remove_language_extensions( self, - resource_group_name, # type: str - cluster_name, # type: str - language_extensions_to_remove, # type: "_models.LanguageExtensionsList" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + language_extensions_to_remove: "_models.LanguageExtensionsList", + **kwargs: Any + ) -> LROPoller[None]: """Remove a list of language extensions that can run within KQL queries. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -1722,15 +2265,18 @@ def begin_remove_language_extensions( :type language_extensions_to_remove: ~kusto_management_client.models.LanguageExtensionsList :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] + 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[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1742,24 +2288,18 @@ def begin_remove_language_extensions( resource_group_name=resource_group_name, cluster_name=cluster_name, language_extensions_to_remove=language_extensions_to_remove, + 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): 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_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: @@ -1771,4 +2311,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_remove_language_extensions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions'} # type: ignore diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_data_connections_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_data_connections_operations.py index 50906d690f4d..4207bb1e1d2c 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_data_connections_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_data_connections_operations.py @@ -5,25 +5,331 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_database_request( + resource_group_name: str, + cluster_name: str, + database_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_data_connection_validation_request_initial( + resource_group_name: str, + cluster_name: str, + database_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnectionValidation') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_check_name_availability_request( + resource_group_name: str, + cluster_name: str, + database_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkNameAvailability') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "dataConnectionName": _SERIALIZER.url("data_connection_name", data_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "dataConnectionName": _SERIALIZER.url("data_connection_name", data_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "dataConnectionName": _SERIALIZER.url("data_connection_name", data_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "dataConnectionName": _SERIALIZER.url("data_connection_name", data_connection_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class DataConnectionsOperations(object): """DataConnectionsOperations operations. @@ -47,14 +353,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_database( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DataConnectionListResult"] + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs: Any + ) -> Iterable["_models.DataConnectionListResult"]: """Returns the list of data connections of the given Kusto database. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -64,7 +370,8 @@ def list_by_database( :param database_name: The name of the database in the Kusto cluster. :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DataConnectionListResult or the result of cls(response) + :return: An iterator like instance of either DataConnectionListResult or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.DataConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -73,37 +380,35 @@ def list_by_database( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_database.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_database_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_database.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_database_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DataConnectionListResult', pipeline_response) + deserialized = self._deserialize("DataConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,6 +426,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) @@ -128,45 +434,34 @@ def get_next(next_link=None): def _data_connection_validation_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - parameters, # type: "_models.DataConnectionValidation" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.DataConnectionValidationListResult"] + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "_models.DataConnectionValidation", + **kwargs: Any + ) -> Optional["_models.DataConnectionValidationListResult"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.DataConnectionValidationListResult"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._data_connection_validation_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataConnectionValidation') + + request = build_data_connection_validation_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self._data_connection_validation_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(parameters, 'DataConnectionValidation') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -182,17 +477,19 @@ def _data_connection_validation_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _data_connection_validation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnectionValidation'} # type: ignore + + @distributed_trace def begin_data_connection_validation( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - parameters, # type: "_models.DataConnectionValidation" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataConnectionValidationListResult"] + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "_models.DataConnectionValidation", + **kwargs: Any + ) -> LROPoller["_models.DataConnectionValidationListResult"]: """Checks that the data connection parameters are valid. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -205,15 +502,20 @@ def begin_data_connection_validation( :type parameters: ~kusto_management_client.models.DataConnectionValidation :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 DataConnectionValidationListResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.DataConnectionValidationListResult] - :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 DataConnectionValidationListResult or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~kusto_management_client.models.DataConnectionValidationListResult] + :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.DataConnectionValidationListResult"] lro_delay = kwargs.pop( 'polling_interval', @@ -226,28 +528,21 @@ def begin_data_connection_validation( cluster_name=cluster_name, database_name=database_name, parameters=parameters, + 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('DataConnectionValidationListResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -259,17 +554,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_data_connection_validation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnectionValidation'} # type: ignore + @distributed_trace def check_name_availability( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - data_connection_name, # type: "_models.DataConnectionCheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: "_models.DataConnectionCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the data connection name is valid and is not already in use. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -290,33 +586,23 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(data_connection_name, 'DataConnectionCheckNameRequest') + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(data_connection_name, 'DataConnectionCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -330,17 +616,19 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkNameAvailability'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - data_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DataConnection" + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + **kwargs: Any + ) -> "_models.DataConnection": """Returns a data connection. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -361,29 +649,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + subscription_id=self._config.subscription_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 @@ -397,51 +675,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - data_connection_name, # type: str - parameters, # type: "_models.DataConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataConnection" + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + parameters: "_models.DataConnection", + **kwargs: Any + ) -> "_models.DataConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataConnection') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'DataConnection') - 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 @@ -462,18 +731,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - data_connection_name, # type: str - parameters, # type: "_models.DataConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataConnection"] + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + parameters: "_models.DataConnection", + **kwargs: Any + ) -> LROPoller["_models.DataConnection"]: """Creates or updates a data connection. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -488,15 +759,19 @@ def begin_create_or_update( :type parameters: ~kusto_management_client.models.DataConnection :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 DataConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataConnection or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.DataConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -510,29 +785,21 @@ def begin_create_or_update( database_name=database_name, data_connection_name=data_connection_name, parameters=parameters, + 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('DataConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -544,51 +811,41 @@ 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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - data_connection_name, # type: str - parameters, # type: "_models.DataConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.DataConnection" + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + parameters: "_models.DataConnection", + **kwargs: Any + ) -> "_models.DataConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'DataConnection') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'DataConnection') - 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 @@ -609,18 +866,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - data_connection_name, # type: str - parameters, # type: "_models.DataConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DataConnection"] + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + parameters: "_models.DataConnection", + **kwargs: Any + ) -> LROPoller["_models.DataConnection"]: """Updates a data connection. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -635,15 +894,19 @@ def begin_update( :type parameters: ~kusto_management_client.models.DataConnection :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 DataConnection or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either DataConnection or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.DataConnection] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.DataConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -657,29 +920,21 @@ def begin_update( database_name=database_name, data_connection_name=data_connection_name, parameters=parameters, + 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('DataConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -691,45 +946,35 @@ 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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - data_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_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-08-27" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + subscription_id=self._config.subscription_id, + 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 @@ -742,15 +987,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - data_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the data connection with the given name. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -763,15 +1009,17 @@ def begin_delete( :type data_connection_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', @@ -787,23 +1035,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'dataConnectionName': self._serialize.url("data_connection_name", data_connection_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -815,4 +1054,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_database_principal_assignments_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_database_principal_assignments_operations.py index 4c50d9a84964..9a40cdd0757f 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_database_principal_assignments_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_database_principal_assignments_operations.py @@ -5,25 +5,237 @@ # 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_check_name_availability_request( + resource_group_name: str, + cluster_name: str, + database_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkPrincipalAssignmentNameAvailability') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + 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_name: str, + database_name: str, + principal_assignment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "principalAssignmentName": _SERIALIZER.url("principal_assignment_name", principal_assignment_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_name: str, + database_name: str, + principal_assignment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "principalAssignmentName": _SERIALIZER.url("principal_assignment_name", principal_assignment_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_name: str, + database_name: str, + principal_assignment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "principalAssignmentName": _SERIALIZER.url("principal_assignment_name", principal_assignment_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_name: str, + database_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_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 DatabasePrincipalAssignmentsOperations(object): """DatabasePrincipalAssignmentsOperations operations. @@ -47,15 +259,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - principal_assignment_name, # type: "_models.DatabasePrincipalAssignmentCheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + resource_group_name: str, + cluster_name: str, + database_name: str, + principal_assignment_name: "_models.DatabasePrincipalAssignmentCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the database principal assignment is valid and is not already in use. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -65,7 +277,8 @@ def check_name_availability( :param database_name: The name of the database in the Kusto cluster. :type database_name: str :param principal_assignment_name: The name of the resource. - :type principal_assignment_name: ~kusto_management_client.models.DatabasePrincipalAssignmentCheckNameRequest + :type principal_assignment_name: + ~kusto_management_client.models.DatabasePrincipalAssignmentCheckNameRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameResult, or the result of cls(response) :rtype: ~kusto_management_client.models.CheckNameResult @@ -76,33 +289,23 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(principal_assignment_name, 'DatabasePrincipalAssignmentCheckNameRequest') + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(principal_assignment_name, 'DatabasePrincipalAssignmentCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -116,17 +319,19 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/checkPrincipalAssignmentNameAvailability'} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - principal_assignment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.DatabasePrincipalAssignment" + resource_group_name: str, + cluster_name: str, + database_name: str, + principal_assignment_name: str, + **kwargs: Any + ) -> "_models.DatabasePrincipalAssignment": """Gets a Kusto cluster database principalAssignment. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -147,29 +352,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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_name=cluster_name, + database_name=database_name, + principal_assignment_name=principal_assignment_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 @@ -183,51 +378,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - principal_assignment_name, # type: str - parameters, # type: "_models.DatabasePrincipalAssignment" - **kwargs # type: Any - ): - # type: (...) -> "_models.DatabasePrincipalAssignment" + resource_group_name: str, + cluster_name: str, + database_name: str, + principal_assignment_name: str, + parameters: "_models.DatabasePrincipalAssignment", + **kwargs: Any + ) -> "_models.DatabasePrincipalAssignment": cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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(parameters, 'DatabasePrincipalAssignment') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + principal_assignment_name=principal_assignment_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(parameters, 'DatabasePrincipalAssignment') - 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 @@ -245,18 +431,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - principal_assignment_name, # type: str - parameters, # type: "_models.DatabasePrincipalAssignment" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.DatabasePrincipalAssignment"] + resource_group_name: str, + cluster_name: str, + database_name: str, + principal_assignment_name: str, + parameters: "_models.DatabasePrincipalAssignment", + **kwargs: Any + ) -> LROPoller["_models.DatabasePrincipalAssignment"]: """Creates a Kusto cluster database principalAssignment. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -271,15 +459,20 @@ def begin_create_or_update( :type parameters: ~kusto_management_client.models.DatabasePrincipalAssignment :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 DatabasePrincipalAssignment or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.DatabasePrincipalAssignment] - :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 DatabasePrincipalAssignment or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~kusto_management_client.models.DatabasePrincipalAssignment] + :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.DatabasePrincipalAssignment"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,29 +486,21 @@ def begin_create_or_update( database_name=database_name, principal_assignment_name=principal_assignment_name, parameters=parameters, + 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('DatabasePrincipalAssignment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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: @@ -327,45 +512,35 @@ 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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - principal_assignment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + database_name: str, + principal_assignment_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-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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_name=cluster_name, + database_name=database_name, + principal_assignment_name=principal_assignment_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 @@ -378,15 +553,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - principal_assignment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + database_name: str, + principal_assignment_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Kusto principalAssignment. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -399,15 +575,17 @@ def begin_delete( :type principal_assignment_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', @@ -423,23 +601,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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'principalAssignmentName': self._serialize.url("principal_assignment_name", principal_assignment_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: @@ -451,16 +620,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DatabasePrincipalAssignmentListResult"] + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs: Any + ) -> Iterable["_models.DatabasePrincipalAssignmentListResult"]: """Lists all Kusto cluster database principalAssignments. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -470,8 +640,10 @@ def list( :param database_name: The name of the database in the Kusto cluster. :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatabasePrincipalAssignmentListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.DatabasePrincipalAssignmentListResult] + :return: An iterator like instance of either DatabasePrincipalAssignmentListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~kusto_management_client.models.DatabasePrincipalAssignmentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalAssignmentListResult"] @@ -479,37 +651,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_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_name=cluster_name, + database_name=database_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_name=cluster_name, + database_name=database_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('DatabasePrincipalAssignmentListResult', pipeline_response) + deserialized = self._deserialize("DatabasePrincipalAssignmentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -527,6 +697,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_databases_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_databases_operations.py index c27615f1cd5f..59fdf00bde42 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_databases_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_databases_operations.py @@ -5,25 +5,402 @@ # 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_check_name_availability_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkNameAvailability') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_cluster_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + cluster_name: str, + database_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + cluster_name: str, + database_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + cluster_name: str, + database_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + cluster_name: str, + database_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_principals_request( + resource_group_name: str, + cluster_name: str, + database_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/listPrincipals') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_add_principals_request( + resource_group_name: str, + cluster_name: str, + database_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/addPrincipals') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_remove_principals_request( + resource_group_name: str, + cluster_name: str, + database_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/removePrincipals') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class DatabasesOperations(object): """DatabasesOperations operations. @@ -47,14 +424,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - resource_group_name, # type: str - cluster_name, # type: str - resource_name, # type: "_models.CheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + resource_group_name: str, + cluster_name: str, + resource_name: "_models.CheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the databases resource name is valid and is not already in use. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -73,32 +450,22 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(resource_name, 'CheckNameRequest') - # 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_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(resource_name, 'CheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -112,15 +479,17 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkNameAvailability'} # type: ignore + + @distributed_trace def list_by_cluster( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DatabaseListResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.DatabaseListResult"]: """Returns the list of databases of the given Kusto cluster. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -137,36 +506,33 @@ def list_by_cluster( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_cluster.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_cluster.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_cluster_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DatabaseListResult', pipeline_response) + deserialized = self._deserialize("DatabaseListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -184,19 +550,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_cluster.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Database" + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs: Any + ) -> "_models.Database": """Returns a database. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -215,28 +582,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_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 @@ -250,49 +607,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - parameters, # type: "_models.Database" - **kwargs # type: Any - ): - # type: (...) -> "_models.Database" + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "_models.Database", + **kwargs: Any + ) -> "_models.Database": cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(parameters, 'Database') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'Database') - 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 @@ -313,17 +661,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - parameters, # type: "_models.Database" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Database"] + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "_models.Database", + **kwargs: Any + ) -> LROPoller["_models.Database"]: """Creates or updates a database. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -336,15 +686,18 @@ def begin_create_or_update( :type parameters: ~kusto_management_client.models.Database :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 Database or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.Database] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] lro_delay = kwargs.pop( 'polling_interval', @@ -357,28 +710,21 @@ def begin_create_or_update( cluster_name=cluster_name, database_name=database_name, parameters=parameters, + 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('Database', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -390,49 +736,39 @@ 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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - parameters, # type: "_models.Database" - **kwargs # type: Any - ): - # type: (...) -> "_models.Database" + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "_models.Database", + **kwargs: Any + ) -> "_models.Database": cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Database') - # 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( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + 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(parameters, 'Database') - 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 @@ -453,17 +789,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - parameters, # type: "_models.Database" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Database"] + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "_models.Database", + **kwargs: Any + ) -> LROPoller["_models.Database"]: """Updates a database. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -476,15 +814,18 @@ def begin_update( :type parameters: ~kusto_management_client.models.Database :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 Database or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.Database] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Database"] lro_delay = kwargs.pop( 'polling_interval', @@ -497,28 +838,21 @@ def begin_update( cluster_name=cluster_name, database_name=database_name, parameters=parameters, + 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('Database', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -530,43 +864,33 @@ 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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + database_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-08-27" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + 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 @@ -579,14 +903,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes the database with the given name. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -597,15 +922,17 @@ def begin_delete( :type database_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', @@ -620,22 +947,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 = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, '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: @@ -647,16 +966,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore + @distributed_trace def list_principals( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DatabasePrincipalListResult"] + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs: Any + ) -> Iterable["_models.DatabasePrincipalListResult"]: """Returns a list of database principals of the given Kusto cluster and database. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -666,8 +986,10 @@ def list_principals( :param database_name: The name of the database in the Kusto cluster. :type database_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either DatabasePrincipalListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.DatabasePrincipalListResult] + :return: An iterator like instance of either DatabasePrincipalListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~kusto_management_client.models.DatabasePrincipalListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.DatabasePrincipalListResult"] @@ -675,37 +997,35 @@ def list_principals( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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_principals.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.post(url, query_parameters, header_parameters) + + request = build_list_principals_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + template_url=self.list_principals.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_principals_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('DatabasePrincipalListResult', pipeline_response) + deserialized = self._deserialize("DatabasePrincipalListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -723,20 +1043,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_principals.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/listPrincipals'} # type: ignore + @distributed_trace def add_principals( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - database_principals_to_add, # type: "_models.DatabasePrincipalListRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.DatabasePrincipalListResult" + resource_group_name: str, + cluster_name: str, + database_name: str, + database_principals_to_add: "_models.DatabasePrincipalListRequest", + **kwargs: Any + ) -> "_models.DatabasePrincipalListResult": """Add Database principals permissions. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -757,33 +1078,23 @@ def add_principals( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.add_principals.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(database_principals_to_add, 'DatabasePrincipalListRequest') + + request = build_add_principals_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.add_principals.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(database_principals_to_add, 'DatabasePrincipalListRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -797,17 +1108,19 @@ def add_principals( return cls(pipeline_response, deserialized, {}) return deserialized + add_principals.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/addPrincipals'} # type: ignore + + @distributed_trace def remove_principals( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - database_principals_to_remove, # type: "_models.DatabasePrincipalListRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.DatabasePrincipalListResult" + resource_group_name: str, + cluster_name: str, + database_name: str, + database_principals_to_remove: "_models.DatabasePrincipalListRequest", + **kwargs: Any + ) -> "_models.DatabasePrincipalListResult": """Remove Database principals permissions. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -817,7 +1130,8 @@ def remove_principals( :param database_name: The name of the database in the Kusto cluster. :type database_name: str :param database_principals_to_remove: List of database principals to remove. - :type database_principals_to_remove: ~kusto_management_client.models.DatabasePrincipalListRequest + :type database_principals_to_remove: + ~kusto_management_client.models.DatabasePrincipalListRequest :keyword callable cls: A custom type or function that will be passed the direct response :return: DatabasePrincipalListResult, or the result of cls(response) :rtype: ~kusto_management_client.models.DatabasePrincipalListResult @@ -828,33 +1142,23 @@ def remove_principals( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.remove_principals.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(database_principals_to_remove, 'DatabasePrincipalListRequest') + + request = build_remove_principals_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.remove_principals.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(database_principals_to_remove, 'DatabasePrincipalListRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -868,4 +1172,6 @@ def remove_principals( return cls(pipeline_response, deserialized, {}) return deserialized + remove_principals.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/removePrincipals'} # type: ignore + diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_managed_private_endpoints_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_managed_private_endpoints_operations.py index 7ce935eb26b3..0c04ae517b22 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_managed_private_endpoints_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_managed_private_endpoints_operations.py @@ -5,25 +5,273 @@ # 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_check_name_availability_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpointsCheckNameAvailability') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + 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_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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_name: str, + managed_private_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "managedPrivateEndpointName": _SERIALIZER.url("managed_private_endpoint_name", managed_private_endpoint_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_name: str, + managed_private_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "managedPrivateEndpointName": _SERIALIZER.url("managed_private_endpoint_name", managed_private_endpoint_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_name: str, + managed_private_endpoint_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "managedPrivateEndpointName": _SERIALIZER.url("managed_private_endpoint_name", managed_private_endpoint_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_name: str, + managed_private_endpoint_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "managedPrivateEndpointName": _SERIALIZER.url("managed_private_endpoint_name", managed_private_endpoint_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class ManagedPrivateEndpointsOperations(object): """ManagedPrivateEndpointsOperations operations. @@ -47,14 +295,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - resource_group_name, # type: str - cluster_name, # type: str - resource_name, # type: "_models.ManagedPrivateEndpointsCheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + resource_group_name: str, + cluster_name: str, + resource_name: "_models.ManagedPrivateEndpointsCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the managed private endpoints resource name is valid and is not already in use. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -73,32 +321,22 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(resource_name, 'ManagedPrivateEndpointsCheckNameRequest') + + request = build_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(resource_name, 'ManagedPrivateEndpointsCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -112,15 +350,17 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpointsCheckNameAvailability'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ManagedPrivateEndpointListResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ManagedPrivateEndpointListResult"]: """Returns the list of managed private endpoints. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -128,8 +368,10 @@ def list( :param cluster_name: The name of the Kusto 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 ManagedPrivateEndpointListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.ManagedPrivateEndpointListResult] + :return: An iterator like instance of either ManagedPrivateEndpointListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~kusto_management_client.models.ManagedPrivateEndpointListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedPrivateEndpointListResult"] @@ -137,36 +379,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - '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_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_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('ManagedPrivateEndpointListResult', pipeline_response) + deserialized = self._deserialize("ManagedPrivateEndpointListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -184,19 +423,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - managed_private_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedPrivateEndpoint" + resource_group_name: str, + cluster_name: str, + managed_private_endpoint_name: str, + **kwargs: Any + ) -> "_models.ManagedPrivateEndpoint": """Gets a managed private endpoint. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -215,28 +455,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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_name=cluster_name, + managed_private_endpoint_name=managed_private_endpoint_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 @@ -250,49 +480,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - managed_private_endpoint_name, # type: str - parameters, # type: "_models.ManagedPrivateEndpoint" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedPrivateEndpoint" + resource_group_name: str, + cluster_name: str, + managed_private_endpoint_name: str, + parameters: "_models.ManagedPrivateEndpoint", + **kwargs: Any + ) -> "_models.ManagedPrivateEndpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedPrivateEndpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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(parameters, 'ManagedPrivateEndpoint') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + managed_private_endpoint_name=managed_private_endpoint_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(parameters, 'ManagedPrivateEndpoint') - 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 @@ -313,17 +534,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - managed_private_endpoint_name, # type: str - parameters, # type: "_models.ManagedPrivateEndpoint" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ManagedPrivateEndpoint"] + resource_group_name: str, + cluster_name: str, + managed_private_endpoint_name: str, + parameters: "_models.ManagedPrivateEndpoint", + **kwargs: Any + ) -> LROPoller["_models.ManagedPrivateEndpoint"]: """Creates a managed private endpoint. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -336,15 +559,19 @@ def begin_create_or_update( :type parameters: ~kusto_management_client.models.ManagedPrivateEndpoint :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 ManagedPrivateEndpoint or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedPrivateEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.ManagedPrivateEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedPrivateEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -357,28 +584,21 @@ def begin_create_or_update( cluster_name=cluster_name, managed_private_endpoint_name=managed_private_endpoint_name, parameters=parameters, + 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('ManagedPrivateEndpoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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: @@ -390,49 +610,39 @@ 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/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - managed_private_endpoint_name, # type: str - parameters, # type: "_models.ManagedPrivateEndpoint" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedPrivateEndpoint" + resource_group_name: str, + cluster_name: str, + managed_private_endpoint_name: str, + parameters: "_models.ManagedPrivateEndpoint", + **kwargs: Any + ) -> "_models.ManagedPrivateEndpoint": cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedPrivateEndpoint"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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(parameters, 'ManagedPrivateEndpoint') - # 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_name=cluster_name, + managed_private_endpoint_name=managed_private_endpoint_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(parameters, 'ManagedPrivateEndpoint') - 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 @@ -450,17 +660,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_name, # type: str - managed_private_endpoint_name, # type: str - parameters, # type: "_models.ManagedPrivateEndpoint" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ManagedPrivateEndpoint"] + resource_group_name: str, + cluster_name: str, + managed_private_endpoint_name: str, + parameters: "_models.ManagedPrivateEndpoint", + **kwargs: Any + ) -> LROPoller["_models.ManagedPrivateEndpoint"]: """Updates a managed private endpoint. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -473,15 +685,19 @@ def begin_update( :type parameters: ~kusto_management_client.models.ManagedPrivateEndpoint :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 ManagedPrivateEndpoint or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedPrivateEndpoint or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.ManagedPrivateEndpoint] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedPrivateEndpoint"] lro_delay = kwargs.pop( 'polling_interval', @@ -494,28 +710,21 @@ def begin_update( cluster_name=cluster_name, managed_private_endpoint_name=managed_private_endpoint_name, parameters=parameters, + 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('ManagedPrivateEndpoint', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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: @@ -527,43 +736,33 @@ 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/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - managed_private_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + managed_private_endpoint_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-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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_name=cluster_name, + managed_private_endpoint_name=managed_private_endpoint_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 @@ -576,14 +775,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - managed_private_endpoint_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + managed_private_endpoint_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a managed private endpoint. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -594,15 +794,17 @@ def begin_delete( :type managed_private_endpoint_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', @@ -617,22 +819,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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'managedPrivateEndpointName': self._serialize.url("managed_private_endpoint_name", managed_private_endpoint_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: @@ -644,4 +838,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/managedPrivateEndpoints/{managedPrivateEndpointName}'} # type: ignore diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations.py index 5ea3e2a77050..344ffdf7881d 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/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-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.Kusto/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,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists available operations for the Microsoft.Kusto provider. :keyword callable cls: A custom type or function that will be passed the direct response @@ -62,30 +89,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -103,6 +127,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations_results_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations_results_operations.py index f0329491c150..b1f8fae8b158 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations_results_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_operations_results_operations.py @@ -5,22 +5,59 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +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, + location: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/operationresults/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, '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 OperationsResultsOperations(object): """OperationsResultsOperations operations. @@ -44,13 +81,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - operation_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.OperationResult" + location: str, + operation_id: str, + **kwargs: Any + ) -> "_models.OperationResult": """Returns operation results. :param location: Azure location (region) name. @@ -67,27 +104,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'location': self._serialize.url("location", location, '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, + location=location, + 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 @@ -101,4 +128,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/operationresults/{operationId}'} # type: ignore + diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_endpoint_connections_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_endpoint_connections_operations.py index 32cb1d1b8130..409a7b99ce9a 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_endpoint_connections_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_endpoint_connections_operations.py @@ -5,25 +5,183 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_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_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_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_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -47,13 +205,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: """Returns the list of private endpoint connections. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -61,8 +219,10 @@ def list( :param cluster_name: The name of the Kusto 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 PrivateEndpointConnectionListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.PrivateEndpointConnectionListResult] + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~kusto_management_client.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] @@ -70,36 +230,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - '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_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_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('PrivateEndpointConnectionListResult', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +274,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": """Gets a private endpoint connection. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -148,28 +306,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_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 @@ -183,49 +331,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - private_endpoint_connection_name, # type: str - parameters, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnection" + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + parameters: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnection": cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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(parameters, 'PrivateEndpointConnection') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_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(parameters, 'PrivateEndpointConnection') - 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 @@ -243,17 +382,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - private_endpoint_connection_name, # type: str - parameters, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.PrivateEndpointConnection"] + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + parameters: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> LROPoller["_models.PrivateEndpointConnection"]: """Approve or reject a private endpoint connection with a given name. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -266,15 +407,20 @@ def begin_create_or_update( :type parameters: ~kusto_management_client.models.PrivateEndpointConnection :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 PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.PrivateEndpointConnection] - :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 PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~kusto_management_client.models.PrivateEndpointConnection] + :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.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', @@ -287,28 +433,21 @@ def begin_create_or_update( cluster_name=cluster_name, private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, + 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('PrivateEndpointConnection', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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: @@ -320,43 +459,33 @@ 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/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_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-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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_name=cluster_name, + private_endpoint_connection_name=private_endpoint_connection_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 @@ -369,14 +498,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a private endpoint connection with a given name. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -387,15 +517,17 @@ def begin_delete( :type private_endpoint_connection_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', @@ -410,22 +542,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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_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: @@ -437,4 +561,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_link_resources_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_link_resources_operations.py index 498605b005eb..61f47ce3b22d 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_link_resources_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_private_link_resources_operations.py @@ -5,23 +5,97 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +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_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_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_name: str, + private_link_resource_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "privateLinkResourceName": _SERIALIZER.url("private_link_resource_name", private_link_resource_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 PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourceListResult"]: """Returns the list of private link resources. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -59,8 +133,10 @@ def list( :param cluster_name: The name of the Kusto 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 PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~kusto_management_client.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] @@ -68,36 +144,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - '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_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_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('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -115,19 +188,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - private_link_resource_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateLinkResource" + resource_group_name: str, + cluster_name: str, + private_link_resource_name: str, + **kwargs: Any + ) -> "_models.PrivateLinkResource": """Gets a private link resource. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -146,28 +220,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'privateLinkResourceName': self._serialize.url("private_link_resource_name", private_link_resource_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_name=cluster_name, + private_link_resource_name=private_link_resource_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 @@ -181,4 +245,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/privateLinkResources/{privateLinkResourceName}'} # type: ignore + diff --git a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_scripts_operations.py b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_scripts_operations.py index a746929566d2..8168bb1b90b2 100644 --- a/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_scripts_operations.py +++ b/sdk/kusto/azure-mgmt-kusto/azure/mgmt/kusto/operations/_scripts_operations.py @@ -5,25 +5,285 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_database_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_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_name: str, + database_name: str, + script_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "scriptName": _SERIALIZER.url("script_name", script_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_name: str, + database_name: str, + script_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "scriptName": _SERIALIZER.url("script_name", script_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_name: str, + database_name: str, + script_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "scriptName": _SERIALIZER.url("script_name", script_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_name: str, + database_name: str, + script_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "scriptName": _SERIALIZER.url("script_name", script_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_check_name_availability_request( + resource_group_name: str, + cluster_name: str, + database_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-27" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scriptsCheckNameAvailability') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "databaseName": _SERIALIZER.url("database_name", database_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class ScriptsOperations(object): """ScriptsOperations operations. @@ -47,14 +307,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_database( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScriptListResult"] + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs: Any + ) -> Iterable["_models.ScriptListResult"]: """Returns the list of database scripts for given database. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -73,37 +333,35 @@ def list_by_database( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_database.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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_database_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + template_url=self.list_by_database.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_database_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_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('ScriptListResult', pipeline_response) + deserialized = self._deserialize("ScriptListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -121,20 +379,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - script_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Script" + resource_group_name: str, + cluster_name: str, + database_name: str, + script_name: str, + **kwargs: Any + ) -> "_models.Script": """Gets a Kusto cluster database script. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -155,29 +414,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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_name=cluster_name, + database_name=database_name, + script_name=script_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 @@ -191,51 +440,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - script_name, # type: str - parameters, # type: "_models.Script" - **kwargs # type: Any - ): - # type: (...) -> "_models.Script" + resource_group_name: str, + cluster_name: str, + database_name: str, + script_name: str, + parameters: "_models.Script", + **kwargs: Any + ) -> "_models.Script": cls = kwargs.pop('cls', None) # type: ClsType["_models.Script"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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(parameters, 'Script') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + script_name=script_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(parameters, 'Script') - 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 @@ -256,18 +496,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - script_name, # type: str - parameters, # type: "_models.Script" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Script"] + resource_group_name: str, + cluster_name: str, + database_name: str, + script_name: str, + parameters: "_models.Script", + **kwargs: Any + ) -> LROPoller["_models.Script"]: """Creates a Kusto database script. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -282,15 +524,18 @@ def begin_create_or_update( :type parameters: ~kusto_management_client.models.Script :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 Script or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.Script] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Script"] lro_delay = kwargs.pop( 'polling_interval', @@ -304,29 +549,21 @@ def begin_create_or_update( database_name=database_name, script_name=script_name, parameters=parameters, + 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('Script', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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: @@ -338,51 +575,41 @@ 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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - script_name, # type: str - parameters, # type: "_models.Script" - **kwargs # type: Any - ): - # type: (...) -> "_models.Script" + resource_group_name: str, + cluster_name: str, + database_name: str, + script_name: str, + parameters: "_models.Script", + **kwargs: Any + ) -> "_models.Script": cls = kwargs.pop('cls', None) # type: ClsType["_models.Script"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - 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'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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(parameters, 'Script') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + script_name=script_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(parameters, 'Script') - 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 @@ -400,18 +627,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - script_name, # type: str - parameters, # type: "_models.Script" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Script"] + resource_group_name: str, + cluster_name: str, + database_name: str, + script_name: str, + parameters: "_models.Script", + **kwargs: Any + ) -> LROPoller["_models.Script"]: """Updates a database script. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -426,15 +655,18 @@ def begin_update( :type parameters: ~kusto_management_client.models.Script :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 Script or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.Script] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Script"] lro_delay = kwargs.pop( 'polling_interval', @@ -448,29 +680,21 @@ def begin_update( database_name=database_name, script_name=script_name, parameters=parameters, + 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('Script', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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: @@ -482,45 +706,35 @@ 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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - script_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + database_name: str, + script_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-08-27" - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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_name=cluster_name, + database_name=database_name, + script_name=script_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 @@ -533,15 +747,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - script_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + database_name: str, + script_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Kusto principalAssignment. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -554,15 +769,17 @@ def begin_delete( :type script_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', @@ -578,23 +795,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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'scriptName': self._serialize.url("script_name", script_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: @@ -606,17 +814,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/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scripts/{scriptName}'} # type: ignore + @distributed_trace def check_name_availability( self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - script_name, # type: "_models.ScriptCheckNameRequest" - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckNameResult" + resource_group_name: str, + cluster_name: str, + database_name: str, + script_name: "_models.ScriptCheckNameRequest", + **kwargs: Any + ) -> "_models.CheckNameResult": """Checks that the script name is valid and is not already in use. :param resource_group_name: The name of the resource group containing the Kusto cluster. @@ -637,33 +846,23 @@ def check_name_availability( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-08-27" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'databaseName': self._serialize.url("database_name", database_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(script_name, 'ScriptCheckNameRequest') - # 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_check_name_availability_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.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(script_name, 'ScriptCheckNameRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -677,4 +876,6 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/scriptsCheckNameAvailability'} # type: ignore +