From a817605e6522ac5102c6c6cf8ab0804f860fe0f6 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 12 Jul 2021 03:21:11 +0000 Subject: [PATCH] CodeGen from PR 15149 in Azure/azure-rest-api-specs Merge 6864adf0715ccefeda4a82f74ff098cc7bc77728 into 5e85541d5c4d00459a8e2dcb14512c964e2c1ce9 --- src/kusto/HISTORY.rst | 8 - src/kusto/azext_kusto/generated/_help.py | 4 +- src/kusto/azext_kusto/generated/_params.py | 45 +- .../latest/test_kusto_scenario_coverage.md | 2 - .../vendored_sdks/kusto/_version.py | 9 - .../kusto/aio/_configuration_async.py | 67 - .../aio/_kusto_management_client_async.py | 93 - .../kusto/aio/operations_async/__init__.py | 25 - ...database_configuration_operations_async.py | 426 ---- .../_cluster_operations_async.py | 1709 ---------------- ...r_principal_assignment_operations_async.py | 491 ----- .../_data_connection_operations_async.py | 766 -------- .../_database_operations_async.py | 820 -------- ...e_principal_assignment_operations_async.py | 515 ----- .../_operation_operations_async.py | 101 - ...ached_database_configuration_operations.py | 436 ----- .../kusto/operations/_cluster_operations.py | 1739 ----------------- ...cluster_principal_assignment_operations.py | 502 ----- .../operations/_data_connection_operations.py | 781 -------- .../kusto/operations/_database_operations.py | 836 -------- ...atabase_principal_assignment_operations.py | 526 ----- .../kusto/operations/_operation_operations.py | 106 - .../azext_kusto/vendored_sdks/kusto/setup.py | 37 - src/kusto/gen.zip | Bin 35564 -> 0 bytes src/kusto/setup.py | 2 +- 25 files changed, 23 insertions(+), 10023 deletions(-) delete mode 100644 src/kusto/azext_kusto/tests/latest/test_kusto_scenario_coverage.md delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/_version.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/aio/_configuration_async.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/aio/_kusto_management_client_async.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/__init__.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_attached_database_configuration_operations_async.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_cluster_operations_async.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_cluster_principal_assignment_operations_async.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_data_connection_operations_async.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_database_operations_async.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_database_principal_assignment_operations_async.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_operation_operations_async.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/operations/_attached_database_configuration_operations.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_operations.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_principal_assignment_operations.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/operations/_data_connection_operations.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/operations/_database_operations.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/operations/_database_principal_assignment_operations.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/operations/_operation_operations.py delete mode 100644 src/kusto/azext_kusto/vendored_sdks/kusto/setup.py delete mode 100644 src/kusto/gen.zip diff --git a/src/kusto/HISTORY.rst b/src/kusto/HISTORY.rst index 03fa4d46196..1c139576ba0 100644 --- a/src/kusto/HISTORY.rst +++ b/src/kusto/HISTORY.rst @@ -6,11 +6,3 @@ Release History 0.1.0 ++++++ * Initial release. - -0.2.0 -++++++ -* Adding Engine v3 support and User-Assigned-Identity - -0.3.0 -++++++ -* Adding TableLeavelSharing feature, Script resource diff --git a/src/kusto/azext_kusto/generated/_help.py b/src/kusto/azext_kusto/generated/_help.py index 596d510f76d..fa2cd3515ef 100644 --- a/src/kusto/azext_kusto/generated/_help.py +++ b/src/kusto/azext_kusto/generated/_help.py @@ -709,7 +709,7 @@ type: command short-summary: "Create an attached database configuration." parameters: - - name: --table-level-sharing-properties --tls + - name: --table-level-sharing-properties short-summary: "Table level sharing specifications" long-summary: | Usage: --table-level-sharing-properties tables-to-include=XX tables-to-exclude=XX \ @@ -738,7 +738,7 @@ type: command short-summary: "Update an attached database configuration." parameters: - - name: --table-level-sharing-properties --tls + - name: --table-level-sharing-properties short-summary: "Table level sharing specifications" long-summary: | Usage: --table-level-sharing-properties tables-to-include=XX tables-to-exclude=XX \ diff --git a/src/kusto/azext_kusto/generated/_params.py b/src/kusto/azext_kusto/generated/_params.py index 11fd391cb5c..c51b3732445 100644 --- a/src/kusto/azext_kusto/generated/_params.py +++ b/src/kusto/azext_kusto/generated/_params.py @@ -81,12 +81,11 @@ def load_arguments(self, _): help='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.', arg_group='Identity') - c.argument('user_assigned_identities', options_list=['--user-assigned-identities', '--uai'], - type=validate_file_or_dict, help='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.ManagedIde' - 'ntity/userAssignedIdentities/{identityName}\'. Expected value: json-string/@json-file.', - arg_group='Identity') + c.argument('user_assigned_identities', type=validate_file_or_dict, help='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}/prov' + 'iders/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}\'. Expected value: ' + 'json-string/@json-file.', arg_group='Identity') with self.argument_context('kusto cluster update') as c: c.argument('resource_group_name', resource_group_name_type) @@ -121,12 +120,11 @@ def load_arguments(self, _): help='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.', arg_group='Identity') - c.argument('user_assigned_identities', options_list=['--user-assigned-identities', '--uai'], - type=validate_file_or_dict, help='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.ManagedIde' - 'ntity/userAssignedIdentities/{identityName}\'. Expected value: json-string/@json-file.', - arg_group='Identity') + c.argument('user_assigned_identities', type=validate_file_or_dict, help='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}/prov' + 'iders/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}\'. Expected value: ' + 'json-string/@json-file.', arg_group='Identity') with self.argument_context('kusto cluster delete') as c: c.argument('resource_group_name', resource_group_name_type) @@ -430,8 +428,8 @@ def load_arguments(self, _): 'like to attach reside.') c.argument('default_principals_modification_kind', arg_type=get_enum_type(['Union', 'Replace', 'None']), help='The default principals modification kind') - c.argument('table_level_sharing_properties', options_list=['--table-level-sharing-properties', '--tls'], - action=AddTableLevelSharingProperties, nargs='+', help='Table level sharing specifications') + c.argument('table_level_sharing_properties', action=AddTableLevelSharingProperties, nargs='+', help='Table ' + 'level sharing specifications') with self.argument_context('kusto attached-database-configuration update') as c: c.argument('resource_group_name', resource_group_name_type) @@ -447,8 +445,8 @@ def load_arguments(self, _): 'like to attach reside.') c.argument('default_principals_modification_kind', arg_type=get_enum_type(['Union', 'Replace', 'None']), help='The default principals modification kind') - c.argument('table_level_sharing_properties', options_list=['--table-level-sharing-properties', '--tls'], - action=AddTableLevelSharingProperties, nargs='+', help='Table level sharing specifications') + c.argument('table_level_sharing_properties', action=AddTableLevelSharingProperties, nargs='+', help='Table ' + 'level sharing specifications') c.ignore('parameters') with self.argument_context('kusto attached-database-configuration delete') as c: @@ -527,9 +525,8 @@ def load_arguments(self, _): c.argument('event_system_properties', nargs='+', help='System properties of the event hub') c.argument('compression', arg_type=get_enum_type(['None', 'GZip']), help='The event hub messages compression ' 'type') - c.argument('managed_identity_resource_id', options_list=['--managed-identity-resource-id', '--mi-rid'], - type=str, help='The resource ID of a managed identity (system or user assigned) to be used to ' - 'authenticate with event hub.') + c.argument('managed_identity_resource_id', type=str, help='The resource ID of a managed identity (system or ' + 'user assigned) to be used to authenticate with event hub.') with self.argument_context('kusto data-connection iot-hub create') as c: c.argument('resource_group_name', resource_group_name_type) @@ -604,9 +601,8 @@ def load_arguments(self, _): c.argument('event_system_properties', nargs='+', help='System properties of the event hub') c.argument('compression', arg_type=get_enum_type(['None', 'GZip']), help='The event hub messages compression ' 'type') - c.argument('managed_identity_resource_id', options_list=['--managed-identity-resource-id', '--mi-rid'], - type=str, help='The resource ID of a managed identity (system or user assigned) to be used to ' - 'authenticate with event hub.') + c.argument('managed_identity_resource_id', type=str, help='The resource ID of a managed identity (system or ' + 'user assigned) to be used to authenticate with event hub.') with self.argument_context('kusto data-connection iot-hub update') as c: c.argument('resource_group_name', resource_group_name_type) @@ -690,9 +686,8 @@ def load_arguments(self, _): c.argument('event_system_properties', nargs='+', help='System properties of the event hub') c.argument('compression', arg_type=get_enum_type(['None', 'GZip']), help='The event hub messages compression ' 'type') - c.argument('managed_identity_resource_id', options_list=['--managed-identity-resource-id', '--mi-rid'], - type=str, help='The resource ID of a managed identity (system or user assigned) to be used to ' - 'authenticate with event hub.') + c.argument('managed_identity_resource_id', type=str, help='The resource ID of a managed identity (system or ' + 'user assigned) to be used to authenticate with event hub.') with self.argument_context('kusto data-connection iot-hub data-connection-validation') as c: c.argument('resource_group_name', resource_group_name_type) diff --git a/src/kusto/azext_kusto/tests/latest/test_kusto_scenario_coverage.md b/src/kusto/azext_kusto/tests/latest/test_kusto_scenario_coverage.md deleted file mode 100644 index cb712843009..00000000000 --- a/src/kusto/azext_kusto/tests/latest/test_kusto_scenario_coverage.md +++ /dev/null @@ -1,2 +0,0 @@ -|Scenario|Result|ErrorMessage|ErrorStack|ErrorNormalized|StartDt|EndDt| -Coverage: 0/0 diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/_version.py b/src/kusto/azext_kusto/vendored_sdks/kusto/_version.py deleted file mode 100644 index 60c349ae6a8..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/_version.py +++ /dev/null @@ -1,9 +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. -# -------------------------------------------------------------------------- - -VERSION = "0.1.0" diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/_configuration_async.py b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/_configuration_async.py deleted file mode 100644 index 2a3459bf5ae..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/_configuration_async.py +++ /dev/null @@ -1,67 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.configuration import Configuration -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -VERSION = "unknown" - -class KustoManagementClientConfiguration(Configuration): - """Configuration for KustoManagementClient. - - Note that all parameters used to create this instance are saved as instance - attributes. - - :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. - :type subscription_id: str - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: - 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 - self.api_version = "2020-09-18" - self.credential_scopes = ['https://management.azure.com/.default'] - self.credential_scopes.extend(kwargs.pop('credential_scopes', [])) - kwargs.setdefault('sdk_moniker', 'kustomanagementclient/{}'.format(VERSION)) - self._configure(**kwargs) - - def _configure( - self, - **kwargs: Any - ) -> None: - self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) - self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) - self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) - self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) - self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) - self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) - 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) diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/_kusto_management_client_async.py b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/_kusto_management_client_async.py deleted file mode 100644 index cd74af7f704..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/_kusto_management_client_async.py +++ /dev/null @@ -1,93 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, Optional, TYPE_CHECKING - -from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - -from ._configuration_async import KustoManagementClientConfiguration -from .operations_async import ClusterOperations -from .operations_async import ClusterPrincipalAssignmentOperations -from .operations_async import DatabaseOperations -from .operations_async import DatabasePrincipalAssignmentOperations -from .operations_async import AttachedDatabaseConfigurationOperations -from .operations_async import DataConnectionOperations -from .operations_async import OperationOperations -from .. import models - - -class KustoManagementClient(object): - """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 cluster: ClusterOperations operations - :vartype cluster: kusto_management_client.aio.operations_async.ClusterOperations - :ivar cluster_principal_assignment: ClusterPrincipalAssignmentOperations operations - :vartype cluster_principal_assignment: kusto_management_client.aio.operations_async.ClusterPrincipalAssignmentOperations - :ivar database: DatabaseOperations operations - :vartype database: kusto_management_client.aio.operations_async.DatabaseOperations - :ivar database_principal_assignment: DatabasePrincipalAssignmentOperations operations - :vartype database_principal_assignment: kusto_management_client.aio.operations_async.DatabasePrincipalAssignmentOperations - :ivar attached_database_configuration: AttachedDatabaseConfigurationOperations operations - :vartype attached_database_configuration: kusto_management_client.aio.operations_async.AttachedDatabaseConfigurationOperations - :ivar data_connection: DataConnectionOperations operations - :vartype data_connection: kusto_management_client.aio.operations_async.DataConnectionOperations - :ivar operation: OperationOperations operations - :vartype operation: kusto_management_client.aio.operations_async.OperationOperations - :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. - :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. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: Optional[str] = None, - **kwargs: Any - ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = KustoManagementClientConfiguration(credential, 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._deserialize = Deserializer(client_models) - - self.cluster = ClusterOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_principal_assignment = ClusterPrincipalAssignmentOperations( - self._client, self._config, self._serialize, self._deserialize) - self.database = DatabaseOperations( - self._client, self._config, self._serialize, self._deserialize) - self.database_principal_assignment = DatabasePrincipalAssignmentOperations( - self._client, self._config, self._serialize, self._deserialize) - self.attached_database_configuration = AttachedDatabaseConfigurationOperations( - self._client, self._config, self._serialize, self._deserialize) - self.data_connection = DataConnectionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operation = OperationOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> "KustoManagementClient": - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details) -> None: - await self._client.__aexit__(*exc_details) diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/__init__.py b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/__init__.py deleted file mode 100644 index e173d033126..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._cluster_operations_async import ClusterOperations -from ._cluster_principal_assignment_operations_async import ClusterPrincipalAssignmentOperations -from ._database_operations_async import DatabaseOperations -from ._database_principal_assignment_operations_async import DatabasePrincipalAssignmentOperations -from ._attached_database_configuration_operations_async import AttachedDatabaseConfigurationOperations -from ._data_connection_operations_async import DataConnectionOperations -from ._operation_operations_async import OperationOperations - -__all__ = [ - 'ClusterOperations', - 'ClusterPrincipalAssignmentOperations', - 'DatabaseOperations', - 'DatabasePrincipalAssignmentOperations', - 'AttachedDatabaseConfigurationOperations', - 'DataConnectionOperations', - 'OperationOperations', -] diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_attached_database_configuration_operations_async.py b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_attached_database_configuration_operations_async.py deleted file mode 100644 index 8ba0e61d8a1..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_attached_database_configuration_operations_async.py +++ /dev/null @@ -1,426 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class AttachedDatabaseConfigurationOperations: - """AttachedDatabaseConfigurationOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_cluster( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> AsyncIterable["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. - :type resource_group_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AttachedDatabaseConfigurationListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('AttachedDatabaseConfigurationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - 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 - - async def get( - self, - resource_group_name: str, - cluster_name: str, - attached_database_configuration_name: str, - **kwargs - ) -> "models.AttachedDatabaseConfiguration": - """Returns an attached database configuration. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param attached_database_configuration_name: The name of the attached database configuration. - :type attached_database_configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AttachedDatabaseConfiguration, or the result of cls(response) - :rtype: ~kusto_management_client.models.AttachedDatabaseConfiguration - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AttachedDatabaseConfiguration"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) - - if cls: - 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, - cluster_name: str, - attached_database_configuration_name: str, - location: Optional[str] = None, - database_name: Optional[str] = None, - cluster_resource_id: Optional[str] = None, - default_principals_modification_kind: Optional[Union[str, "models.DefaultPrincipalsModificationKind"]] = None, - **kwargs - ) -> "models.AttachedDatabaseConfiguration": - cls = kwargs.pop('cls', None) # type: ClsType["models.AttachedDatabaseConfiguration"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.AttachedDatabaseConfiguration(location=location, database_name=database_name, cluster_resource_id=cluster_resource_id, default_principals_modification_kind=default_principals_modification_kind) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) - - if cls: - 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 - - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - attached_database_configuration_name: str, - location: Optional[str] = None, - database_name: Optional[str] = None, - cluster_resource_id: Optional[str] = None, - default_principals_modification_kind: Optional[Union[str, "models.DefaultPrincipalsModificationKind"]] = None, - **kwargs - ) -> AsyncLROPoller["models.AttachedDatabaseConfiguration"]: - """Creates or updates an attached database configuration. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param attached_database_configuration_name: The name of the attached database configuration. - :type attached_database_configuration_name: str - :param location: Resource location. - :type location: str - :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 - :param default_principals_modification_kind: The default principals modification kind. - :type default_principals_modification_kind: str or ~kusto_management_client.models.DefaultPrincipalsModificationKind - :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: True for ARMPolling, False for no polling, or a - polling object for 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.AttachedDatabaseConfiguration"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - attached_database_configuration_name=attached_database_configuration_name, - location=location, - database_name=database_name, - cluster_resource_id=cluster_resource_id, - default_principals_modification_kind=default_principals_modification_kind, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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( - self, - resource_group_name: str, - cluster_name: str, - attached_database_configuration_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - cluster_name: str, - attached_database_configuration_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Deletes the attached database configuration with the given name. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param attached_database_configuration_name: The name of the attached database configuration. - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - attached_database_configuration_name=attached_database_configuration_name, - 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, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_cluster_operations_async.py b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_cluster_operations_async.py deleted file mode 100644 index dc6089fb0ec..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_cluster_operations_async.py +++ /dev/null @@ -1,1709 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ClusterOperations: - """ClusterOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def get( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> "models.Cluster": - """Gets a Kusto cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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: Cluster, or the result of cls(response) - :rtype: ~kusto_management_client.models.Cluster - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - 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, - cluster_name: str, - location: str, - sku: "models.AzureSku", - tags: Optional[Dict[str, str]] = None, - zones: Optional[List[str]] = None, - trusted_external_tenants: Optional[List["models.TrustedExternalTenant"]] = None, - optimized_autoscale: Optional["models.OptimizedAutoscale"] = None, - enable_disk_encryption: Optional[bool] = None, - enable_streaming_ingest: Optional[bool] = False, - virtual_network_configuration: Optional["models.VirtualNetworkConfiguration"] = None, - key_vault_properties: Optional["models.KeyVaultProperties"] = None, - enable_purge: Optional[bool] = False, - enable_double_encryption: Optional[bool] = False, - engine_type: Optional[Union[str, "models.EngineType"]] = None, - type: Optional[Union[str, "models.IdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, - **kwargs - ) -> "models.Cluster": - cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.Cluster(tags=tags, location=location, sku=sku, zones=zones, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, enable_streaming_ingest=enable_streaming_ingest, virtual_network_configuration=virtual_network_configuration, key_vault_properties=key_vault_properties, enable_purge=enable_purge, enable_double_encryption=enable_double_encryption, engine_type=engine_type, type_identity_type=type, user_assigned_identities=user_assigned_identities) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Cluster', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore - - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - location: str, - sku: "models.AzureSku", - tags: Optional[Dict[str, str]] = None, - zones: Optional[List[str]] = None, - trusted_external_tenants: Optional[List["models.TrustedExternalTenant"]] = None, - optimized_autoscale: Optional["models.OptimizedAutoscale"] = None, - enable_disk_encryption: Optional[bool] = None, - enable_streaming_ingest: Optional[bool] = False, - virtual_network_configuration: Optional["models.VirtualNetworkConfiguration"] = None, - key_vault_properties: Optional["models.KeyVaultProperties"] = None, - enable_purge: Optional[bool] = False, - enable_double_encryption: Optional[bool] = False, - engine_type: Optional[Union[str, "models.EngineType"]] = None, - type: Optional[Union[str, "models.IdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, - **kwargs - ) -> AsyncLROPoller["models.Cluster"]: - """Create or update a Kusto cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param location: The geo-location where the resource lives. - :type location: str - :param sku: The SKU of the cluster. - :type sku: ~kusto_management_client.models.AzureSku - :param tags: Resource tags. - :type tags: dict[str, str] - :param zones: The availability zones of the cluster. - :type zones: list[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 - :param enable_double_encryption: A boolean value that indicates if double encryption is - enabled. - :type enable_double_encryption: bool - :param engine_type: The engine type. - :type engine_type: str or ~kusto_management_client.models.EngineType - :param type: 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. - :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] - :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: True for ARMPolling, False for no polling, or a - polling object for 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) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - location=location, - sku=sku, - tags=tags, - zones=zones, - trusted_external_tenants=trusted_external_tenants, - optimized_autoscale=optimized_autoscale, - enable_disk_encryption=enable_disk_encryption, - enable_streaming_ingest=enable_streaming_ingest, - virtual_network_configuration=virtual_network_configuration, - key_vault_properties=key_vault_properties, - enable_purge=enable_purge, - enable_double_encryption=enable_double_encryption, - engine_type=engine_type, - type=type, - user_assigned_identities=user_assigned_identities, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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( - self, - resource_group_name: str, - cluster_name: str, - tags: Optional[Dict[str, str]] = None, - location: Optional[str] = None, - sku: Optional["models.AzureSku"] = None, - trusted_external_tenants: Optional[List["models.TrustedExternalTenant"]] = None, - optimized_autoscale: Optional["models.OptimizedAutoscale"] = None, - enable_disk_encryption: Optional[bool] = None, - enable_streaming_ingest: Optional[bool] = False, - virtual_network_configuration: Optional["models.VirtualNetworkConfiguration"] = None, - key_vault_properties: Optional["models.KeyVaultProperties"] = None, - enable_purge: Optional[bool] = False, - enable_double_encryption: Optional[bool] = False, - engine_type: Optional[Union[str, "models.EngineType"]] = None, - type: Optional[Union[str, "models.IdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, - **kwargs - ) -> "models.Cluster": - cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.ClusterUpdate(tags=tags, location=location, sku=sku, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, enable_streaming_ingest=enable_streaming_ingest, virtual_network_configuration=virtual_network_configuration, key_vault_properties=key_vault_properties, enable_purge=enable_purge, enable_double_encryption=enable_double_encryption, engine_type=engine_type, type_identity_type=type, user_assigned_identities=user_assigned_identities) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Cluster', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Cluster', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore - - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - tags: Optional[Dict[str, str]] = None, - location: Optional[str] = None, - sku: Optional["models.AzureSku"] = None, - trusted_external_tenants: Optional[List["models.TrustedExternalTenant"]] = None, - optimized_autoscale: Optional["models.OptimizedAutoscale"] = None, - enable_disk_encryption: Optional[bool] = None, - enable_streaming_ingest: Optional[bool] = False, - virtual_network_configuration: Optional["models.VirtualNetworkConfiguration"] = None, - key_vault_properties: Optional["models.KeyVaultProperties"] = None, - enable_purge: Optional[bool] = False, - enable_double_encryption: Optional[bool] = False, - engine_type: Optional[Union[str, "models.EngineType"]] = None, - type: Optional[Union[str, "models.IdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, - **kwargs - ) -> AsyncLROPoller["models.Cluster"]: - """Update a Kusto cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param 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 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 - :param enable_double_encryption: A boolean value that indicates if double encryption is - enabled. - :type enable_double_encryption: bool - :param engine_type: The engine type. - :type engine_type: str or ~kusto_management_client.models.EngineType - :param type: 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. - :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] - :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: True for ARMPolling, False for no polling, or a - polling object for 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) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - tags=tags, - location=location, - sku=sku, - trusted_external_tenants=trusted_external_tenants, - optimized_autoscale=optimized_autoscale, - enable_disk_encryption=enable_disk_encryption, - enable_streaming_ingest=enable_streaming_ingest, - virtual_network_configuration=virtual_network_configuration, - key_vault_properties=key_vault_properties, - enable_purge=enable_purge, - enable_double_encryption=enable_double_encryption, - engine_type=engine_type, - type=type, - user_assigned_identities=user_assigned_identities, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Deletes a Kusto cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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 - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - 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, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop'} # type: ignore - - async def begin_stop( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Stops a Kusto cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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 - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - 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, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start'} # type: ignore - - async def begin_start( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Starts a Kusto cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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 - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - 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, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - - def list_follower_database( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> AsyncIterable["models.FollowerDatabaseListResult"]: - """Returns a list of databases that are owned by this cluster and were followed by another - cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.FollowerDatabaseListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_follower_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'), - '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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('FollowerDatabaseListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_follower_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listFollowerDatabases'} # type: ignore - - async def _detach_follower_database_initial( - self, - resource_group_name: str, - cluster_name: str, - cluster_resource_id: str, - attached_database_configuration_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - follower_database_to_remove = models.FollowerDatabaseDefinition(cluster_resource_id=cluster_resource_id, attached_database_configuration_name=attached_database_configuration_name) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._detach_follower_database_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _detach_follower_database_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases'} # type: ignore - - async def begin_detach_follower_database( - self, - resource_group_name: str, - cluster_name: str, - cluster_resource_id: str, - attached_database_configuration_name: str, - **kwargs - ) -> AsyncLROPoller[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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param cluster_resource_id: Resource id of the cluster that follows a database owned by this - cluster. - :type cluster_resource_id: str - :param attached_database_configuration_name: Resource name of the attached database - configuration in the follower cluster. - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._detach_follower_database_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - cluster_resource_id=cluster_resource_id, - attached_database_configuration_name=attached_database_configuration_name, - 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, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_detach_follower_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases'} # type: ignore - - async def _diagnose_virtual_network_initial( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> Optional["models.DiagnoseVirtualNetworkResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DiagnoseVirtualNetworkResult"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnoseVirtualNetworkResult', pipeline_response) - - if cls: - 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 - - async def begin_diagnose_virtual_network( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> AsyncLROPoller["models.DiagnoseVirtualNetworkResult"]: - """Diagnoses network connectivity status for external resources on which the service is dependent - on. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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 - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnoseVirtualNetworkResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._diagnose_virtual_network_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DiagnoseVirtualNetworkResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - 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: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - - def list_by_resource_group( - self, - resource_group_name: str, - **kwargs - ) -> AsyncIterable["models.ClusterListResult"]: - """Lists all Kusto clusters within a resource group. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - 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 - - def list( - self, - **kwargs - ) -> AsyncIterable["models.ClusterListResult"]: - """Lists all Kusto clusters within a subscription. - - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters'} # type: ignore - - def list_sku( - self, - **kwargs - ) -> AsyncIterable["models.SkuDescriptionList"]: - """Lists eligible SKUs for Kusto resource provider. - - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SkuDescriptionList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_sku.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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('SkuDescriptionList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_sku.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus'} # type: ignore - - async def check_name_availability( - self, - location: str, - name: str, - type: Union[str, "models.Type"], - **kwargs - ) -> "models.CheckNameResult": - """Checks that the cluster name is valid and is not already in use. - - :param location: Azure location. - :type location: str - :param name: Cluster name. - :type name: str - :param type: The type of resource, Microsoft.Kusto/clusters. - :type type: str or ~kusto_management_client.models.Type - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - cluster_name = models.ClusterCheckNameRequest(name=name, type=type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CheckNameResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability'} # type: ignore - - def list_sku_by_resource( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> AsyncIterable["models.ListResourceSkusResult"]: - """Returns the SKUs available for the provided resource. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ListResourceSkusResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_sku_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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ListResourceSkusResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_sku_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/skus'} # type: ignore - - def list_language_extension( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> AsyncIterable["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. - :type resource_group_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LanguageExtensionsList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_language_extension.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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('LanguageExtensionsList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_language_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listLanguageExtensions'} # type: ignore - - async def _add_language_extension_initial( - self, - resource_group_name: str, - cluster_name: str, - value: Optional[List["models.LanguageExtension"]] = None, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - language_extensions_to_add = models.LanguageExtensionsList(value=value) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._add_language_extension_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _add_language_extension_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions'} # type: ignore - - async def begin_add_language_extension( - self, - resource_group_name: str, - cluster_name: str, - value: Optional[List["models.LanguageExtension"]] = None, - **kwargs - ) -> AsyncLROPoller[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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param value: The list of language extensions. - :type value: list[~kusto_management_client.models.LanguageExtension] - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._add_language_extension_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - value=value, - 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, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_add_language_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions'} # type: ignore - - async def _remove_language_extension_initial( - self, - resource_group_name: str, - cluster_name: str, - value: Optional[List["models.LanguageExtension"]] = None, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - language_extensions_to_remove = models.LanguageExtensionsList(value=value) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._remove_language_extension_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _remove_language_extension_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions'} # type: ignore - - async def begin_remove_language_extension( - self, - resource_group_name: str, - cluster_name: str, - value: Optional[List["models.LanguageExtension"]] = None, - **kwargs - ) -> AsyncLROPoller[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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param value: The list of language extensions. - :type value: list[~kusto_management_client.models.LanguageExtension] - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._remove_language_extension_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - value=value, - 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, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_remove_language_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions'} # type: ignore diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_cluster_principal_assignment_operations_async.py b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_cluster_principal_assignment_operations_async.py deleted file mode 100644 index 629a5c0f756..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_cluster_principal_assignment_operations_async.py +++ /dev/null @@ -1,491 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class ClusterPrincipalAssignmentOperations: - """ClusterPrincipalAssignmentOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def check_name_availability( - self, - resource_group_name: str, - cluster_name: str, - name: str, - type: Union[str, "models.Type"], - **kwargs - ) -> "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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param name: Principal Assignment resource name. - :type name: str - :param type: The type of resource, Microsoft.Kusto/clusters/principalAssignments. - :type type: str or ~kusto_management_client.models.Type - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - principal_assignment_name = models.ClusterPrincipalAssignmentCheckNameRequest(name=name, type=type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CheckNameResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkPrincipalAssignmentNameAvailability'} # type: ignore - - async def get( - self, - resource_group_name: str, - cluster_name: str, - principal_assignment_name: str, - **kwargs - ) -> "models.ClusterPrincipalAssignment": - """Gets a Kusto cluster principalAssignment. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param principal_assignment_name: The name of the Kusto principalAssignment. - :type principal_assignment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ClusterPrincipalAssignment, or the result of cls(response) - :rtype: ~kusto_management_client.models.ClusterPrincipalAssignment - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterPrincipalAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) - - if cls: - 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, - cluster_name: str, - principal_assignment_name: str, - principal_id: Optional[str] = None, - role: Optional[Union[str, "models.ClusterPrincipalRole"]] = None, - tenant_id: Optional[str] = None, - principal_type: Optional[Union[str, "models.PrincipalType"]] = None, - **kwargs - ) -> "models.ClusterPrincipalAssignment": - cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterPrincipalAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.ClusterPrincipalAssignment(principal_id=principal_id, role=role, tenant_id=tenant_id, principal_type=principal_type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) - - if cls: - 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 - - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - principal_assignment_name: str, - principal_id: Optional[str] = None, - role: Optional[Union[str, "models.ClusterPrincipalRole"]] = None, - tenant_id: Optional[str] = None, - principal_type: Optional[Union[str, "models.PrincipalType"]] = None, - **kwargs - ) -> AsyncLROPoller["models.ClusterPrincipalAssignment"]: - """Create a Kusto cluster principalAssignment. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param principal_assignment_name: The name of the Kusto principalAssignment. - :type principal_assignment_name: 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. - :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. - :type principal_type: str or ~kusto_management_client.models.PrincipalType - :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: True for ARMPolling, False for no polling, or a - polling object for 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterPrincipalAssignment"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - principal_assignment_name=principal_assignment_name, - principal_id=principal_id, - role=role, - tenant_id=tenant_id, - principal_type=principal_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): - deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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( - self, - resource_group_name: str, - cluster_name: str, - principal_assignment_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - cluster_name: str, - principal_assignment_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Deletes a Kusto cluster principalAssignment. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param principal_assignment_name: The name of the Kusto principalAssignment. - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - principal_assignment_name=principal_assignment_name, - 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, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - - def list( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> AsyncIterable["models.ClusterPrincipalAssignmentListResult"]: - """Lists all Kusto cluster principalAssignments. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterPrincipalAssignmentListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterPrincipalAssignmentListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments'} # type: ignore diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_data_connection_operations_async.py b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_data_connection_operations_async.py deleted file mode 100644 index 1bbd91d4625..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_data_connection_operations_async.py +++ /dev/null @@ -1,766 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class DataConnectionOperations: - """DataConnectionOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_database( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - **kwargs - ) -> AsyncIterable["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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnectionListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('DataConnectionListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - 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}/dataConnections'} # type: ignore - - async def _data_connection_validation_initial( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - data_connection_name: Optional[str] = None, - properties: Optional["models.DataConnection"] = None, - **kwargs - ) -> Optional["models.DataConnectionValidationListResult"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DataConnectionValidationListResult"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.DataConnectionValidation(data_connection_name=data_connection_name, properties=properties) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DataConnectionValidationListResult', pipeline_response) - - if cls: - 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 - - async def begin_data_connection_validation( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - data_connection_name: Optional[str] = None, - properties: Optional["models.DataConnection"] = None, - **kwargs - ) -> AsyncLROPoller["models.DataConnectionValidationListResult"]: - """Checks that the data connection parameters are valid. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :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 - :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: True for ARMPolling, False for no polling, or a - polling object for 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnectionValidationListResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._data_connection_validation_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - data_connection_name=data_connection_name, - properties=properties, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DataConnectionValidationListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - 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: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - - async def check_name_availability( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - name: str, - type: Union[str, "models.Type"], - **kwargs - ) -> "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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param name: Data Connection name. - :type name: str - :param type: The type of resource, Microsoft.Kusto/clusters/databases/dataConnections. - :type type: str or ~kusto_management_client.models.Type - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - data_connection_name = models.DataConnectionCheckNameRequest(name=name, type=type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CheckNameResult', pipeline_response) - - if cls: - 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 - - async def get( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - data_connection_name: str, - **kwargs - ) -> "models.DataConnection": - """Returns a data connection. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param data_connection_name: The name of the data connection. - :type data_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataConnection, or the result of cls(response) - :rtype: ~kusto_management_client.models.DataConnection - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DataConnection', pipeline_response) - - if cls: - 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, - cluster_name: str, - database_name: str, - data_connection_name: str, - parameters: "models.DataConnection", - **kwargs - ) -> "models.DataConnection": - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DataConnection', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DataConnection', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('DataConnection', pipeline_response) - - if cls: - 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 - - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - data_connection_name: str, - parameters: "models.DataConnection", - **kwargs - ) -> AsyncLROPoller["models.DataConnection"]: - """Creates or updates a data connection. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param data_connection_name: The name of the data connection. - :type data_connection_name: str - :param parameters: The data connection parameters supplied to the CreateOrUpdate operation. - :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: True for ARMPolling, False for no polling, or a - polling object for 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) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.DataConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnection"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - data_connection_name=data_connection_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DataConnection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - data_connection_name: str, - parameters: "models.DataConnection", - **kwargs - ) -> "models.DataConnection": - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DataConnection', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DataConnection', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('DataConnection', pipeline_response) - - if cls: - 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 - - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - data_connection_name: str, - parameters: "models.DataConnection", - **kwargs - ) -> AsyncLROPoller["models.DataConnection"]: - """Updates a data connection. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param data_connection_name: The name of the data connection. - :type data_connection_name: str - :param parameters: The data connection parameters supplied to the Update operation. - :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: True for ARMPolling, False for no polling, or a - polling object for 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) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.DataConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnection"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - data_connection_name=data_connection_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DataConnection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - data_connection_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - data_connection_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Deletes the data connection with the given name. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param data_connection_name: The name of the data connection. - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - data_connection_name=data_connection_name, - 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, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_database_operations_async.py b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_database_operations_async.py deleted file mode 100644 index ed5527a0154..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_database_operations_async.py +++ /dev/null @@ -1,820 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class DatabaseOperations: - """DatabaseOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def check_name_availability( - self, - resource_group_name: str, - cluster_name: str, - name: str, - type: Union[str, "models.Type"], - **kwargs - ) -> "models.CheckNameResult": - """Checks that the database name is valid and is not already in use. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param name: Resource name. - :type name: str - :param type: The type of resource, for instance Microsoft.Kusto/clusters/databases. - :type type: str or ~kusto_management_client.models.Type - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - resource_name = models.CheckNameRequest(name=name, type=type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CheckNameResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkNameAvailability'} # type: ignore - - def list_by_cluster( - self, - resource_group_name: str, - cluster_name: str, - **kwargs - ) -> AsyncIterable["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. - :type resource_group_name: str - :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 DatabaseListResult or the result of cls(response) - :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"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('DatabaseListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - 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 - - async def get( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - **kwargs - ) -> "models.Database": - """Returns a database. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :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: Database, or the result of cls(response) - :rtype: ~kusto_management_client.models.Database - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Database', pipeline_response) - - if cls: - 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, - cluster_name: str, - database_name: str, - parameters: "models.Database", - **kwargs - ) -> "models.Database": - cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Database', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Database', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('Database', pipeline_response) - - if cls: - 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 - - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - parameters: "models.Database", - **kwargs - ) -> AsyncLROPoller["models.Database"]: - """Creates or updates a database. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param parameters: The database parameters supplied to the CreateOrUpdate operation. - :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: True for ARMPolling, False for no polling, or a - polling object for 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) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.Database] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Database', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - parameters: "models.Database", - **kwargs - ) -> "models.Database": - cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Database', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Database', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('Database', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore - - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - parameters: "models.Database", - **kwargs - ) -> AsyncLROPoller["models.Database"]: - """Updates a database. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param parameters: The database parameters supplied to the Update operation. - :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: True for ARMPolling, False for no polling, or a - polling object for 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) - :rtype: ~azure.core.polling.AsyncLROPoller[~kusto_management_client.models.Database] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Database', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Deletes the database with the given name. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :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 - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - 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, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - - def list_principal( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - **kwargs - ) -> AsyncIterable["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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_principal.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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('DatabasePrincipalListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list_principal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/listPrincipals'} # type: ignore - - async def add_principal( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - value: Optional[List["models.DatabasePrincipal"]] = None, - **kwargs - ) -> "models.DatabasePrincipalListResult": - """Add Database principals permissions. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param value: The list of Kusto database principals. - :type value: list[~kusto_management_client.models.DatabasePrincipal] - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - database_principals_to_add = models.DatabasePrincipalListRequest(value=value) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.add_principal.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatabasePrincipalListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - add_principal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/addPrincipals'} # type: ignore - - async def remove_principal( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - value: Optional[List["models.DatabasePrincipal"]] = None, - **kwargs - ) -> "models.DatabasePrincipalListResult": - """Remove Database principals permissions. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param value: The list of Kusto database principals. - :type value: list[~kusto_management_client.models.DatabasePrincipal] - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - database_principals_to_remove = models.DatabasePrincipalListRequest(value=value) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.remove_principal.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatabasePrincipalListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - remove_principal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/removePrincipals'} # type: ignore diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_database_principal_assignment_operations_async.py b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_database_principal_assignment_operations_async.py deleted file mode 100644 index b638a75b983..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_database_principal_assignment_operations_async.py +++ /dev/null @@ -1,515 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class DatabasePrincipalAssignmentOperations: - """DatabasePrincipalAssignmentOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - async def check_name_availability( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - name: str, - type: Union[str, "models.Type"], - **kwargs - ) -> "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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param name: Principal Assignment resource name. - :type name: str - :param type: The type of resource, Microsoft.Kusto/clusters/databases/principalAssignments. - :type type: str or ~kusto_management_client.models.Type - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - principal_assignment_name = models.DatabasePrincipalAssignmentCheckNameRequest(name=name, type=type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CheckNameResult', pipeline_response) - - if cls: - 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 - - async def get( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - principal_assignment_name: str, - **kwargs - ) -> "models.DatabasePrincipalAssignment": - """Gets a Kusto cluster database principalAssignment. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param principal_assignment_name: The name of the Kusto principalAssignment. - :type principal_assignment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatabasePrincipalAssignment, or the result of cls(response) - :rtype: ~kusto_management_client.models.DatabasePrincipalAssignment - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) - - if cls: - 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, - cluster_name: str, - database_name: str, - principal_assignment_name: str, - principal_id: Optional[str] = None, - role: Optional[Union[str, "models.DatabasePrincipalRole"]] = None, - tenant_id: Optional[str] = None, - principal_type: Optional[Union[str, "models.PrincipalType"]] = None, - **kwargs - ) -> "models.DatabasePrincipalAssignment": - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.DatabasePrincipalAssignment(principal_id=principal_id, role=role, tenant_id=tenant_id, principal_type=principal_type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) - - if cls: - 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 - - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - principal_assignment_name: str, - principal_id: Optional[str] = None, - role: Optional[Union[str, "models.DatabasePrincipalRole"]] = None, - tenant_id: Optional[str] = None, - principal_type: Optional[Union[str, "models.PrincipalType"]] = None, - **kwargs - ) -> AsyncLROPoller["models.DatabasePrincipalAssignment"]: - """Creates a Kusto cluster database principalAssignment. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param principal_assignment_name: The name of the Kusto principalAssignment. - :type principal_assignment_name: 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. - :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. - :type principal_type: str or ~kusto_management_client.models.PrincipalType - :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: True for ARMPolling, False for no polling, or a - polling object for 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalAssignment"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - principal_assignment_name=principal_assignment_name, - principal_id=principal_id, - role=role, - tenant_id=tenant_id, - principal_type=principal_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): - deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - principal_assignment_name: str, - **kwargs - ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore - - async def begin_delete( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - principal_assignment_name: str, - **kwargs - ) -> AsyncLROPoller[None]: - """Deletes a Kusto principalAssignment. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param principal_assignment_name: The name of the Kusto principalAssignment. - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - principal_assignment_name=principal_assignment_name, - 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, {}) - - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() - else: polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - - def list( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - **kwargs - ) -> AsyncIterable["models.DatabasePrincipalAssignmentListResult"]: - """Lists all Kusto cluster database principalAssignments. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalAssignmentListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('DatabasePrincipalAssignmentListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments'} # type: ignore diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_operation_operations_async.py b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_operation_operations_async.py deleted file mode 100644 index 58c61b55688..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_operation_operations_async.py +++ /dev/null @@ -1,101 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models - -T = TypeVar('T') -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - -class OperationOperations: - """OperationOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs - ) -> AsyncIterable["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 - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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 = 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) - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.Kusto/operations'} # type: ignore diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_attached_database_configuration_operations.py b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_attached_database_configuration_operations.py deleted file mode 100644 index 91fe3f6c4b9..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_attached_database_configuration_operations.py +++ /dev/null @@ -1,436 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import 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]] - -class AttachedDatabaseConfigurationOperations(object): - """AttachedDatabaseConfigurationOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list_by_cluster( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> 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. - :type resource_group_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AttachedDatabaseConfigurationListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('AttachedDatabaseConfigurationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - 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 - - def get( - self, - resource_group_name, # type: str - cluster_name, # type: str - attached_database_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.AttachedDatabaseConfiguration" - """Returns an attached database configuration. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param attached_database_configuration_name: The name of the attached database configuration. - :type attached_database_configuration_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: AttachedDatabaseConfiguration, or the result of cls(response) - :rtype: ~kusto_management_client.models.AttachedDatabaseConfiguration - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.AttachedDatabaseConfiguration"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) - - if cls: - 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 - location=None, # type: Optional[str] - database_name=None, # type: Optional[str] - cluster_resource_id=None, # type: Optional[str] - default_principals_modification_kind=None, # type: Optional[Union[str, "models.DefaultPrincipalsModificationKind"]] - **kwargs # type: Any - ): - # type: (...) -> "models.AttachedDatabaseConfiguration" - cls = kwargs.pop('cls', None) # type: ClsType["models.AttachedDatabaseConfiguration"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.AttachedDatabaseConfiguration(location=location, database_name=database_name, cluster_resource_id=cluster_resource_id, default_principals_modification_kind=default_principals_modification_kind) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) - - if cls: - 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 - - def begin_create_or_update( - self, - resource_group_name, # type: str - cluster_name, # type: str - attached_database_configuration_name, # type: str - location=None, # type: Optional[str] - database_name=None, # type: Optional[str] - cluster_resource_id=None, # type: Optional[str] - default_principals_modification_kind=None, # type: Optional[Union[str, "models.DefaultPrincipalsModificationKind"]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.AttachedDatabaseConfiguration"] - """Creates or updates an attached database configuration. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param attached_database_configuration_name: The name of the attached database configuration. - :type attached_database_configuration_name: str - :param location: Resource location. - :type location: str - :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 - :param default_principals_modification_kind: The default principals modification kind. - :type default_principals_modification_kind: str or ~kusto_management_client.models.DefaultPrincipalsModificationKind - :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: True for ARMPolling, False for no polling, or a - polling object for 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.AttachedDatabaseConfiguration"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - attached_database_configuration_name=attached_database_configuration_name, - location=location, - database_name=database_name, - cluster_resource_id=cluster_resource_id, - default_principals_modification_kind=default_principals_modification_kind, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} # type: ignore - - 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] - """Deletes the attached database configuration with the given name. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param attached_database_configuration_name: The name of the attached database configuration. - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - attached_database_configuration_name=attached_database_configuration_name, - 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, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_operations.py b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_operations.py deleted file mode 100644 index 526a1efd086..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_operations.py +++ /dev/null @@ -1,1739 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ClusterOperations(object): - """ClusterOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def get( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.Cluster" - """Gets a Kusto cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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: Cluster, or the result of cls(response) - :rtype: ~kusto_management_client.models.Cluster - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - 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 - location, # type: str - sku, # type: "models.AzureSku" - tags=None, # type: Optional[Dict[str, str]] - zones=None, # type: Optional[List[str]] - trusted_external_tenants=None, # type: Optional[List["models.TrustedExternalTenant"]] - optimized_autoscale=None, # type: Optional["models.OptimizedAutoscale"] - enable_disk_encryption=None, # type: Optional[bool] - enable_streaming_ingest=False, # type: Optional[bool] - virtual_network_configuration=None, # type: Optional["models.VirtualNetworkConfiguration"] - key_vault_properties=None, # type: Optional["models.KeyVaultProperties"] - enable_purge=False, # type: Optional[bool] - enable_double_encryption=False, # type: Optional[bool] - engine_type=None, # type: Optional[Union[str, "models.EngineType"]] - type=None, # type: Optional[Union[str, "models.IdentityType"]] - user_assigned_identities=None, # type: Optional[Dict[str, "models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] - **kwargs # type: Any - ): - # type: (...) -> "models.Cluster" - cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.Cluster(tags=tags, location=location, sku=sku, zones=zones, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, enable_streaming_ingest=enable_streaming_ingest, virtual_network_configuration=virtual_network_configuration, key_vault_properties=key_vault_properties, enable_purge=enable_purge, enable_double_encryption=enable_double_encryption, engine_type=engine_type, type_identity_type=type, user_assigned_identities=user_assigned_identities) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Cluster', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore - - def begin_create_or_update( - self, - resource_group_name, # type: str - cluster_name, # type: str - location, # type: str - sku, # type: "models.AzureSku" - tags=None, # type: Optional[Dict[str, str]] - zones=None, # type: Optional[List[str]] - trusted_external_tenants=None, # type: Optional[List["models.TrustedExternalTenant"]] - optimized_autoscale=None, # type: Optional["models.OptimizedAutoscale"] - enable_disk_encryption=None, # type: Optional[bool] - enable_streaming_ingest=False, # type: Optional[bool] - virtual_network_configuration=None, # type: Optional["models.VirtualNetworkConfiguration"] - key_vault_properties=None, # type: Optional["models.KeyVaultProperties"] - enable_purge=False, # type: Optional[bool] - enable_double_encryption=False, # type: Optional[bool] - engine_type=None, # type: Optional[Union[str, "models.EngineType"]] - type=None, # type: Optional[Union[str, "models.IdentityType"]] - user_assigned_identities=None, # type: Optional[Dict[str, "models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.Cluster"] - """Create or update a Kusto cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param location: The geo-location where the resource lives. - :type location: str - :param sku: The SKU of the cluster. - :type sku: ~kusto_management_client.models.AzureSku - :param tags: Resource tags. - :type tags: dict[str, str] - :param zones: The availability zones of the cluster. - :type zones: list[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 - :param enable_double_encryption: A boolean value that indicates if double encryption is - enabled. - :type enable_double_encryption: bool - :param engine_type: The engine type. - :type engine_type: str or ~kusto_management_client.models.EngineType - :param type: 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. - :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] - :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: True for ARMPolling, False for no polling, or a - polling object for 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 Cluster or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - location=location, - sku=sku, - tags=tags, - zones=zones, - trusted_external_tenants=trusted_external_tenants, - optimized_autoscale=optimized_autoscale, - enable_disk_encryption=enable_disk_encryption, - enable_streaming_ingest=enable_streaming_ingest, - virtual_network_configuration=virtual_network_configuration, - key_vault_properties=key_vault_properties, - enable_purge=enable_purge, - enable_double_encryption=enable_double_encryption, - engine_type=engine_type, - type=type, - user_assigned_identities=user_assigned_identities, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - tags=None, # type: Optional[Dict[str, str]] - location=None, # type: Optional[str] - sku=None, # type: Optional["models.AzureSku"] - trusted_external_tenants=None, # type: Optional[List["models.TrustedExternalTenant"]] - optimized_autoscale=None, # type: Optional["models.OptimizedAutoscale"] - enable_disk_encryption=None, # type: Optional[bool] - enable_streaming_ingest=False, # type: Optional[bool] - virtual_network_configuration=None, # type: Optional["models.VirtualNetworkConfiguration"] - key_vault_properties=None, # type: Optional["models.KeyVaultProperties"] - enable_purge=False, # type: Optional[bool] - enable_double_encryption=False, # type: Optional[bool] - engine_type=None, # type: Optional[Union[str, "models.EngineType"]] - type=None, # type: Optional[Union[str, "models.IdentityType"]] - user_assigned_identities=None, # type: Optional[Dict[str, "models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] - **kwargs # type: Any - ): - # type: (...) -> "models.Cluster" - cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.ClusterUpdate(tags=tags, location=location, sku=sku, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, enable_streaming_ingest=enable_streaming_ingest, virtual_network_configuration=virtual_network_configuration, key_vault_properties=key_vault_properties, enable_purge=enable_purge, enable_double_encryption=enable_double_encryption, engine_type=engine_type, type_identity_type=type, user_assigned_identities=user_assigned_identities) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Cluster', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Cluster', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore - - def begin_update( - self, - resource_group_name, # type: str - cluster_name, # type: str - tags=None, # type: Optional[Dict[str, str]] - location=None, # type: Optional[str] - sku=None, # type: Optional["models.AzureSku"] - trusted_external_tenants=None, # type: Optional[List["models.TrustedExternalTenant"]] - optimized_autoscale=None, # type: Optional["models.OptimizedAutoscale"] - enable_disk_encryption=None, # type: Optional[bool] - enable_streaming_ingest=False, # type: Optional[bool] - virtual_network_configuration=None, # type: Optional["models.VirtualNetworkConfiguration"] - key_vault_properties=None, # type: Optional["models.KeyVaultProperties"] - enable_purge=False, # type: Optional[bool] - enable_double_encryption=False, # type: Optional[bool] - engine_type=None, # type: Optional[Union[str, "models.EngineType"]] - type=None, # type: Optional[Union[str, "models.IdentityType"]] - user_assigned_identities=None, # type: Optional[Dict[str, "models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.Cluster"] - """Update a Kusto cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param 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 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 - :param enable_double_encryption: A boolean value that indicates if double encryption is - enabled. - :type enable_double_encryption: bool - :param engine_type: The engine type. - :type engine_type: str or ~kusto_management_client.models.EngineType - :param type: 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. - :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] - :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: True for ARMPolling, False for no polling, or a - polling object for 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 Cluster or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - tags=tags, - location=location, - sku=sku, - trusted_external_tenants=trusted_external_tenants, - optimized_autoscale=optimized_autoscale, - enable_disk_encryption=enable_disk_encryption, - enable_streaming_ingest=enable_streaming_ingest, - virtual_network_configuration=virtual_network_configuration, - key_vault_properties=key_vault_properties, - enable_purge=enable_purge, - enable_double_encryption=enable_double_encryption, - engine_type=engine_type, - type=type, - user_assigned_identities=user_assigned_identities, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Cluster', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} # type: ignore - - def begin_delete( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Deletes a Kusto cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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 - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - 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, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _stop_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop'} # type: ignore - - def begin_stop( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Stops a Kusto cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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 - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - 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, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _start_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start'} # type: ignore - - def begin_start( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Starts a Kusto cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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 - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - 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, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - - def list_follower_database( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.FollowerDatabaseListResult"] - """Returns a list of databases that are owned by this cluster and were followed by another - cluster. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.FollowerDatabaseListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_follower_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'), - '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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('FollowerDatabaseListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_follower_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listFollowerDatabases'} # type: ignore - - def _detach_follower_database_initial( - self, - resource_group_name, # type: str - cluster_name, # type: str - cluster_resource_id, # type: str - attached_database_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - follower_database_to_remove = models.FollowerDatabaseDefinition(cluster_resource_id=cluster_resource_id, attached_database_configuration_name=attached_database_configuration_name) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._detach_follower_database_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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _detach_follower_database_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases'} # type: ignore - - def begin_detach_follower_database( - self, - resource_group_name, # type: str - cluster_name, # type: str - cluster_resource_id, # type: str - attached_database_configuration_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> 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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param cluster_resource_id: Resource id of the cluster that follows a database owned by this - cluster. - :type cluster_resource_id: str - :param attached_database_configuration_name: Resource name of the attached database - configuration in the follower cluster. - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._detach_follower_database_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - cluster_resource_id=cluster_resource_id, - attached_database_configuration_name=attached_database_configuration_name, - 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, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_detach_follower_database.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"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DiagnoseVirtualNetworkResult"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DiagnoseVirtualNetworkResult', pipeline_response) - - if cls: - 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 - - def begin_diagnose_virtual_network( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.DiagnoseVirtualNetworkResult"] - """Diagnoses network connectivity status for external resources on which the service is dependent - on. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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 - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnoseVirtualNetworkResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._diagnose_virtual_network_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DiagnoseVirtualNetworkResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - 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: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - - def list_by_resource_group( - self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> 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. - :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.paging.ItemPaged[~kusto_management_client.models.ClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - 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 - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> 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 - :return: An iterator like instance of either ClusterListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.ClusterListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/clusters'} # type: ignore - - def list_sku( - self, - **kwargs # type: Any - ): - # type: (...) -> 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 - :return: An iterator like instance of either SkuDescriptionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.SkuDescriptionList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.SkuDescriptionList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_sku.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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('SkuDescriptionList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_sku.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/skus'} # type: ignore - - def check_name_availability( - self, - location, # type: str - name, # type: str - type, # type: Union[str, "models.Type"] - **kwargs # type: Any - ): - # type: (...) -> "models.CheckNameResult" - """Checks that the cluster name is valid and is not already in use. - - :param location: Azure location. - :type location: str - :param name: Cluster name. - :type name: str - :param type: The type of resource, Microsoft.Kusto/clusters. - :type type: str or ~kusto_management_client.models.Type - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - cluster_name = models.ClusterCheckNameRequest(name=name, type=type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CheckNameResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Kusto/locations/{location}/checkNameAvailability'} # type: ignore - - def list_sku_by_resource( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> 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. - :type resource_group_name: str - :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.paging.ItemPaged[~kusto_management_client.models.ListResourceSkusResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ListResourceSkusResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_sku_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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ListResourceSkusResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_sku_by_resource.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/skus'} # type: ignore - - def list_language_extension( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> 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. - :type resource_group_name: str - :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.paging.ItemPaged[~kusto_management_client.models.LanguageExtensionsList] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.LanguageExtensionsList"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_language_extension.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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('LanguageExtensionsList', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_language_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/listLanguageExtensions'} # type: ignore - - def _add_language_extension_initial( - self, - resource_group_name, # type: str - cluster_name, # type: str - value=None, # type: Optional[List["models.LanguageExtension"]] - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - language_extensions_to_add = models.LanguageExtensionsList(value=value) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._add_language_extension_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _add_language_extension_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions'} # type: ignore - - def begin_add_language_extension( - self, - resource_group_name, # type: str - cluster_name, # type: str - value=None, # type: Optional[List["models.LanguageExtension"]] - **kwargs # type: Any - ): - # type: (...) -> 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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param value: The list of language extensions. - :type value: list[~kusto_management_client.models.LanguageExtension] - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._add_language_extension_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - value=value, - 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, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_add_language_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions'} # type: ignore - - def _remove_language_extension_initial( - self, - resource_group_name, # type: str - cluster_name, # type: str - value=None, # type: Optional[List["models.LanguageExtension"]] - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - language_extensions_to_remove = models.LanguageExtensionsList(value=value) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._remove_language_extension_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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _remove_language_extension_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions'} # type: ignore - - def begin_remove_language_extension( - self, - resource_group_name, # type: str - cluster_name, # type: str - value=None, # type: Optional[List["models.LanguageExtension"]] - **kwargs # type: Any - ): - # type: (...) -> 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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param value: The list of language extensions. - :type value: list[~kusto_management_client.models.LanguageExtension] - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._remove_language_extension_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - value=value, - 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, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_remove_language_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions'} # type: ignore diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_principal_assignment_operations.py b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_principal_assignment_operations.py deleted file mode 100644 index f1b4b0f2f82..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_principal_assignment_operations.py +++ /dev/null @@ -1,502 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import 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]] - -class ClusterPrincipalAssignmentOperations(object): - """ClusterPrincipalAssignmentOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def check_name_availability( - self, - resource_group_name, # type: str - cluster_name, # type: str - name, # type: str - type, # type: Union[str, "models.Type"] - **kwargs # type: Any - ): - # type: (...) -> "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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param name: Principal Assignment resource name. - :type name: str - :param type: The type of resource, Microsoft.Kusto/clusters/principalAssignments. - :type type: str or ~kusto_management_client.models.Type - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - principal_assignment_name = models.ClusterPrincipalAssignmentCheckNameRequest(name=name, type=type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CheckNameResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkPrincipalAssignmentNameAvailability'} # type: ignore - - def get( - self, - resource_group_name, # type: str - cluster_name, # type: str - principal_assignment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.ClusterPrincipalAssignment" - """Gets a Kusto cluster principalAssignment. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param principal_assignment_name: The name of the Kusto principalAssignment. - :type principal_assignment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ClusterPrincipalAssignment, or the result of cls(response) - :rtype: ~kusto_management_client.models.ClusterPrincipalAssignment - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterPrincipalAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) - - if cls: - 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 - principal_id=None, # type: Optional[str] - role=None, # type: Optional[Union[str, "models.ClusterPrincipalRole"]] - tenant_id=None, # type: Optional[str] - principal_type=None, # type: Optional[Union[str, "models.PrincipalType"]] - **kwargs # type: Any - ): - # type: (...) -> "models.ClusterPrincipalAssignment" - cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterPrincipalAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.ClusterPrincipalAssignment(principal_id=principal_id, role=role, tenant_id=tenant_id, principal_type=principal_type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) - - if cls: - 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 - - def begin_create_or_update( - self, - resource_group_name, # type: str - cluster_name, # type: str - principal_assignment_name, # type: str - principal_id=None, # type: Optional[str] - role=None, # type: Optional[Union[str, "models.ClusterPrincipalRole"]] - tenant_id=None, # type: Optional[str] - principal_type=None, # type: Optional[Union[str, "models.PrincipalType"]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.ClusterPrincipalAssignment"] - """Create a Kusto cluster principalAssignment. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param principal_assignment_name: The name of the Kusto principalAssignment. - :type principal_assignment_name: 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. - :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. - :type principal_type: str or ~kusto_management_client.models.PrincipalType - :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: True for ARMPolling, False for no polling, or a - polling object for 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterPrincipalAssignment"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - principal_assignment_name=principal_assignment_name, - principal_id=principal_id, - role=role, - tenant_id=tenant_id, - principal_type=principal_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): - deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} # type: ignore - - def begin_delete( - self, - resource_group_name, # type: str - cluster_name, # type: str - principal_assignment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Deletes a Kusto cluster principalAssignment. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param principal_assignment_name: The name of the Kusto principalAssignment. - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - principal_assignment_name=principal_assignment_name, - 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, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - - def list( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.ClusterPrincipalAssignmentListResult"] - """Lists all Kusto cluster principalAssignments. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterPrincipalAssignmentListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('ClusterPrincipalAssignmentListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments'} # type: ignore diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_data_connection_operations.py b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_data_connection_operations.py deleted file mode 100644 index 4c2fbb416aa..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_data_connection_operations.py +++ /dev/null @@ -1,781 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import 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]] - -class DataConnectionOperations(object): - """DataConnectionOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - 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"] - """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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :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.paging.ItemPaged[~kusto_management_client.models.DataConnectionListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnectionListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('DataConnectionListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - 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}/dataConnections'} # type: ignore - - def _data_connection_validation_initial( - self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - data_connection_name=None, # type: Optional[str] - properties=None, # type: Optional["models.DataConnection"] - **kwargs # type: Any - ): - # type: (...) -> Optional["models.DataConnectionValidationListResult"] - cls = kwargs.pop('cls', None) # type: ClsType[Optional["models.DataConnectionValidationListResult"]] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.DataConnectionValidation(data_connection_name=data_connection_name, properties=properties) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('DataConnectionValidationListResult', pipeline_response) - - if cls: - 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 - - def begin_data_connection_validation( - self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - data_connection_name=None, # type: Optional[str] - properties=None, # type: Optional["models.DataConnection"] - **kwargs # type: Any - ): - # type: (...) -> 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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :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 - :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: True for ARMPolling, False for no polling, or a - polling object for 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnectionValidationListResult"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._data_connection_validation_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - data_connection_name=data_connection_name, - properties=properties, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DataConnectionValidationListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - 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: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - - def check_name_availability( - self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - name, # type: str - type, # type: Union[str, "models.Type"] - **kwargs # type: Any - ): - # type: (...) -> "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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param name: Data Connection name. - :type name: str - :param type: The type of resource, Microsoft.Kusto/clusters/databases/dataConnections. - :type type: str or ~kusto_management_client.models.Type - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - data_connection_name = models.DataConnectionCheckNameRequest(name=name, type=type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CheckNameResult', pipeline_response) - - if cls: - 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 - - 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" - """Returns a data connection. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param data_connection_name: The name of the data connection. - :type data_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DataConnection, or the result of cls(response) - :rtype: ~kusto_management_client.models.DataConnection - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DataConnection', pipeline_response) - - if cls: - 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" - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DataConnection', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DataConnection', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('DataConnection', pipeline_response) - - if cls: - 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 - - 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"] - """Creates or updates a data connection. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param data_connection_name: The name of the data connection. - :type data_connection_name: str - :param parameters: The data connection parameters supplied to the CreateOrUpdate operation. - :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: True for ARMPolling, False for no polling, or a - polling object for 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) - :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.DataConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnection"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - data_connection_name=data_connection_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DataConnection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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" - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnection"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DataConnection', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DataConnection', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('DataConnection', pipeline_response) - - if cls: - 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 - - 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"] - """Updates a data connection. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param data_connection_name: The name of the data connection. - :type data_connection_name: str - :param parameters: The data connection parameters supplied to the Update operation. - :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: True for ARMPolling, False for no polling, or a - polling object for 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) - :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.DataConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnection"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - data_connection_name=data_connection_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('DataConnection', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} # type: ignore - - 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] - """Deletes the data connection with the given name. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param data_connection_name: The name of the data connection. - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - data_connection_name=data_connection_name, - 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, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_database_operations.py b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_database_operations.py deleted file mode 100644 index 07f3bfc88fa..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_database_operations.py +++ /dev/null @@ -1,836 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, List, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class DatabaseOperations(object): - """DatabaseOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def check_name_availability( - self, - resource_group_name, # type: str - cluster_name, # type: str - name, # type: str - type, # type: Union[str, "models.Type"] - **kwargs # type: Any - ): - # type: (...) -> "models.CheckNameResult" - """Checks that the database name is valid and is not already in use. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param name: Resource name. - :type name: str - :param type: The type of resource, for instance Microsoft.Kusto/clusters/databases. - :type type: str or ~kusto_management_client.models.Type - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - resource_name = models.CheckNameRequest(name=name, type=type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CheckNameResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/checkNameAvailability'} # type: ignore - - def list_by_cluster( - self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> 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. - :type resource_group_name: str - :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 DatabaseListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.DatabaseListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('DatabaseListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - 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 - - def get( - self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "models.Database" - """Returns a database. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :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: Database, or the result of cls(response) - :rtype: ~kusto_management_client.models.Database - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('Database', pipeline_response) - - if cls: - 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" - cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Database', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Database', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('Database', pipeline_response) - - if cls: - 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 - - 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"] - """Creates or updates a database. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param parameters: The database parameters supplied to the CreateOrUpdate operation. - :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: True for ARMPolling, False for no polling, or a - polling object for 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 Database or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.Database] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Database', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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" - cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('Database', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('Database', pipeline_response) - - if response.status_code == 202: - deserialized = self._deserialize('Database', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore - - 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"] - """Updates a database. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param parameters: The database parameters supplied to the Update operation. - :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: True for ARMPolling, False for no polling, or a - polling object for 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 Database or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~kusto_management_client.models.Database] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - parameters=parameters, - cls=lambda x,y,z: x, - **kwargs - ) - - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize('Database', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} # type: ignore - - def begin_delete( - self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] - """Deletes the database with the given name. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :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 - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - 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, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - - def list_principal( - self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> 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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - if not next_link: - # Construct URL - url = self.list_principal.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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('DatabasePrincipalListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list_principal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/listPrincipals'} # type: ignore - - def add_principal( - self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - value=None, # type: Optional[List["models.DatabasePrincipal"]] - **kwargs # type: Any - ): - # type: (...) -> "models.DatabasePrincipalListResult" - """Add Database principals permissions. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param value: The list of Kusto database principals. - :type value: list[~kusto_management_client.models.DatabasePrincipal] - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - database_principals_to_add = models.DatabasePrincipalListRequest(value=value) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.add_principal.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatabasePrincipalListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - add_principal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/addPrincipals'} # type: ignore - - def remove_principal( - self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - value=None, # type: Optional[List["models.DatabasePrincipal"]] - **kwargs # type: Any - ): - # type: (...) -> "models.DatabasePrincipalListResult" - """Remove Database principals permissions. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param value: The list of Kusto database principals. - :type value: list[~kusto_management_client.models.DatabasePrincipal] - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - database_principals_to_remove = models.DatabasePrincipalListRequest(value=value) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self.remove_principal.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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatabasePrincipalListResult', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - remove_principal.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/removePrincipals'} # type: ignore diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_database_principal_assignment_operations.py b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_database_principal_assignment_operations.py deleted file mode 100644 index 86e2aab5646..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_database_principal_assignment_operations.py +++ /dev/null @@ -1,526 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import 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.polling import LROPoller, NoPolling, PollingMethod -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import 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]] - -class DatabasePrincipalAssignmentOperations(object): - """DatabasePrincipalAssignmentOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def check_name_availability( - self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - name, # type: str - type, # type: Union[str, "models.Type"] - **kwargs # type: Any - ): - # type: (...) -> "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. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param name: Principal Assignment resource name. - :type name: str - :param type: The type of resource, Microsoft.Kusto/clusters/databases/principalAssignments. - :type type: str or ~kusto_management_client.models.Type - :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 - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - principal_assignment_name = models.DatabasePrincipalAssignmentCheckNameRequest(name=name, type=type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('CheckNameResult', pipeline_response) - - if cls: - 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 - - 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" - """Gets a Kusto cluster database principalAssignment. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param principal_assignment_name: The name of the Kusto principalAssignment. - :type principal_assignment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: DatabasePrincipalAssignment, or the result of cls(response) - :rtype: ~kusto_management_client.models.DatabasePrincipalAssignment - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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'] = 'application/json' - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) - - if cls: - 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 - principal_id=None, # type: Optional[str] - role=None, # type: Optional[Union[str, "models.DatabasePrincipalRole"]] - tenant_id=None, # type: Optional[str] - principal_type=None, # type: Optional[Union[str, "models.PrincipalType"]] - **kwargs # type: Any - ): - # type: (...) -> "models.DatabasePrincipalAssignment" - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalAssignment"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - - parameters = models.DatabasePrincipalAssignment(principal_id=principal_id, role=role, tenant_id=tenant_id, principal_type=principal_type) - api_version = "2020-09-18" - content_type = kwargs.pop("content_type", "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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = 'application/json' - - 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 - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if response.status_code == 200: - deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) - - if cls: - 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 - - def begin_create_or_update( - self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - principal_assignment_name, # type: str - principal_id=None, # type: Optional[str] - role=None, # type: Optional[Union[str, "models.DatabasePrincipalRole"]] - tenant_id=None, # type: Optional[str] - principal_type=None, # type: Optional[Union[str, "models.PrincipalType"]] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["models.DatabasePrincipalAssignment"] - """Creates a Kusto cluster database principalAssignment. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param principal_assignment_name: The name of the Kusto principalAssignment. - :type principal_assignment_name: 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. - :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. - :type principal_type: str or ~kusto_management_client.models.PrincipalType - :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: True for ARMPolling, False for no polling, or a - polling object for 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: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalAssignment"] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - principal_assignment_name=principal_assignment_name, - principal_id=principal_id, - role=role, - tenant_id=tenant_id, - principal_type=principal_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): - deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - cls = kwargs.pop('cls', None) # type: ClsType[None] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - # 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] - - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} # type: ignore - - 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] - """Deletes a Kusto principalAssignment. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :param database_name: The name of the database in the Kusto cluster. - :type database_name: str - :param principal_assignment_name: The name of the Kusto principalAssignment. - :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: True for ARMPolling, False for no polling, or a - polling object for 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 None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType[None] - lro_delay = kwargs.pop( - 'polling_interval', - self._config.polling_interval - ) - cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - principal_assignment_name=principal_assignment_name, - 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, {}) - - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output - ) - 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 - - def list( - self, - resource_group_name, # type: str - cluster_name, # type: str - database_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["models.DatabasePrincipalAssignmentListResult"] - """Lists all Kusto cluster database principalAssignments. - - :param resource_group_name: The name of the resource group containing the Kusto cluster. - :type resource_group_name: str - :param cluster_name: The name of the Kusto cluster. - :type cluster_name: str - :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] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalAssignmentListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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) - else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('DatabasePrincipalAssignmentListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments'} # type: ignore diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_operation_operations.py b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_operation_operations.py deleted file mode 100644 index 1f2df08ad51..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_operation_operations.py +++ /dev/null @@ -1,106 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings - -from azure.core.exceptions import 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.mgmt.core.exceptions import ARMErrorFormat - -from .. import 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]] - -class OperationOperations(object): - """OperationOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~kusto_management_client.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. - """ - - models = models - - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config - - def list( - self, - **kwargs # type: Any - ): - # type: (...) -> 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 - :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~kusto_management_client.models.OperationListResult] - :raises: ~azure.core.exceptions.HttpResponseError - """ - cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] - error_map = {404: ResourceNotFoundError, 409: ResourceExistsError} - error_map.update(kwargs.pop('error_map', {})) - api_version = "2020-09-18" - - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = 'application/json' - - 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 = 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) - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged( - get_next, extract_data - ) - list.metadata = {'url': '/providers/Microsoft.Kusto/operations'} # type: ignore diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/setup.py b/src/kusto/azext_kusto/vendored_sdks/kusto/setup.py deleted file mode 100644 index 6f2ab0c5bff..00000000000 --- a/src/kusto/azext_kusto/vendored_sdks/kusto/setup.py +++ /dev/null @@ -1,37 +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. -# -------------------------------------------------------------------------- -# coding: utf-8 - -from setuptools import setup, find_packages - -NAME = "kustomanagementclient" -VERSION = "0.1.0" - -# To install the library, run the following -# -# python setup.py install -# -# prerequisite: setuptools -# http://pypi.python.org/pypi/setuptools - -REQUIRES = ["msrest>=0.6.0", "azure-core<2.0.0,>=1.2.0"] - -setup( - name=NAME, - version=VERSION, - description="KustoManagementClient", - author_email="", - url="", - keywords=["Swagger", "KustoManagementClient"], - install_requires=REQUIRES, - packages=find_packages(), - include_package_data=True, - long_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. - """ -) diff --git a/src/kusto/gen.zip b/src/kusto/gen.zip deleted file mode 100644 index d27a7e6f998b7fee572522420bfb5795eff3b565..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 35564 zcmeG_U2o$^a^Ab_Au#qKIOOHt2o18fH>PCE^9=}DpY7cpjAzDYd*(j&HUvesWS%Ke z$ENJj4CV*qF~1=|aKQbDJRNYadCYVE#XY5}zeq~WCS{YF#l+sVM-scMx~r?I>#JKQ z&wu)N>udP)mp5m>VlTv>FW_JI9eJBLms6TVos+_rKc8!v5Sma!`(J3=hc5QZbo=AG zKb?N|?yrCQd~0nDe>mZuU;$V1@SexFK^&;@% zh(?11K946+>?T1pZd?0dXt74riU}q074h59_c(xIQQ}+Eu}@+vxggeyXXo>%v;uul)$%T6rM6uGg>f zMgS)murYcFE}#G=CJH@5t&R5f`g$+|5+_zf*9UPlvfOvmn6$kxXftl}FD=pFOsxJn zOthpa&?1_~9{DzorjwJHOx&2nyic3Fbw`tsI5Z&>Dq-Ur#|uFmNbGnq0Wz01_ua&G zyl6ZIQUZTCH{0C!6C9`nkS;6Lb~HAy>dBD5TCH3d86cl!Kgb>HH)BHocp7r->U2 zb!U(*i43;$N#&7Mq(qtA`XnSb;IAdRF&$H}y`)6N=5jexPI6pIgW-6D%Dj>qFoRfP zGhx$If{-0Y#mUIIYhhHHixEP_sTg78X4011@8-G%KS?}uM(%j(hTH6Y>;|wW1_S=i zb3+d{$SbgchGczfeSQ7>=P#B);;TJd}UFROef0BT>m;9(Yj9tbB{OCKH0Y7;nq_&+zBv_g5-q+W@3Of z-=Gj0nmZmC2Tv_&04xpQkvbIY;UEdFNbegrq-2XP;5>l92N4UBSv#3c7^Jfq3}>{@ z#EVhYZ&E}F4rF%i+)HBqbdA78hi0I+?~p9RGPdEt)EC zc$R=+ISR(ZXK0Zp<}P5Zv?Ynp5-`x+*msT}FF7rQ;<*#o13Ck~ZoyJuvm_ufG-*j> z@Y=ALKWs6kxM!W6ADvh)U!7auyn6le@Tv72UCKjY(9#2DO23L2y3p)@^m@v`@V_V0=V7@3U{6!2i$z7c%uxpg}zR z&;g(D3dAC&9p!?y89`fW;7CI8)9MJpgWgIA_m-4G&};5AOirZTMqfmJFbKFbJrBlg zGOx#67z_-7V?u=})dP4mAvp%0C_K9WpM5+$iK7XLfy*e^G2mv6-S8aS(DUf%Es)SB z-|zf@lsn2k?V8!}HdvpH3$gCjhZWp-5(jP=yd(abfLt$3_r+WTMiiK~ZpCY&zh+E% zVra(%L}_qLj9(UrBZ*;BMa%Gj#FC#b!&0*5%cvhTwN|Bk?&MdaHA>cU8IIA&N?u)Q zW#vwO`KtUl<#*otSf#u|h>uQ3Bxa#W-0pDGJji~yB=fSc<9E}3L*~a3L^bu+M*>JY zXrhA4bz1V{Pnt&MGKSGWaPTxwhe z!l7+jFo0}ZVJtf=ECzl@$&_XDf>G$E_DOoCpP=uUi#;GabTz!7Ti{aOl}uB>j<<%1 zsRZ3%1)mo<#jn8qVKEANjOh|ILP~sL9-!4wB`Z+#n;BEX#eE6}cL)wS>_Q@!MGr9Y z^AdFX{*@bqZa)YifRGJx z;S~4?MHP+7^yLzv0zF8E<#ik&*o!2Y(5Ib_KOK!`ZD@amLuh-^Xt_X10VW7|@%R#s z|BZTQn1Wf;9`JZ{nHDQEr+BWSL|W$6Z{QWls{AMP@!~M@ zEf`)#I2mn#c#1Guvj~xw7&Cn>BL=xruuTkGfc;4Z!Q0*j)S4mn8CYIv$d_Z|`=^h7 z*tTF#>TSeB@ROm84EkY-81`o$a`r{}LlB})QHrP#MU^2&&d%p*k~7m6x#C7w7q+7X4AxeB!C>XlF7_N}3$xGrJ3=5?D|v6@)69(iS)_+9NNcF%cUU6r%Df z1Smtb@N-^k!6b=QCqVJX_dhV{Kpt;miq+ECJk zaIFp7M)_u?4MsY3KeRM`g-TChh%G_eSmvHp)q(+_%oy8&Uw3{PGs*K*03Q<)(YegB zW^jtKoMepd@-rQE#7=E1!;adcOvc&1gp{+@;t6LBI+nn*L(u-AO?hG&KuK4~l9^?j zwWD?t*@P#Td-Hka1>l;#P|Jvk>AAkUEvTkWv%2;brgd|u3UWdVDD_|zRxKF7u9@69 zrqa8M1W%hPsH`bKnO|?)Rtz@8x@q8ls7YweZON)ANLbr9kh*I(NT7n83!kqU$8Dr< znK^LHBFew2szxwkOH|{xBv~lYVgVbej*9f5-mh7iHbnF_uf|fka3xFk9IbAnR%hYa zU&^Ako2{fi^1QN@MD&`KT=8nap2GJKv?dtch)_m5HMF6!2+@X`EU=i0nnQ}i zVqT6a2xQfV;J@%{!d}e7bYTaCJ z;IxK!k=LQGd9AonOBCfMYnK*|=%)P9fKgEA9?vt8HXkJheN@@bfoO67)@B7DaRC)^KW>|p^ zCs?2;&#bAi9w8Kc91I_@PAkw`fY_FZA;2LJYY0|Ji(R=PSd5GC#2TOc_WZk7FLlgO z((zQ+r$&{zu!M)~tmZf3s3v9(Fy&LSh}BCzYF92CwJqyDRFv|j3n}9Z3Q#`WnMNdy z{;zhY6V^j&CNvO(1RV4G@O%tXA8~Dzrvi64jwpE(#0i{Cd`Xh)D84l71z+@Wu6QSB z%zLdsGf31Blw{+z1?ro!RFkAd3uj4TMT2eeEcOcM$}Gj&1hr|ZF1wL2vdRr$r8^m; ztHgZ!t*lAHp0XPbmL;vIkd#wgDRDXOJ4>OnU@1^I!U#@P-JUDQ6)-Q>!ZRZkaSq%c8S4K=5Q)gBzVh zpC)E)C{Gg?VHC&4rCnIb(NH*eYeqKt*<+ovppwKa<^A~4!w2{Gy1Vvncklk(p9c>g zJ$?e8o1t(|cYiX`HH)JVBKZ40oY2=j1}DoMCu|^y9}&)tfxWFZkd(B-D2J#R2%BWE zTW4qW&hMe{h_sBXV%ervh4F2v^{z7QQOZ{V^}KjuDQ*#MUc)NoM^T zqb2vz^b;c2Y!J<^@$HRGlc;rgjWLf=nHnDQ`jjynG73{Nf*Yu?@dzRTw^H&GAZ4E-fc;Cr9Mt z1Nc4JJ%qm>;77Ob*C*wfEa9PyO_pz{E807)rnX5rRqcv4OI+N_N(y--53=*fE7-mY z63@#CPMuWCB;e#qQBwv^5v=hPoWvxQUlW^zoUxWSRkgp=HX4m`5hVwBhwDeuCuv+m z&IGbp%BU+yd`P-Fn7&dw;VO6^(^d-M%GZ-;tI+j?qNNDxyI;e74p2-BgO8-yU=OO;$-`q#K*7yuoe(9 zKd=ZRFU#d9@h&MG{^A~-#fkG|?k=Atdns{Jc;*bJf$zX4a1={Tx}~NF56Wg(t1ePG zS;@|*!7KAKIsvO?XvFvtIl5We^LTe<>We_PlJ8Y06cON7I5pDHtVKF6Yj-;3$EH)b zlbQFTDR%-&+$r936>Q8gHRK3ORjRdd>d_$Sna+$ui+D2+s)oRqyA`z7NCj3)h_j>? zJ6>wTZB{k;x+*@NCyUnO^o4U+*)NuEu<;O?xMIu}XM6D64lGZ47nwHZtjN$%;l~kv zXTo<2Wgj=XS4^Y)#noJ3)A6f@8=A$u4R)K0!!)y~Uq}~X{Z-DqAX{do6OEsSwPRKy z5uJuO&F=3FlRl##je(#n*;fz`%96c~uu!AQul^;P3yEYFsVp#(T_>hG+1J6WBvO)H zGo`g_3Y|2%es`M}-WRFSY1p!^*29`=C z?xY!cg~E9`at#|ayTL6Z+TNWBnau7?NR%+TkeyEDu++QG3gJqe?2N2gwfWiwlB2Is zM~TO?2$fyB+gmjv^O|2N`Qf3VWT03s4PaVb(n8YEaQO)MM85c6HVpG zjG~(#8mF}!K*7S^iZKbB6QI#l_m{OW)SZST6B&dpc zXG&OVidChc@sQ7IsxHG2%{+Eot1y}N2~=PjSa0Dn0UZ+;MhT2e*>K3f$dYx$4^oEw zIK`BeR!z5D#}Kp9J0r&RYB;iHT(3I9Y|ZL%zE|eX?&@f7+K!FXZ+tH{(w}3mAs6(q zg(ki3{*+L-Ejm;ErXGnWg<1{obz>gA11tqFn!Y|o;X^ME@D&xsrR{Ks+}nBbs5{v0 z+x>^TzI}h-KeqcmoKV>Fy@A`k|M1byKzlA>A@Wsl)tbJTpI-%=Nw|p*s+cg8-74Gs z)k+*sO=ii`J`}_&l3+X~b~Lt097i#=3hqXNOPD=k^EfSB9SGN1bo<_5&x5ljgMq(m z--jQ&{{+gH$b&A~*&*b?-T-brm{0uJHlMLQjl=ZT^wEsE?S2^bp?(Oy+WZ=BIE=1o z8&2kSaELD41|N5L$2NRHycw)bUA$}Xl8mj^ztF2*cW3vBz0-yNzodzHci-+lIq!D= zX>Wh`G5qO1{N0z7sAqdS=R5eUyC=kp~ECcWKc`C0Wkgj?{!a)d87(*)%kHpm3!>oC0}m9v2+`B`Y!9MpMY;cg51f3*df)lSxN5fWl@QiOyw?v4lv zsm<|_>L#m#4n=UMx(d>WsuEF7yh1}jtwR2O{Dc4c&;R%d+>4LDe-FQKlfR4h*82}9 z&p-RgKd!CAXKQPJd2{wF_CoymLcRG1@ydM%H!ks;{yV0gKhO323f^UV@*DY0{eO|` z|2u7eaif1041N{BXYc;{x6k1_0Pwe?z~GC2H-W)1iLWrA9vpXuGg9#N0Q11-zh@wY t|G$84agGJwIxr7*etA-`KmE6Ku}+?U{xf{?Gx+b%pRKL^Gdx>c`#*vutv3Jw diff --git a/src/kusto/setup.py b/src/kusto/setup.py index 2f37277f5a3..9f4a85de1fb 100644 --- a/src/kusto/setup.py +++ b/src/kusto/setup.py @@ -10,7 +10,7 @@ from setuptools import setup, find_packages # HISTORY.rst entry. -VERSION = '0.3.0' +VERSION = '0.1.0' try: from azext_kusto.manual.version import VERSION except ImportError: