diff --git a/src/kusto/HISTORY.rst b/src/kusto/HISTORY.rst new file mode 100644 index 00000000000..27f152061e8 --- /dev/null +++ b/src/kusto/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/kusto/README.md b/src/kusto/README.md new file mode 100644 index 00000000000..3622fe06255 --- /dev/null +++ b/src/kusto/README.md @@ -0,0 +1,5 @@ +Microsoft Azure CLI 'kusto' Extension +========================================== + +This package is for the 'kusto' extension. +i.e. 'az kusto' diff --git a/src/kusto/azext_kusto/__init__.py b/src/kusto/azext_kusto/__init__.py new file mode 100644 index 00000000000..5a12fc226b3 --- /dev/null +++ b/src/kusto/azext_kusto/__init__.py @@ -0,0 +1,46 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_kusto.generated._help import helps # pylint: disable=unused-import + + +class KustoManagementClientCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_kusto.generated._client_factory import cf_kusto + kusto_custom = CliCommandType( + operations_tmpl='azext_kusto.custom#{}', + client_factory=cf_kusto) + super(KustoManagementClientCommandsLoader, self).__init__(cli_ctx=cli_ctx, + custom_command_type=kusto_custom) + + def load_command_table(self, args): + from azext_kusto.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_kusto.manual.commands import load_command_table as load_command_table_manual + load_command_table_manual(self, args) + except ImportError: + pass + return self.command_table + + def load_arguments(self, command): + from azext_kusto.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_kusto.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = KustoManagementClientCommandsLoader diff --git a/src/kusto/azext_kusto/action.py b/src/kusto/azext_kusto/action.py new file mode 100644 index 00000000000..a846b2766c4 --- /dev/null +++ b/src/kusto/azext_kusto/action.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.action import * # noqa: F403 +try: + from .manual.action import * # noqa: F403 +except ImportError: + pass diff --git a/src/kusto/azext_kusto/azext_metadata.json b/src/kusto/azext_kusto/azext_metadata.json new file mode 100644 index 00000000000..7b56fb1e11a --- /dev/null +++ b/src/kusto/azext_kusto/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.3.1" +} \ No newline at end of file diff --git a/src/kusto/azext_kusto/custom.py b/src/kusto/azext_kusto/custom.py new file mode 100644 index 00000000000..7f31674ce96 --- /dev/null +++ b/src/kusto/azext_kusto/custom.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.custom import * # noqa: F403 +try: + from .manual.custom import * # noqa: F403 +except ImportError: + pass diff --git a/src/kusto/azext_kusto/generated/__init__.py b/src/kusto/azext_kusto/generated/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/kusto/azext_kusto/generated/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/kusto/azext_kusto/generated/_client_factory.py b/src/kusto/azext_kusto/generated/_client_factory.py new file mode 100644 index 00000000000..96406ce744f --- /dev/null +++ b/src/kusto/azext_kusto/generated/_client_factory.py @@ -0,0 +1,39 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + + +def cf_kusto(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from ..vendored_sdks.kusto import KustoManagementClient + return get_mgmt_service_client(cli_ctx, KustoManagementClient) + + +def cf_cluster(cli_ctx, *_): + return cf_kusto(cli_ctx).cluster + + +def cf_cluster_principal_assignment(cli_ctx, *_): + return cf_kusto(cli_ctx).cluster_principal_assignment + + +def cf_database(cli_ctx, *_): + return cf_kusto(cli_ctx).database + + +def cf_database_principal_assignment(cli_ctx, *_): + return cf_kusto(cli_ctx).database_principal_assignment + + +def cf_attached_database_configuration(cli_ctx, *_): + return cf_kusto(cli_ctx).attached_database_configuration + + +def cf_data_connection(cli_ctx, *_): + return cf_kusto(cli_ctx).data_connection diff --git a/src/kusto/azext_kusto/generated/_help.py b/src/kusto/azext_kusto/generated/_help.py new file mode 100644 index 00000000000..21c8d05c359 --- /dev/null +++ b/src/kusto/azext_kusto/generated/_help.py @@ -0,0 +1,535 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['kusto cluster'] = """ + type: group + short-summary: kusto cluster +""" + +helps['kusto cluster list'] = """ + type: command + short-summary: Lists all Kusto clusters within a subscription. + examples: + - name: KustoClustersListByResourceGroup + text: |- + az kusto cluster list --resource-group "kustorptest" +""" + +helps['kusto cluster show'] = """ + type: command + short-summary: Gets a Kusto cluster. + examples: + - name: KustoClustersGet + text: |- + az kusto cluster show --cluster-name "KustoClusterRPTest4" --resource-group "kustorptest" +""" + +helps['kusto cluster create'] = """ + type: command + short-summary: Create or update a Kusto cluster. + examples: + - name: KustoClustersCreateOrUpdate + text: |- + az kusto cluster create --cluster-name "KustoClusterRPTest4" --identity-type "SystemAssigned" --location\ + "westus" --enable-purge true --enable-streaming-ingest true --key-vault-properties key-name="keyName" key-vault-uri="h\ +ttps://dummy.keyvault.com" key-version="keyVersion" --sku name="Standard_L8s" capacity=2 tier="Standard" --resource-gro\ +up "kustorptest" +""" + +helps['kusto cluster update'] = """ + type: command + short-summary: Update a Kusto cluster. + examples: + - name: KustoClustersUpdate + text: |- + az kusto cluster update --cluster-name "KustoClusterRPTest4" --identity-type "SystemAssigned" --location\ + "westus" --enable-purge true --enable-streaming-ingest true --key-vault-properties key-name="keyName" key-vault-uri="h\ +ttps://dummy.keyvault.com" key-version="keyVersion" --resource-group "kustorptest" +""" + +helps['kusto cluster delete'] = """ + type: command + short-summary: Deletes a Kusto cluster. + examples: + - name: KustoClustersDelete + text: |- + az kusto cluster delete --cluster-name "KustoClusterRPTest4" --resource-group "kustorptest" +""" + +helps['kusto cluster add-language-extension'] = """ + type: command + short-summary: Add a list of language extensions that can run within KQL queries. + examples: + - name: KustoClusterAddLanguageExtensions + text: |- + az kusto cluster add-language-extension --cluster-name "KustoClusterRPTest4" --value language-extension-\ +name="PYTHON" --value language-extension-name="R" --resource-group "kustorptest" +""" + +helps['kusto cluster detach-follower-database'] = """ + type: command + short-summary: Detaches all followers of a database owned by this cluster. + examples: + - name: KustoClusterDetachFollowerDatabases + text: |- + az kusto cluster detach-follower-database --cluster-name "KustoClusterRPTest4" --attached-database-confi\ +guration-name "myAttachedDatabaseConfiguration" --cluster-resource-id "/subscriptions/12345678-1234-1234-1234-123456789\ +098/resourceGroups/kustorptest/providers/Microsoft.Kusto/clusters/leader4" --resource-group "kustorptest" +""" + +helps['kusto cluster diagnose-virtual-network'] = """ + type: command + short-summary: Diagnoses network connectivity status for external resources on which the service is dependent on. + examples: + - name: KustoClusterDiagnoseVirtualNetwork + text: |- + az kusto cluster diagnose-virtual-network --cluster-name "KustoClusterRPTest4" --resource-group "kustorp\ +test" +""" + +helps['kusto cluster list-follower-database'] = """ + type: command + short-summary: Returns a list of databases that are owned by this cluster and were followed by another cluster. + examples: + - name: KustoClusterListFollowerDatabases + text: |- + az kusto cluster list-follower-database --cluster-name "KustoClusterRPTest4" --resource-group "kustorpte\ +st" +""" + +helps['kusto cluster list-language-extension'] = """ + type: command + short-summary: Returns a list of language extensions that can run within KQL queries. + examples: + - name: KustoClusterListLanguageExtensions + text: |- + az kusto cluster list-language-extension --cluster-name "KustoClusterRPTest4" --resource-group "kustorpt\ +est" +""" + +helps['kusto cluster list-sku'] = """ + type: command + short-summary: Lists eligible SKUs for Kusto resource provider. + examples: + - name: KustoClustersListResourceSkus + text: |- + az kusto cluster list-sku --cluster-name "KustoClusterRPTest4" --resource-group "kustorptest" +""" + +helps['kusto cluster remove-language-extension'] = """ + type: command + short-summary: Remove a list of language extensions that can run within KQL queries. + examples: + - name: KustoClusterRemoveLanguageExtensions + text: |- + az kusto cluster remove-language-extension --cluster-name "KustoClusterRPTest4" --value language-extensi\ +on-name="PYTHON" --value language-extension-name="R" --resource-group "kustorptest" +""" + +helps['kusto cluster start'] = """ + type: command + short-summary: Starts a Kusto cluster. + examples: + - name: KustoClustersStart + text: |- + az kusto cluster start --cluster-name "KustoClusterRPTest4" --resource-group "kustorptest" +""" + +helps['kusto cluster stop'] = """ + type: command + short-summary: Stops a Kusto cluster. + examples: + - name: KustoClustersStop + text: |- + az kusto cluster stop --cluster-name "KustoClusterRPTest4" --resource-group "kustorptest" +""" + +helps['kusto cluster-principal-assignment'] = """ + type: group + short-summary: kusto cluster-principal-assignment +""" + +helps['kusto cluster-principal-assignment list'] = """ + type: command + short-summary: Lists all Kusto cluster principalAssignments. + examples: + - name: KustoPrincipalAssignmentsList + text: |- + az kusto cluster-principal-assignment list --cluster-name "kustoclusterrptest4" --resource-group "kustor\ +ptest" +""" + +helps['kusto cluster-principal-assignment show'] = """ + type: command + short-summary: Gets a Kusto cluster principalAssignment. + examples: + - name: KustoClusterPrincipalAssignmentsGet + text: |- + az kusto cluster-principal-assignment show --cluster-name "kustoclusterrptest4" --principal-assignment-n\ +ame "kustoprincipal1" --resource-group "kustorptest" +""" + +helps['kusto cluster-principal-assignment create'] = """ + type: command + short-summary: Create a Kusto cluster principalAssignment. + examples: + - name: KustoClusterPrincipalAssignmentsCreateOrUpdate + text: |- + az kusto cluster-principal-assignment create --cluster-name "kustoclusterrptest4" --principal-id "876543\ +21-1234-1234-1234-123456789123" --principal-type "App" --role "Admin" --tenant-id "12345678-1234-1234-1234-123456789123\ +" --principal-assignment-name "kustoprincipal1" --resource-group "kustorptest" +""" + +helps['kusto cluster-principal-assignment update'] = """ + type: command + short-summary: Create a Kusto cluster principalAssignment. + examples: + - name: KustoClusterPrincipalAssignmentsCreateOrUpdate + text: |- + az kusto cluster-principal-assignment update --cluster-name "kustoclusterrptest4" --principal-id "876543\ +21-1234-1234-1234-123456789123" --principal-type "App" --role "Admin" --tenant-id "12345678-1234-1234-1234-123456789123\ +" --principal-assignment-name "kustoprincipal1" --resource-group "kustorptest" +""" + +helps['kusto cluster-principal-assignment delete'] = """ + type: command + short-summary: Deletes a Kusto cluster principalAssignment. + examples: + - name: KustoClusterPrincipalAssignmentsDelete + text: |- + az kusto cluster-principal-assignment delete --cluster-name "kustoclusterrptest4" --principal-assignment\ +-name "kustoprincipal1" --resource-group "kustorptest" +""" + +helps['kusto database'] = """ + type: group + short-summary: kusto database +""" + +helps['kusto database list'] = """ + type: command + short-summary: Returns the list of databases of the given Kusto cluster. + examples: + - name: KustoDatabasesListByCluster + text: |- + az kusto database list --cluster-name "KustoClusterRPTest4" --resource-group "kustorptest" +""" + +helps['kusto database show'] = """ + type: command + short-summary: Returns a database. + examples: + - name: KustoDatabasesGet + text: |- + az kusto database show --cluster-name "KustoClusterRPTest4" --database-name "KustoDatabase8" --resource-\ +group "kustorptest" +""" + +helps['kusto database create'] = """ + type: command + short-summary: Creates or updates a database. + examples: + - name: KustoDatabasesCreateOrUpdate + text: |- + az kusto database create --cluster-name "KustoClusterRPTest4" --database-name "KustoDatabase8" --read-wr\ +ite-database location="westus" soft-delete-period="P1D" --resource-group "kustorptest" +""" + +helps['kusto database update'] = """ + type: command + short-summary: Updates a database. + examples: + - name: KustoDatabasesUpdate + text: |- + az kusto database update --cluster-name "KustoClusterRPTest4" --database-name "KustoDatabase8" --read-wr\ +ite-database soft-delete-period="P1D" --resource-group "kustorptest" +""" + +helps['kusto database delete'] = """ + type: command + short-summary: Deletes the database with the given name. + examples: + - name: KustoDatabasesDelete + text: |- + az kusto database delete --cluster-name "KustoClusterRPTest4" --database-name "KustoDatabase8" --resourc\ +e-group "kustorptest" +""" + +helps['kusto database add-principal'] = """ + type: command + short-summary: Add Database principals permissions. + examples: + - name: KustoDatabaseAddPrincipals + text: |- + az kusto database add-principal --cluster-name "KustoClusterRPTest4" --database-name "databaseName1" --v\ +alue name="Some User" type="User" app-id="" email="user@microsoft.com" fqn="aaduser=some_guid" role="Admin" --value nam\ +e="Kusto" type="Group" app-id="" email="kusto@microsoft.com" fqn="aadgroup=some_guid" role="Viewer" --value name="SomeA\ +pp" type="App" app-id="some_guid_app_id" email="" fqn="aadapp=some_guid_app_id" role="Admin" --resource-group "kustorpt\ +est" +""" + +helps['kusto database list-principal'] = """ + type: command + short-summary: Returns a list of database principals of the given Kusto cluster and database. + examples: + - name: KustoDatabaseListPrincipals + text: |- + az kusto database list-principal --cluster-name "KustoClusterRPTest4" --database-name "databaseName1" --\ +resource-group "kustorptest" +""" + +helps['kusto database remove-principal'] = """ + type: command + short-summary: Remove Database principals permissions. + examples: + - name: KustoDatabaseRemovePrincipals + text: |- + az kusto database remove-principal --cluster-name "KustoClusterRPTest4" --database-name "databaseName1" \ +--value name="Some User" type="User" app-id="" email="user@microsoft.com" fqn="aaduser=some_guid" role="Admin" --value \ +name="Kusto" type="Group" app-id="" email="kusto@microsoft.com" fqn="aadgroup=some_guid" role="Viewer" --value name="So\ +meApp" type="App" app-id="some_guid_app_id" email="" fqn="aadapp=some_guid_app_id" role="Admin" --resource-group "kusto\ +rptest" +""" + +helps['kusto database-principal-assignment'] = """ + type: group + short-summary: kusto database-principal-assignment +""" + +helps['kusto database-principal-assignment list'] = """ + type: command + short-summary: Lists all Kusto cluster database principalAssignments. + examples: + - name: KustoPrincipalAssignmentsList + text: |- + az kusto database-principal-assignment list --cluster-name "kustoclusterrptest4" --database-name "Kustod\ +atabase8" --resource-group "kustorptest" +""" + +helps['kusto database-principal-assignment show'] = """ + type: command + short-summary: Gets a Kusto cluster database principalAssignment. + examples: + - name: KustoDatabasePrincipalAssignmentsGet + text: |- + az kusto database-principal-assignment show --cluster-name "kustoclusterrptest4" --database-name "Kustod\ +atabase8" --principal-assignment-name "kustoprincipal1" --resource-group "kustorptest" +""" + +helps['kusto database-principal-assignment create'] = """ + type: command + short-summary: Creates a Kusto cluster database principalAssignment. + examples: + - name: KustoDatabasePrincipalAssignmentsCreateOrUpdate + text: |- + az kusto database-principal-assignment create --cluster-name "kustoclusterrptest4" --database-name "Kust\ +odatabase8" --principal-id "87654321-1234-1234-1234-123456789123" --principal-type "App" --role "Admin" --tenant-id "12\ +345678-1234-1234-1234-123456789123" --principal-assignment-name "kustoprincipal1" --resource-group "kustorptest" +""" + +helps['kusto database-principal-assignment update'] = """ + type: command + short-summary: Creates a Kusto cluster database principalAssignment. + examples: + - name: KustoDatabasePrincipalAssignmentsCreateOrUpdate + text: |- + az kusto database-principal-assignment update --cluster-name "kustoclusterrptest4" --database-name "Kust\ +odatabase8" --principal-id "87654321-1234-1234-1234-123456789123" --principal-type "App" --role "Admin" --tenant-id "12\ +345678-1234-1234-1234-123456789123" --principal-assignment-name "kustoprincipal1" --resource-group "kustorptest" +""" + +helps['kusto database-principal-assignment delete'] = """ + type: command + short-summary: Deletes a Kusto principalAssignment. + examples: + - name: KustoDatabasePrincipalAssignmentsDelete + text: |- + az kusto database-principal-assignment delete --cluster-name "kustoclusterrptest4" --database-name "Kust\ +odatabase8" --principal-assignment-name "kustoprincipal1" --resource-group "kustorptest" +""" + +helps['kusto attached-database-configuration'] = """ + type: group + short-summary: kusto attached-database-configuration +""" + +helps['kusto attached-database-configuration list'] = """ + type: command + short-summary: Returns the list of attached database configurations of the given Kusto cluster. + examples: + - name: KustoAttachedDatabaseConfigurationsListByCluster + text: |- + az kusto attached-database-configuration list --cluster-name "KustoClusterRPTest4" --resource-group "kus\ +torptest" +""" + +helps['kusto attached-database-configuration show'] = """ + type: command + short-summary: Returns an attached database configuration. + examples: + - name: AttachedDatabaseConfigurationsGet + text: |- + az kusto attached-database-configuration show --attached-database-configuration-name "attachedDatabaseCo\ +nfigurations1" --cluster-name "KustoClusterRPTest4" --resource-group "kustorptest" +""" + +helps['kusto attached-database-configuration create'] = """ + type: command + short-summary: Creates or updates an attached database configuration. + examples: + - name: AttachedDatabaseConfigurationsCreateOrUpdate + text: |- + az kusto attached-database-configuration create --attached-database-configuration-name "attachedDatabase\ +Configurations1" --cluster-name "KustoClusterRPTest4" --location "westus" --cluster-resource-id "/subscriptions/1234567\ +8-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/KustoClusterLeader" --datab\ +ase-name "db1" --default-principals-modification-kind "Union" --resource-group "kustorptest" +""" + +helps['kusto attached-database-configuration update'] = """ + type: command + short-summary: Creates or updates an attached database configuration. + examples: + - name: AttachedDatabaseConfigurationsCreateOrUpdate + text: |- + az kusto attached-database-configuration update --attached-database-configuration-name "attachedDatabase\ +Configurations1" --cluster-name "KustoClusterRPTest4" --location "westus" --cluster-resource-id "/subscriptions/1234567\ +8-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.Kusto/Clusters/KustoClusterLeader" --datab\ +ase-name "db1" --default-principals-modification-kind "Union" --resource-group "kustorptest" +""" + +helps['kusto attached-database-configuration delete'] = """ + type: command + short-summary: Deletes the attached database configuration with the given name. + examples: + - name: AttachedDatabaseConfigurationsDelete + text: |- + az kusto attached-database-configuration delete --attached-database-configuration-name "attachedDatabase\ +Configurations1" --cluster-name "KustoClusterRPTest4" --resource-group "kustorptest" +""" + +helps['kusto data-connection'] = """ + type: group + short-summary: kusto data-connection +""" + +helps['kusto data-connection list'] = """ + type: command + short-summary: Returns the list of data connections of the given Kusto database. + examples: + - name: KustoDatabasesListByCluster + text: |- + az kusto data-connection list --cluster-name "KustoClusterRPTest4" --database-name "KustoDatabase8" --re\ +source-group "kustorptest" +""" + +helps['kusto data-connection show'] = """ + type: command + short-summary: Returns a data connection. + examples: + - name: KustoDataConnectionsGet + text: |- + az kusto data-connection show --cluster-name "KustoClusterRPTest4" --data-connection-name "DataConnectio\ +ns8" --database-name "KustoDatabase8" --resource-group "kustorptest" +""" + +helps['kusto data-connection event-grid'] = """ + type: group + short-summary: kusto data-connection sub group event-grid +""" + +helps['kusto data-connection event-grid create'] = """ + type: command + short-summary: Creates or updates a data connection. +""" + +helps['kusto data-connection event-hub'] = """ + type: group + short-summary: kusto data-connection sub group event-hub +""" + +helps['kusto data-connection event-hub create'] = """ + type: command + short-summary: Creates or updates a data connection. + examples: + - name: KustoDataConnectionsCreateOrUpdate + text: |- + az kusto data-connection event-hub create --cluster-name "KustoClusterRPTest4" --data-connection-name "D\ +ataConnections8" --database-name "KustoDatabase8" --location "westus" --consumer-group "testConsumerGroup1" --event-hub\ +-resource-id "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventH\ +ub/namespaces/eventhubTestns1/eventhubs/eventhubTest1" --resource-group "kustorptest" +""" + +helps['kusto data-connection iot-hub'] = """ + type: group + short-summary: kusto data-connection sub group iot-hub +""" + +helps['kusto data-connection iot-hub create'] = """ + type: command + short-summary: Creates or updates a data connection. +""" + +helps['kusto data-connection event-grid update'] = """ + type: command + short-summary: Updates a data connection. +""" + +helps['kusto data-connection event-hub update'] = """ + type: command + short-summary: Updates a data connection. + examples: + - name: KustoDataConnectionsUpdate + text: |- + az kusto data-connection event-hub update --cluster-name "KustoClusterRPTest4" --data-connection-name "D\ +ataConnections8" --database-name "KustoDatabase8" --location "westus" --consumer-group "testConsumerGroup1" --event-hub\ +-resource-id "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventH\ +ub/namespaces/eventhubTestns1/eventhubs/eventhubTest1" --resource-group "kustorptest" +""" + +helps['kusto data-connection iot-hub update'] = """ + type: command + short-summary: Updates a data connection. +""" + +helps['kusto data-connection delete'] = """ + type: command + short-summary: Deletes the data connection with the given name. + examples: + - name: KustoDataConnectionsDelete + text: |- + az kusto data-connection delete --cluster-name "KustoClusterRPTest4" --data-connection-name "kustoeventh\ +ubconnection1" --database-name "KustoDatabase8" --resource-group "kustorptest" +""" + +helps['kusto data-connection event-grid data-connection-validation'] = """ + type: command + short-summary: Checks that the data connection parameters are valid. +""" + +helps['kusto data-connection event-hub data-connection-validation'] = """ + type: command + short-summary: Checks that the data connection parameters are valid. + examples: + - name: KustoDataConnectionValidation + text: |- + az kusto data-connection event-hub data-connection-validation --cluster-name "KustoClusterRPTest4" --dat\ +abase-name "KustoDatabase8" --data-connection-name "DataConnections8" --consumer-group "testConsumerGroup1" --event-hub\ +-resource-id "/subscriptions/12345678-1234-1234-1234-123456789098/resourceGroups/kustorptest/providers/Microsoft.EventH\ +ub/namespaces/eventhubTestns1/eventhubs/eventhubTest1" --resource-group "kustorptest" +""" + +helps['kusto data-connection iot-hub data-connection-validation'] = """ + type: command + short-summary: Checks that the data connection parameters are valid. +""" diff --git a/src/kusto/azext_kusto/generated/_params.py b/src/kusto/azext_kusto/generated/_params.py new file mode 100644 index 00000000000..5caa356f3b1 --- /dev/null +++ b/src/kusto/azext_kusto/generated/_params.py @@ -0,0 +1,535 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.arguments import CLIArgumentType +from azure.cli.core.commands.parameters import ( + tags_type, + get_three_state_flag, + get_enum_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group +from azext_kusto.action import ( + AddSku, + AddTrustedExternalTenants, + AddOptimizedAutoscale, + AddVirtualNetworkConfiguration, + AddKeyVaultProperties, + AddLanguageExtensionsValue, + AddReadWriteDatabase, + AddReadOnlyFollowingDatabase, + AddValue +) + + +def load_arguments(self, _): + + with self.argument_context('kusto cluster list') as c: + c.argument('resource_group_name', resource_group_name_type) + + with self.argument_context('kusto cluster show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + + with self.argument_context('kusto cluster create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('tags', tags_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('sku', action=AddSku, nargs='+', help='The SKU of the cluster. Expect value: KEY1=VALUE1 KEY2=VALUE2' + ' ... , available KEYs are: name, capacity, tier.') + c.argument('zones', nargs='+', help='The availability zones of the cluster. Expected value: json-string/@json-f' + 'ile.') + c.argument('trusted_external_tenants', action=AddTrustedExternalTenants, nargs='+', help='The cluster\'s extern' + 'al tenants. Expect value: value=xx.') + c.argument('optimized_autoscale', action=AddOptimizedAutoscale, nargs='+', help='Optimized auto scale definitio' + 'n. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: version, is-enabled, minimum, ma' + 'ximum.') + c.argument('enable_disk_encryption', arg_type=get_three_state_flag(), help='A boolean value that indicates if t' + 'he cluster\'s disks are encrypted.') + c.argument('enable_streaming_ingest', arg_type=get_three_state_flag(), help='A boolean value that indicates if ' + 'the streaming ingest is enabled.') + c.argument('virtual_network_configuration', action=AddVirtualNetworkConfiguration, nargs='+', help='Virtual net' + 'work definition. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: subnet-id, engine-' + 'public-ip-id, data-management-public-ip-id.') + c.argument('key_vault_properties', action=AddKeyVaultProperties, nargs='+', help='KeyVault properties for the c' + 'luster encryption. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: key-name, key-ve' + 'rsion, key-vault-uri.') + c.argument('enable_purge', arg_type=get_three_state_flag(), help='A boolean value that indicates if the purge o' + 'perations are enabled.') + c.argument('language_extensions_value', action=AddLanguageExtensionsValue, nargs='+', help='The list of languag' + 'e extensions. Expect value: language-extension-name=xx.') + c.argument('identity_type', arg_type=get_enum_type(['None', 'SystemAssigned']), help='The identity type.') + c.argument('identity_user_assigned_identities', arg_type=CLIArgumentType(options_list=['--identity-user-assigne' + 'd-identities'], help='The list of user identities associated with the Kusto cluster. The user ident' + 'ity dictionary key references will be ARM resource ids in the form: \'/subscriptions/{subscriptionI' + 'd}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{i' + 'dentityName}\'. Expected value: json-string/@json-file.')) + + with self.argument_context('kusto cluster update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('tags', tags_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('sku', action=AddSku, nargs='+', help='The SKU of the cluster. Expect value: KEY1=VALUE1 KEY2=VALUE2' + ' ... , available KEYs are: name, capacity, tier.') + c.argument('trusted_external_tenants', action=AddTrustedExternalTenants, nargs='+', help='The cluster\'s extern' + 'al tenants. Expect value: value=xx.') + c.argument('optimized_autoscale', action=AddOptimizedAutoscale, nargs='+', help='Optimized auto scale definitio' + 'n. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: version, is-enabled, minimum, ma' + 'ximum.') + c.argument('enable_disk_encryption', arg_type=get_three_state_flag(), help='A boolean value that indicates if t' + 'he cluster\'s disks are encrypted.') + c.argument('enable_streaming_ingest', arg_type=get_three_state_flag(), help='A boolean value that indicates if ' + 'the streaming ingest is enabled.') + c.argument('virtual_network_configuration', action=AddVirtualNetworkConfiguration, nargs='+', help='Virtual net' + 'work definition. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: subnet-id, engine-' + 'public-ip-id, data-management-public-ip-id.') + c.argument('key_vault_properties', action=AddKeyVaultProperties, nargs='+', help='KeyVault properties for the c' + 'luster encryption. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: key-name, key-ve' + 'rsion, key-vault-uri.') + c.argument('enable_purge', arg_type=get_three_state_flag(), help='A boolean value that indicates if the purge o' + 'perations are enabled.') + c.argument('language_extensions_value', action=AddLanguageExtensionsValue, nargs='+', help='The list of languag' + 'e extensions. Expect value: language-extension-name=xx.') + c.argument('identity_type', arg_type=get_enum_type(['None', 'SystemAssigned']), help='The identity type.') + c.argument('identity_user_assigned_identities', arg_type=CLIArgumentType(options_list=['--identity-user-assigne' + 'd-identities'], help='The list of user identities associated with the Kusto cluster. The user ident' + 'ity dictionary key references will be ARM resource ids in the form: \'/subscriptions/{subscriptionI' + 'd}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{i' + 'dentityName}\'. Expected value: json-string/@json-file.')) + + with self.argument_context('kusto cluster delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + + with self.argument_context('kusto cluster add-language-extension') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('value', action=AddLanguageExtensionsValue, nargs='+', help='The list of language extensions. Expect' + ' value: language-extension-name=xx.') + + with self.argument_context('kusto cluster detach-follower-database') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('cluster_resource_id', help='Resource id of the cluster that follows a database owned by this cluste' + 'r.') + c.argument('attached_database_configuration_name', help='Resource name of the attached database configuration i' + 'n the follower cluster.') + + with self.argument_context('kusto cluster diagnose-virtual-network') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + + with self.argument_context('kusto cluster list-follower-database') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + + with self.argument_context('kusto cluster list-language-extension') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + + with self.argument_context('kusto cluster list-sku') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + + with self.argument_context('kusto cluster remove-language-extension') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('value', action=AddLanguageExtensionsValue, nargs='+', help='The list of language extensions. Expect' + ' value: language-extension-name=xx.') + + with self.argument_context('kusto cluster start') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + + with self.argument_context('kusto cluster stop') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + + with self.argument_context('kusto cluster-principal-assignment list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + + with self.argument_context('kusto cluster-principal-assignment show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('principal_assignment_name', help='The name of the Kusto principalAssignment.') + + with self.argument_context('kusto cluster-principal-assignment create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('principal_assignment_name', help='The name of the Kusto principalAssignment.') + c.argument('principal_id', help='The principal ID assigned to the cluster principal. It can be a user email, ap' + 'plication ID, or security group name.') + c.argument('role', arg_type=get_enum_type(['AllDatabasesAdmin', 'AllDatabasesViewer']), help='Cluster principal' + ' role.') + c.argument('tenant_id', help='The tenant id of the principal') + c.argument('principal_type', arg_type=get_enum_type(['App', 'Group', 'User']), help='Principal type.') + + with self.argument_context('kusto cluster-principal-assignment update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('principal_assignment_name', help='The name of the Kusto principalAssignment.') + c.argument('principal_id', help='The principal ID assigned to the cluster principal. It can be a user email, ap' + 'plication ID, or security group name.') + c.argument('role', arg_type=get_enum_type(['AllDatabasesAdmin', 'AllDatabasesViewer']), help='Cluster principal' + ' role.') + c.argument('tenant_id', help='The tenant id of the principal') + c.argument('principal_type', arg_type=get_enum_type(['App', 'Group', 'User']), help='Principal type.') + + with self.argument_context('kusto cluster-principal-assignment delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('principal_assignment_name', help='The name of the Kusto principalAssignment.') + + with self.argument_context('kusto database list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + + with self.argument_context('kusto database show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + + with self.argument_context('kusto database create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('read_write_database', action=AddReadWriteDatabase, nargs='+', help='Class representing a read write' + ' database. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: soft-delete-period, hot-' + 'cache-period, location.', arg_group='Parameters') + c.argument('read_only_following_database', action=AddReadOnlyFollowingDatabase, nargs='+', help='Class represen' + 'ting a read only following database. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are' + ': hot-cache-period, location.', arg_group='Parameters') + + with self.argument_context('kusto database update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('read_write_database', action=AddReadWriteDatabase, nargs='+', help='Class representing a read write' + ' database. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are: soft-delete-period, hot-' + 'cache-period, location.', arg_group='Parameters') + c.argument('read_only_following_database', action=AddReadOnlyFollowingDatabase, nargs='+', help='Class represen' + 'ting a read only following database. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs are' + ': hot-cache-period, location.', arg_group='Parameters') + + with self.argument_context('kusto database delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + + with self.argument_context('kusto database add-principal') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('value', action=AddValue, nargs='+', help='The list of Kusto database principals. Expect value: KEY1' + '=VALUE1 KEY2=VALUE2 ... , available KEYs are: role, name, type, fqn, email, app-id.') + + with self.argument_context('kusto database list-principal') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + + with self.argument_context('kusto database remove-principal') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('value', action=AddValue, nargs='+', help='The list of Kusto database principals. Expect value: KEY1' + '=VALUE1 KEY2=VALUE2 ... , available KEYs are: role, name, type, fqn, email, app-id.') + + with self.argument_context('kusto database-principal-assignment list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + + with self.argument_context('kusto database-principal-assignment show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('principal_assignment_name', help='The name of the Kusto principalAssignment.') + + with self.argument_context('kusto database-principal-assignment create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('principal_assignment_name', help='The name of the Kusto principalAssignment.') + c.argument('principal_id', help='The principal ID assigned to the database principal. It can be a user email, a' + 'pplication ID, or security group name.') + c.argument('role', arg_type=get_enum_type(['Admin', 'Ingestor', 'Monitor', 'User', 'UnrestrictedViewers', 'View' + 'er']), help='Database principal role.') + c.argument('tenant_id', help='The tenant id of the principal') + c.argument('principal_type', arg_type=get_enum_type(['App', 'Group', 'User']), help='Principal type.') + + with self.argument_context('kusto database-principal-assignment update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('principal_assignment_name', help='The name of the Kusto principalAssignment.') + c.argument('principal_id', help='The principal ID assigned to the database principal. It can be a user email, a' + 'pplication ID, or security group name.') + c.argument('role', arg_type=get_enum_type(['Admin', 'Ingestor', 'Monitor', 'User', 'UnrestrictedViewers', 'View' + 'er']), help='Database principal role.') + c.argument('tenant_id', help='The tenant id of the principal') + c.argument('principal_type', arg_type=get_enum_type(['App', 'Group', 'User']), help='Principal type.') + + with self.argument_context('kusto database-principal-assignment delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('principal_assignment_name', help='The name of the Kusto principalAssignment.') + + with self.argument_context('kusto attached-database-configuration list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + + with self.argument_context('kusto attached-database-configuration show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('attached_database_configuration_name', help='The name of the attached database configuration.') + + with self.argument_context('kusto attached-database-configuration create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('attached_database_configuration_name', help='The name of the attached database configuration.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('database_name', help='The name of the database which you would like to attach, use * if you want to' + ' follow all current and future databases.') + c.argument('cluster_resource_id', help='The resource id of the cluster where the databases you would like to at' + 'tach reside.') + c.argument('default_principals_modification_kind', arg_type=get_enum_type(['Union', 'Replace', 'None']), help= + 'The default principals modification kind') + + with self.argument_context('kusto attached-database-configuration update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('attached_database_configuration_name', help='The name of the attached database configuration.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('database_name', help='The name of the database which you would like to attach, use * if you want to' + ' follow all current and future databases.') + c.argument('cluster_resource_id', help='The resource id of the cluster where the databases you would like to at' + 'tach reside.') + c.argument('default_principals_modification_kind', arg_type=get_enum_type(['Union', 'Replace', 'None']), help= + 'The default principals modification kind') + + with self.argument_context('kusto attached-database-configuration delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('attached_database_configuration_name', help='The name of the attached database configuration.') + + with self.argument_context('kusto data-connection list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + + with self.argument_context('kusto data-connection show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('data_connection_name', help='The name of the data connection.') + + with self.argument_context('kusto data-connection event-grid create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('data_connection_name', help='The name of the data connection.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('storage_account_resource_id', + help='The resource ID of the storage account where the data resides.') + c.argument('event_hub_resource_id', help='The resource ID where the event grid is configured to send events.') + c.argument('consumer_group', help='The event hub consumer group.') + c.argument('table_name', help='The table where the data should be ingested. Optionally the table information ca' + 'n be added to each message.') + c.argument('mapping_rule_name', help='The mapping rule to be used to ingest the data. Optionally the mapping in' + 'formation can be added to each message.') + c.argument('data_format', arg_type=get_enum_type(['MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'T' + 'XT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC']), help='The data format of the message.' + ' Optionally the data format can be added to each message.') + + with self.argument_context('kusto data-connection event-hub create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('data_connection_name', help='The name of the data connection.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('event_hub_resource_id', help='The resource ID of the event hub to be used to create a data connecti' + 'on.') + c.argument('consumer_group', help='The event hub consumer group.') + c.argument('table_name', help='The table where the data should be ingested. Optionally the table information ca' + 'n be added to each message.') + c.argument('mapping_rule_name', help='The mapping rule to be used to ingest the data. Optionally the mapping in' + 'formation can be added to each message.') + c.argument('data_format', arg_type=get_enum_type(['MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'T' + 'XT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC']), help='The data format of the message.' + ' Optionally the data format can be added to each message.') + c.argument('event_system_properties', nargs='+', help='System properties of the event hub Expected value: json-' + 'string/@json-file.') + c.argument('compression', arg_type=get_enum_type(['None', 'GZip']), help='The event hub messages compression ty' + 'pe') + + with self.argument_context('kusto data-connection iot-hub create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('data_connection_name', help='The name of the data connection.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('iot_hub_resource_id', + help='The resource ID of the Iot hub to be used to create a data connection.') + c.argument('consumer_group', help='The iot hub consumer group.') + c.argument('table_name', help='The table where the data should be ingested. Optionally the table information ca' + 'n be added to each message.') + c.argument('mapping_rule_name', help='The mapping rule to be used to ingest the data. Optionally the mapping in' + 'formation can be added to each message.') + c.argument('data_format', arg_type=get_enum_type(['MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'T' + 'XT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC']), help='The data format of the message.' + ' Optionally the data format can be added to each message.') + c.argument('event_system_properties', nargs='+', help='System properties of the iot hub Expected value: json-st' + 'ring/@json-file.') + c.argument('shared_access_policy_name', help='The name of the share access policy') + + with self.argument_context('kusto data-connection event-grid update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('data_connection_name', help='The name of the data connection.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('storage_account_resource_id', + help='The resource ID of the storage account where the data resides.') + c.argument('event_hub_resource_id', help='The resource ID where the event grid is configured to send events.') + c.argument('consumer_group', help='The event hub consumer group.') + c.argument('table_name', help='The table where the data should be ingested. Optionally the table information ca' + 'n be added to each message.') + c.argument('mapping_rule_name', help='The mapping rule to be used to ingest the data. Optionally the mapping in' + 'formation can be added to each message.') + c.argument('data_format', arg_type=get_enum_type(['MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'T' + 'XT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC']), help='The data format of the message.' + ' Optionally the data format can be added to each message.') + + with self.argument_context('kusto data-connection event-hub update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('data_connection_name', help='The name of the data connection.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('event_hub_resource_id', help='The resource ID of the event hub to be used to create a data connecti' + 'on.') + c.argument('consumer_group', help='The event hub consumer group.') + c.argument('table_name', help='The table where the data should be ingested. Optionally the table information ca' + 'n be added to each message.') + c.argument('mapping_rule_name', help='The mapping rule to be used to ingest the data. Optionally the mapping in' + 'formation can be added to each message.') + c.argument('data_format', arg_type=get_enum_type(['MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'T' + 'XT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC']), help='The data format of the message.' + ' Optionally the data format can be added to each message.') + c.argument('event_system_properties', nargs='+', help='System properties of the event hub Expected value: json-' + 'string/@json-file.') + c.argument('compression', arg_type=get_enum_type(['None', 'GZip']), help='The event hub messages compression ty' + 'pe') + + with self.argument_context('kusto data-connection iot-hub update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('data_connection_name', help='The name of the data connection.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('iot_hub_resource_id', + help='The resource ID of the Iot hub to be used to create a data connection.') + c.argument('consumer_group', help='The iot hub consumer group.') + c.argument('table_name', help='The table where the data should be ingested. Optionally the table information ca' + 'n be added to each message.') + c.argument('mapping_rule_name', help='The mapping rule to be used to ingest the data. Optionally the mapping in' + 'formation can be added to each message.') + c.argument('data_format', arg_type=get_enum_type(['MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'T' + 'XT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC']), help='The data format of the message.' + ' Optionally the data format can be added to each message.') + c.argument('event_system_properties', nargs='+', help='System properties of the iot hub Expected value: json-st' + 'ring/@json-file.') + c.argument('shared_access_policy_name', help='The name of the share access policy') + + with self.argument_context('kusto data-connection delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('data_connection_name', help='The name of the data connection.') + + with self.argument_context('kusto data-connection event-grid data-connection-validation') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('data_connection_name', help='The name of the data connection.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('storage_account_resource_id', + help='The resource ID of the storage account where the data resides.') + c.argument('event_hub_resource_id', help='The resource ID where the event grid is configured to send events.') + c.argument('consumer_group', help='The event hub consumer group.') + c.argument('table_name', help='The table where the data should be ingested. Optionally the table information ca' + 'n be added to each message.') + c.argument('mapping_rule_name', help='The mapping rule to be used to ingest the data. Optionally the mapping in' + 'formation can be added to each message.') + c.argument('data_format', arg_type=get_enum_type(['MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'T' + 'XT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC']), help='The data format of the message.' + ' Optionally the data format can be added to each message.') + + with self.argument_context('kusto data-connection event-hub data-connection-validation') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('data_connection_name', help='The name of the data connection.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('event_hub_resource_id', help='The resource ID of the event hub to be used to create a data connecti' + 'on.') + c.argument('consumer_group', help='The event hub consumer group.') + c.argument('table_name', help='The table where the data should be ingested. Optionally the table information ca' + 'n be added to each message.') + c.argument('mapping_rule_name', help='The mapping rule to be used to ingest the data. Optionally the mapping in' + 'formation can be added to each message.') + c.argument('data_format', arg_type=get_enum_type(['MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'T' + 'XT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC']), help='The data format of the message.' + ' Optionally the data format can be added to each message.') + c.argument('event_system_properties', nargs='+', help='System properties of the event hub Expected value: json-' + 'string/@json-file.') + c.argument('compression', arg_type=get_enum_type(['None', 'GZip']), help='The event hub messages compression ty' + 'pe') + + with self.argument_context('kusto data-connection iot-hub data-connection-validation') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('cluster_name', help='The name of the Kusto cluster.') + c.argument('database_name', help='The name of the database in the Kusto cluster.') + c.argument('data_connection_name', help='The name of the data connection.') + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('iot_hub_resource_id', + help='The resource ID of the Iot hub to be used to create a data connection.') + c.argument('consumer_group', help='The iot hub consumer group.') + c.argument('table_name', help='The table where the data should be ingested. Optionally the table information ca' + 'n be added to each message.') + c.argument('mapping_rule_name', help='The mapping rule to be used to ingest the data. Optionally the mapping in' + 'formation can be added to each message.') + c.argument('data_format', arg_type=get_enum_type(['MULTIJSON', 'JSON', 'CSV', 'TSV', 'SCSV', 'SOHSV', 'PSV', 'T' + 'XT', 'RAW', 'SINGLEJSON', 'AVRO', 'TSVE', 'PARQUET', 'ORC']), help='The data format of the message.' + ' Optionally the data format can be added to each message.') + c.argument('event_system_properties', nargs='+', help='System properties of the iot hub Expected value: json-st' + 'ring/@json-file.') + c.argument('shared_access_policy_name', help='The name of the share access policy') diff --git a/src/kusto/azext_kusto/generated/_validators.py b/src/kusto/azext_kusto/generated/_validators.py new file mode 100644 index 00000000000..7536d0531ea --- /dev/null +++ b/src/kusto/azext_kusto/generated/_validators.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- + + +def example_name_or_id_validator(cmd, namespace): + from azure.cli.core.commands.client_factory import get_subscription_id + from msrestazure.tools import is_valid_resource_id, resource_id + if namespace.storage_account: + if not is_valid_resource_id(namespace.RESOURCE): + namespace.storage_account = resource_id( + subscription=get_subscription_id(cmd.cli_ctx), + resource_group=namespace.resource_group_name, + namespace='Microsoft.Storage', + type='storageAccounts', + name=namespace.storage_account + ) diff --git a/src/kusto/azext_kusto/generated/action.py b/src/kusto/azext_kusto/generated/action.py new file mode 100644 index 00000000000..cdcd8fc8ebb --- /dev/null +++ b/src/kusto/azext_kusto/generated/action.py @@ -0,0 +1,257 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access + +import argparse +from knack.util import CLIError +from collections import defaultdict + + +class AddSku(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.sku = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'name': + d['name'] = v[0] + elif kl == 'capacity': + d['capacity'] = v[0] + elif kl == 'tier': + d['tier'] = v[0] + return d + + +class AddTrustedExternalTenants(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddTrustedExternalTenants, self).__call__(parser, namespace, action, option_string) + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'value': + d['value'] = v[0] + return d + + +class AddOptimizedAutoscale(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.optimized_autoscale = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'version': + d['version'] = v[0] + elif kl == 'is-enabled': + d['is_enabled'] = v[0] + elif kl == 'minimum': + d['minimum'] = v[0] + elif kl == 'maximum': + d['maximum'] = v[0] + return d + + +class AddVirtualNetworkConfiguration(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.virtual_network_configuration = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'subnet-id': + d['subnet_id'] = v[0] + elif kl == 'engine-public-ip-id': + d['engine_public_ip_id'] = v[0] + elif kl == 'data-management-public-ip-id': + d['data_management_public_ip_id'] = v[0] + return d + + +class AddKeyVaultProperties(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.key_vault_properties = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'key-name': + d['key_name'] = v[0] + elif kl == 'key-version': + d['key_version'] = v[0] + elif kl == 'key-vault-uri': + d['key_vault_uri'] = v[0] + return d + + +class AddLanguageExtensionsValue(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddLanguageExtensionsValue, self).__call__(parser, namespace, action, option_string) + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'language-extension-name': + d['language_extension_name'] = v[0] + return d + + +class AddReadWriteDatabase(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.read_write_database = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'soft-delete-period': + d['soft_delete_period'] = v[0] + elif kl == 'hot-cache-period': + d['hot_cache_period'] = v[0] + elif kl == 'location': + d['location'] = v[0] + d['kind'] = 'ReadWrite' + return d + + +class AddReadOnlyFollowingDatabase(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.read_only_following_database = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'hot-cache-period': + d['hot_cache_period'] = v[0] + elif kl == 'location': + d['location'] = v[0] + d['kind'] = 'ReadOnlyFollowing' + return d + + +class AddValue(argparse._AppendAction): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + super(AddValue, self).__call__(parser, namespace, action, option_string) + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'role': + d['role'] = v[0] + elif kl == 'name': + d['name'] = v[0] + elif kl == 'type': + d['type'] = v[0] + elif kl == 'fqn': + d['fqn'] = v[0] + elif kl == 'email': + d['email'] = v[0] + elif kl == 'app-id': + d['app_id'] = v[0] + return d diff --git a/src/kusto/azext_kusto/generated/commands.py b/src/kusto/azext_kusto/generated/commands.py new file mode 100644 index 00000000000..3058e404f8a --- /dev/null +++ b/src/kusto/azext_kusto/generated/commands.py @@ -0,0 +1,117 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_kusto.generated._client_factory import cf_cluster + kusto_cluster = CliCommandType( + operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._cluster_operations#ClusterOperations.{}', + client_factory=cf_cluster) + with self.command_group('kusto cluster', kusto_cluster, client_factory=cf_cluster, is_experimental=True) as g: + g.custom_command('list', 'kusto_cluster_list') + g.custom_show_command('show', 'kusto_cluster_show') + g.custom_command('create', 'kusto_cluster_create', supports_no_wait=True) + g.custom_command('update', 'kusto_cluster_update', supports_no_wait=True) + g.custom_command('delete', 'kusto_cluster_delete', supports_no_wait=True) + g.custom_command('add-language-extension', 'kusto_cluster_add_language_extension', supports_no_wait=True) + g.custom_command('detach-follower-database', 'kusto_cluster_detach_follower_database', supports_no_wait=True) + g.custom_command('diagnose-virtual-network', 'kusto_cluster_diagnose_virtual_network', supports_no_wait=True) + g.custom_command('list-follower-database', 'kusto_cluster_list_follower_database') + g.custom_command('list-language-extension', 'kusto_cluster_list_language_extension') + g.custom_command('list-sku', 'kusto_cluster_list_sku') + g.custom_command('remove-language-extension', 'kusto_cluster_remove_language_extension', + supports_no_wait=True) + g.custom_command('start', 'kusto_cluster_start', supports_no_wait=True) + g.custom_command('stop', 'kusto_cluster_stop', supports_no_wait=True) + g.wait_command('wait') + + from azext_kusto.generated._client_factory import cf_cluster_principal_assignment + kusto_cluster_principal_assignment = CliCommandType( + operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._cluster_principal_assignment_operations#ClusterPri' + 'ncipalAssignmentOperations.{}', + client_factory=cf_cluster_principal_assignment) + with self.command_group('kusto cluster-principal-assignment', kusto_cluster_principal_assignment, + client_factory=cf_cluster_principal_assignment, is_experimental=True) as g: + g.custom_command('list', 'kusto_cluster_principal_assignment_list') + g.custom_show_command('show', 'kusto_cluster_principal_assignment_show') + g.custom_command('create', 'kusto_cluster_principal_assignment_create', supports_no_wait=True) + g.custom_command('update', 'kusto_cluster_principal_assignment_update', supports_no_wait=True) + g.custom_command('delete', 'kusto_cluster_principal_assignment_delete', supports_no_wait=True) + g.wait_command('wait') + + from azext_kusto.generated._client_factory import cf_database + kusto_database = CliCommandType( + operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._database_operations#DatabaseOperations.{}', + client_factory=cf_database) + with self.command_group('kusto database', kusto_database, client_factory=cf_database, is_experimental=True) as g: + g.custom_command('list', 'kusto_database_list') + g.custom_show_command('show', 'kusto_database_show') + g.custom_command('create', 'kusto_database_create', supports_no_wait=True) + g.custom_command('update', 'kusto_database_update', supports_no_wait=True) + g.custom_command('delete', 'kusto_database_delete', supports_no_wait=True) + g.custom_command('add-principal', 'kusto_database_add_principal') + g.custom_command('list-principal', 'kusto_database_list_principal') + g.custom_command('remove-principal', 'kusto_database_remove_principal') + g.wait_command('wait') + + from azext_kusto.generated._client_factory import cf_database_principal_assignment + kusto_database_principal_assignment = CliCommandType( + operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._database_principal_assignment_operations#DatabaseP' + 'rincipalAssignmentOperations.{}', + client_factory=cf_database_principal_assignment) + with self.command_group('kusto database-principal-assignment', kusto_database_principal_assignment, + client_factory=cf_database_principal_assignment, is_experimental=True) as g: + g.custom_command('list', 'kusto_database_principal_assignment_list') + g.custom_show_command('show', 'kusto_database_principal_assignment_show') + g.custom_command('create', 'kusto_database_principal_assignment_create', supports_no_wait=True) + g.custom_command('update', 'kusto_database_principal_assignment_update', supports_no_wait=True) + g.custom_command('delete', 'kusto_database_principal_assignment_delete', supports_no_wait=True) + g.wait_command('wait') + + from azext_kusto.generated._client_factory import cf_attached_database_configuration + kusto_attached_database_configuration = CliCommandType( + operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._attached_database_configuration_operations#Attache' + 'dDatabaseConfigurationOperations.{}', + client_factory=cf_attached_database_configuration) + with self.command_group('kusto attached-database-configuration', kusto_attached_database_configuration, + client_factory=cf_attached_database_configuration, is_experimental=True) as g: + g.custom_command('list', 'kusto_attached_database_configuration_list') + g.custom_show_command('show', 'kusto_attached_database_configuration_show') + g.custom_command('create', 'kusto_attached_database_configuration_create', supports_no_wait=True) + g.custom_command('update', 'kusto_attached_database_configuration_update', supports_no_wait=True) + g.custom_command('delete', 'kusto_attached_database_configuration_delete', supports_no_wait=True) + g.wait_command('wait') + + from azext_kusto.generated._client_factory import cf_data_connection + kusto_data_connection = CliCommandType( + operations_tmpl='azext_kusto.vendored_sdks.kusto.operations._data_connection_operations#DataConnectionOperation' + 's.{}', + client_factory=cf_data_connection) + with self.command_group('kusto data-connection', kusto_data_connection, client_factory=cf_data_connection, + is_experimental=True) as g: + g.custom_command('list', 'kusto_data_connection_list') + g.custom_show_command('show', 'kusto_data_connection_show') + g.custom_command('event-grid create', 'kusto_data_connection_event_grid_create', supports_no_wait=True) + g.custom_command('event-hub create', 'kusto_data_connection_event_hub_create', supports_no_wait=True) + g.custom_command('iot-hub create', 'kusto_data_connection_iot_hub_create', supports_no_wait=True) + g.custom_command('event-grid update', 'kusto_data_connection_event_grid_update', supports_no_wait=True) + g.custom_command('event-hub update', 'kusto_data_connection_event_hub_update', supports_no_wait=True) + g.custom_command('iot-hub update', 'kusto_data_connection_iot_hub_update', supports_no_wait=True) + g.custom_command('delete', 'kusto_data_connection_delete', supports_no_wait=True) + g.custom_command('event-grid data-connection-validation', 'kusto_data_connection_event_grid_data_connection_val' + 'idation') + g.custom_command('event-hub data-connection-validation', 'kusto_data_connection_event_hub_data_connection_valid' + 'ation') + g.custom_command('iot-hub data-connection-validation', 'kusto_data_connection_iot_hub_data_connection_validatio' + 'n') + g.wait_command('wait') diff --git a/src/kusto/azext_kusto/generated/custom.py b/src/kusto/azext_kusto/generated/custom.py new file mode 100644 index 00000000000..21273664e71 --- /dev/null +++ b/src/kusto/azext_kusto/generated/custom.py @@ -0,0 +1,778 @@ +# -------------------------------------------------------------------------- +# 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. +# -------------------------------------------------------------------------- +# pylint: disable=line-too-long +# pylint: disable=too-many-lines + +import json +from knack.util import CLIError + + +def kusto_cluster_list(cmd, client, + resource_group_name=None): + if resource_group_name is not None: + return client.list_by_resource_group(resource_group_name=resource_group_name) + return client.list() + + +def kusto_cluster_show(cmd, client, + resource_group_name, + cluster_name): + return client.get(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def kusto_cluster_create(cmd, client, + resource_group_name, + cluster_name, + location, + sku, + tags=None, + zones=None, + trusted_external_tenants=None, + optimized_autoscale=None, + enable_disk_encryption=None, + enable_streaming_ingest=None, + virtual_network_configuration=None, + key_vault_properties=None, + enable_purge=None, + language_extensions_value=None, + identity_type=None, + identity_user_assigned_identities=None): + if isinstance(zones, str): + zones = json.loads(zones) + if isinstance(identity_user_assigned_identities, str): + identity_user_assigned_identities = json.loads(identity_user_assigned_identities) + return client.begin_create_or_update(resource_group_name=resource_group_name, + cluster_name=cluster_name, + 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, + value=language_extensions_value, + type=identity_type, + user_assigned_identities=identity_user_assigned_identities) + + +def kusto_cluster_update(cmd, client, + resource_group_name, + cluster_name, + tags=None, + location=None, + sku=None, + trusted_external_tenants=None, + optimized_autoscale=None, + enable_disk_encryption=None, + enable_streaming_ingest=None, + virtual_network_configuration=None, + key_vault_properties=None, + enable_purge=None, + language_extensions_value=None, + identity_type=None, + identity_user_assigned_identities=None): + if isinstance(identity_user_assigned_identities, str): + identity_user_assigned_identities = json.loads(identity_user_assigned_identities) + return client.begin_update(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, + value=language_extensions_value, + type=identity_type, + user_assigned_identities=identity_user_assigned_identities) + + +def kusto_cluster_delete(cmd, client, + resource_group_name, + cluster_name): + return client.begin_delete(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def kusto_cluster_add_language_extension(cmd, client, + resource_group_name, + cluster_name, + value=None): + return client.begin_add_language_extension(resource_group_name=resource_group_name, + cluster_name=cluster_name, + value=value) + + +def kusto_cluster_detach_follower_database(cmd, client, + resource_group_name, + cluster_name, + cluster_resource_id, + attached_database_configuration_name): + return client.begin_detach_follower_database(resource_group_name=resource_group_name, + cluster_name=cluster_name, + cluster_resource_id=cluster_resource_id, + attached_database_configuration_name=attached_database_configuration_name) + + +def kusto_cluster_diagnose_virtual_network(cmd, client, + resource_group_name, + cluster_name): + return client.begin_diagnose_virtual_network(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def kusto_cluster_list_follower_database(cmd, client, + resource_group_name, + cluster_name): + return client.list_follower_database(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def kusto_cluster_list_language_extension(cmd, client, + resource_group_name, + cluster_name): + return client.list_language_extension(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def kusto_cluster_list_sku(cmd, client, + resource_group_name=None, + cluster_name=None): + if resource_group_name is not None and cluster_name is not None: + return client.list_sku_by_resource(resource_group_name=resource_group_name, + cluster_name=cluster_name) + return client.list_sku() + + +def kusto_cluster_remove_language_extension(cmd, client, + resource_group_name, + cluster_name, + value=None): + return client.begin_remove_language_extension(resource_group_name=resource_group_name, + cluster_name=cluster_name, + value=value) + + +def kusto_cluster_start(cmd, client, + resource_group_name, + cluster_name): + return client.begin_start(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def kusto_cluster_stop(cmd, client, + resource_group_name, + cluster_name): + return client.begin_stop(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def kusto_cluster_principal_assignment_list(cmd, client, + resource_group_name, + cluster_name): + return client.list(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def kusto_cluster_principal_assignment_show(cmd, client, + resource_group_name, + cluster_name, + principal_assignment_name): + return client.get(resource_group_name=resource_group_name, + cluster_name=cluster_name, + principal_assignment_name=principal_assignment_name) + + +def kusto_cluster_principal_assignment_create(cmd, client, + resource_group_name, + cluster_name, + principal_assignment_name, + principal_id=None, + role=None, + tenant_id=None, + principal_type=None): + return client.begin_create_or_update(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) + + +def kusto_cluster_principal_assignment_update(cmd, client, + resource_group_name, + cluster_name, + principal_assignment_name, + principal_id=None, + role=None, + tenant_id=None, + principal_type=None): + return client.begin_create_or_update(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) + + +def kusto_cluster_principal_assignment_delete(cmd, client, + resource_group_name, + cluster_name, + principal_assignment_name): + return client.begin_delete(resource_group_name=resource_group_name, + cluster_name=cluster_name, + principal_assignment_name=principal_assignment_name) + + +def kusto_database_list(cmd, client, + resource_group_name, + cluster_name): + return client.list_by_cluster(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def kusto_database_show(cmd, client, + resource_group_name, + cluster_name, + database_name): + return client.get(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name) + + +def kusto_database_create(cmd, client, + resource_group_name, + cluster_name, + database_name, + read_write_database=None, + read_only_following_database=None): + all_parameters = [] + if read_write_database is not None: + all_parameters.append(read_write_database) + if read_only_following_database is not None: + all_parameters.append(read_only_following_database) + if len(all_parameters) > 1: + raise CLIError('at most one of read_write_database, read_only_following_database is needed for parameters!') + if len(all_parameters) != 1: + raise CLIError('parameters is required. but none of read_write_database, read_only_following_database is provid' + 'ed!') + parameters = all_parameters[0] if len(all_parameters) == 1 else None + return client.begin_create_or_update(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters) + + +def kusto_database_update(cmd, client, + resource_group_name, + cluster_name, + database_name, + read_write_database=None, + read_only_following_database=None): + all_parameters = [] + if read_write_database is not None: + all_parameters.append(read_write_database) + if read_only_following_database is not None: + all_parameters.append(read_only_following_database) + if len(all_parameters) > 1: + raise CLIError('at most one of read_write_database, read_only_following_database is needed for parameters!') + if len(all_parameters) != 1: + raise CLIError('parameters is required. but none of read_write_database, read_only_following_database is provid' + 'ed!') + parameters = all_parameters[0] if len(all_parameters) == 1 else None + return client.begin_update(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + parameters=parameters) + + +def kusto_database_delete(cmd, client, + resource_group_name, + cluster_name, + database_name): + return client.begin_delete(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name) + + +def kusto_database_add_principal(cmd, client, + resource_group_name, + cluster_name, + database_name, + value=None): + return client.add_principal(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + value=value) + + +def kusto_database_list_principal(cmd, client, + resource_group_name, + cluster_name, + database_name): + return client.list_principal(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name) + + +def kusto_database_remove_principal(cmd, client, + resource_group_name, + cluster_name, + database_name, + value=None): + return client.remove_principal(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + value=value) + + +def kusto_database_principal_assignment_list(cmd, client, + resource_group_name, + cluster_name, + database_name): + return client.list(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name) + + +def kusto_database_principal_assignment_show(cmd, client, + resource_group_name, + cluster_name, + database_name, + principal_assignment_name): + return client.get(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + principal_assignment_name=principal_assignment_name) + + +def kusto_database_principal_assignment_create(cmd, client, + resource_group_name, + cluster_name, + database_name, + principal_assignment_name, + principal_id=None, + role=None, + tenant_id=None, + principal_type=None): + return client.begin_create_or_update(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) + + +def kusto_database_principal_assignment_update(cmd, client, + resource_group_name, + cluster_name, + database_name, + principal_assignment_name, + principal_id=None, + role=None, + tenant_id=None, + principal_type=None): + return client.begin_create_or_update(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) + + +def kusto_database_principal_assignment_delete(cmd, client, + resource_group_name, + cluster_name, + database_name, + principal_assignment_name): + return client.begin_delete(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + principal_assignment_name=principal_assignment_name) + + +def kusto_attached_database_configuration_list(cmd, client, + resource_group_name, + cluster_name): + return client.list_by_cluster(resource_group_name=resource_group_name, + cluster_name=cluster_name) + + +def kusto_attached_database_configuration_show(cmd, client, + resource_group_name, + cluster_name, + attached_database_configuration_name): + return client.get(resource_group_name=resource_group_name, + cluster_name=cluster_name, + attached_database_configuration_name=attached_database_configuration_name) + + +def kusto_attached_database_configuration_create(cmd, client, + resource_group_name, + cluster_name, + attached_database_configuration_name, + location=None, + database_name=None, + cluster_resource_id=None, + default_principals_modification_kind=None): + return client.begin_create_or_update(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) + + +def kusto_attached_database_configuration_update(cmd, client, + resource_group_name, + cluster_name, + attached_database_configuration_name, + location=None, + database_name=None, + cluster_resource_id=None, + default_principals_modification_kind=None): + return client.begin_create_or_update(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) + + +def kusto_attached_database_configuration_delete(cmd, client, + resource_group_name, + cluster_name, + attached_database_configuration_name): + return client.begin_delete(resource_group_name=resource_group_name, + cluster_name=cluster_name, + attached_database_configuration_name=attached_database_configuration_name) + + +def kusto_data_connection_list(cmd, client, + resource_group_name, + cluster_name, + database_name): + return client.list_by_database(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name) + + +def kusto_data_connection_show(cmd, client, + resource_group_name, + cluster_name, + database_name, + data_connection_name): + return client.get(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name) + + +def kusto_data_connection_event_grid_create(cmd, client, + resource_group_name, + cluster_name, + database_name, + data_connection_name, + location=None, + storage_account_resource_id=None, + event_hub_resource_id=None, + consumer_group=None, + table_name=None, + mapping_rule_name=None, + data_format=None): + parameters = {} + parameters['location'] = location + parameters['kind'] = 'EventGrid' + parameters['storage_account_resource_id'] = storage_account_resource_id + parameters['event_hub_resource_id'] = event_hub_resource_id + parameters['consumer_group'] = consumer_group + parameters['table_name'] = table_name + parameters['mapping_rule_name'] = mapping_rule_name + parameters['data_format'] = data_format + return client.begin_create_or_update(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + parameters=parameters) + + +def kusto_data_connection_event_hub_create(cmd, client, + resource_group_name, + cluster_name, + database_name, + data_connection_name, + location=None, + event_hub_resource_id=None, + consumer_group=None, + table_name=None, + mapping_rule_name=None, + data_format=None, + event_system_properties=None, + compression=None): + if isinstance(event_system_properties, str): + event_system_properties = json.loads(event_system_properties) + parameters = {} + parameters['location'] = location + parameters['kind'] = 'EventHub' + parameters['event_hub_resource_id'] = event_hub_resource_id + parameters['consumer_group'] = consumer_group + parameters['table_name'] = table_name + parameters['mapping_rule_name'] = mapping_rule_name + parameters['data_format'] = data_format + parameters['event_system_properties'] = event_system_properties + parameters['compression'] = compression + return client.begin_create_or_update(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + parameters=parameters) + + +def kusto_data_connection_iot_hub_create(cmd, client, + resource_group_name, + cluster_name, + database_name, + data_connection_name, + location=None, + iot_hub_resource_id=None, + consumer_group=None, + table_name=None, + mapping_rule_name=None, + data_format=None, + event_system_properties=None, + shared_access_policy_name=None): + if isinstance(event_system_properties, str): + event_system_properties = json.loads(event_system_properties) + parameters = {} + parameters['location'] = location + parameters['kind'] = 'IotHub' + parameters['iot_hub_resource_id'] = iot_hub_resource_id + parameters['consumer_group'] = consumer_group + parameters['table_name'] = table_name + parameters['mapping_rule_name'] = mapping_rule_name + parameters['data_format'] = data_format + parameters['event_system_properties'] = event_system_properties + parameters['shared_access_policy_name'] = shared_access_policy_name + return client.begin_create_or_update(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + parameters=parameters) + + +def kusto_data_connection_event_grid_update(cmd, client, + resource_group_name, + cluster_name, + database_name, + data_connection_name, + location=None, + storage_account_resource_id=None, + event_hub_resource_id=None, + consumer_group=None, + table_name=None, + mapping_rule_name=None, + data_format=None): + parameters = {} + parameters['location'] = location + parameters['kind'] = 'EventGrid' + parameters['storage_account_resource_id'] = storage_account_resource_id + parameters['event_hub_resource_id'] = event_hub_resource_id + parameters['consumer_group'] = consumer_group + parameters['table_name'] = table_name + parameters['mapping_rule_name'] = mapping_rule_name + parameters['data_format'] = data_format + return client.begin_update(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + parameters=parameters) + + +def kusto_data_connection_event_hub_update(cmd, client, + resource_group_name, + cluster_name, + database_name, + data_connection_name, + location=None, + event_hub_resource_id=None, + consumer_group=None, + table_name=None, + mapping_rule_name=None, + data_format=None, + event_system_properties=None, + compression=None): + if isinstance(event_system_properties, str): + event_system_properties = json.loads(event_system_properties) + parameters = {} + parameters['location'] = location + parameters['kind'] = 'EventHub' + parameters['event_hub_resource_id'] = event_hub_resource_id + parameters['consumer_group'] = consumer_group + parameters['table_name'] = table_name + parameters['mapping_rule_name'] = mapping_rule_name + parameters['data_format'] = data_format + parameters['event_system_properties'] = event_system_properties + parameters['compression'] = compression + return client.begin_update(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + parameters=parameters) + + +def kusto_data_connection_iot_hub_update(cmd, client, + resource_group_name, + cluster_name, + database_name, + data_connection_name, + location=None, + iot_hub_resource_id=None, + consumer_group=None, + table_name=None, + mapping_rule_name=None, + data_format=None, + event_system_properties=None, + shared_access_policy_name=None): + if isinstance(event_system_properties, str): + event_system_properties = json.loads(event_system_properties) + parameters = {} + parameters['location'] = location + parameters['kind'] = 'IotHub' + parameters['iot_hub_resource_id'] = iot_hub_resource_id + parameters['consumer_group'] = consumer_group + parameters['table_name'] = table_name + parameters['mapping_rule_name'] = mapping_rule_name + parameters['data_format'] = data_format + parameters['event_system_properties'] = event_system_properties + parameters['shared_access_policy_name'] = shared_access_policy_name + return client.begin_update(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + parameters=parameters) + + +def kusto_data_connection_delete(cmd, client, + resource_group_name, + cluster_name, + database_name, + data_connection_name): + return client.begin_delete(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name) + + +def kusto_data_connection_event_grid_data_connection_validation(cmd, client, + resource_group_name, + cluster_name, + database_name, + data_connection_name=None, + location=None, + storage_account_resource_id=None, + event_hub_resource_id=None, + consumer_group=None, + table_name=None, + mapping_rule_name=None, + data_format=None): + properties = {} + properties['location'] = location + properties['kind'] = 'EventGrid' + properties['storage_account_resource_id'] = storage_account_resource_id + properties['event_hub_resource_id'] = event_hub_resource_id + properties['consumer_group'] = consumer_group + properties['table_name'] = table_name + properties['mapping_rule_name'] = mapping_rule_name + properties['data_format'] = data_format + return client.data_connection_validation(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + properties=properties) + + +def kusto_data_connection_event_hub_data_connection_validation(cmd, client, + resource_group_name, + cluster_name, + database_name, + data_connection_name=None, + location=None, + event_hub_resource_id=None, + consumer_group=None, + table_name=None, + mapping_rule_name=None, + data_format=None, + event_system_properties=None, + compression=None): + if isinstance(event_system_properties, str): + event_system_properties = json.loads(event_system_properties) + properties = {} + properties['location'] = location + properties['kind'] = 'EventHub' + properties['event_hub_resource_id'] = event_hub_resource_id + properties['consumer_group'] = consumer_group + properties['table_name'] = table_name + properties['mapping_rule_name'] = mapping_rule_name + properties['data_format'] = data_format + properties['event_system_properties'] = event_system_properties + properties['compression'] = compression + return client.data_connection_validation(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + properties=properties) + + +def kusto_data_connection_iot_hub_data_connection_validation(cmd, client, + resource_group_name, + cluster_name, + database_name, + data_connection_name=None, + location=None, + iot_hub_resource_id=None, + consumer_group=None, + table_name=None, + mapping_rule_name=None, + data_format=None, + event_system_properties=None, + shared_access_policy_name=None): + if isinstance(event_system_properties, str): + event_system_properties = json.loads(event_system_properties) + properties = {} + properties['location'] = location + properties['kind'] = 'IotHub' + properties['iot_hub_resource_id'] = iot_hub_resource_id + properties['consumer_group'] = consumer_group + properties['table_name'] = table_name + properties['mapping_rule_name'] = mapping_rule_name + properties['data_format'] = data_format + properties['event_system_properties'] = event_system_properties + properties['shared_access_policy_name'] = shared_access_policy_name + return client.data_connection_validation(resource_group_name=resource_group_name, + cluster_name=cluster_name, + database_name=database_name, + data_connection_name=data_connection_name, + properties=properties) diff --git a/src/kusto/azext_kusto/manual/__init__.py b/src/kusto/azext_kusto/manual/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/kusto/azext_kusto/manual/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/kusto/azext_kusto/tests/__init__.py b/src/kusto/azext_kusto/tests/__init__.py new file mode 100644 index 00000000000..fe1bd438b46 --- /dev/null +++ b/src/kusto/azext_kusto/tests/__init__.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +import inspect +import os + + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func) + module_path = __path__[0] + if not decorated_path.startswith(module_path): + raise Exception("Decorator can only be used in submodules!") + manual_path = os.path.join( + decorated_path[module_path.rfind(os.path.sep) + 1:]) + manual_file_path, manual_file_name = os.path.split(manual_path) + module_name, _ = os.path.splitext(manual_file_name) + manual_module = "..manual." + \ + ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) + return getattr(import_module(manual_module, package=__name__), origin_func.__name__) + + def get_func_to_call(): + func_to_call = func + try: + func_to_call = import_manual_function(func) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + print("running {}()...".format(func.__name__)) + return func_to_call(*args, **kwargs) + + if inspect.isclass(func): + return get_func_to_call() + else: + return wrapper diff --git a/src/kusto/azext_kusto/tests/latest/__init__.py b/src/kusto/azext_kusto/tests/latest/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/kusto/azext_kusto/tests/latest/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/kusto/azext_kusto/tests/latest/preparers.py b/src/kusto/azext_kusto/tests/latest/preparers.py new file mode 100644 index 00000000000..3d6672de64f --- /dev/null +++ b/src/kusto/azext_kusto/tests/latest/preparers.py @@ -0,0 +1,116 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +from datetime import datetime +from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer +from azure_devtools.scenario_tests import SingleValueReplacer +from azure.cli.testsdk.exceptions import CliTestError +from azure.cli.testsdk.reverse_dependency import get_dummy_cli + + +KEY_RESOURCE_GROUP = 'rg' +KEY_VIRTUAL_NETWORK = 'vnet' +KEY_VNET_SUBNET = 'subnet' + + +class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='virtual_network', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + dev_setting_name='AZURE_CLI_TEST_DEV_VIRTUAL_NETWORK_NAME', + random_name_length=24, key=KEY_VIRTUAL_NETWORK): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VirtualNetworkPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **kwargs): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + + tags = {'product': 'azurecli', 'cause': 'automation', + 'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')} + if 'ENV_JOB_NAME' in os.environ: + tags['job'] = os.environ['ENV_JOB_NAME'] + tags = ' '.join(['{}={}'.format(key, value) + for key, value in tags.items()]) + template = 'az network vnet create --resource-group {} --name {} --tag ' + tags + self.live_only_execute(self.cli_ctx, template.format( + self.resource_group_name, name)) + + self.test_class_instance.kwargs[self.key] = name + return {self.parameter_name: name} + + def remove_resource(self, name, **kwargs): + # delete vnet if test is being recorded and if the vnet is not a dev rg + if not self.dev_setting_name: + self.live_only_execute( + self.cli_ctx, 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) + + +class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='subnet', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + vnet_name=None, + vnet_key=KEY_VIRTUAL_NETWORK, + address_prefixes="11.0.0.0/24", + dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME', + random_name_length=24, key=KEY_VNET_SUBNET): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VnetSubnetPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.vnet_name = vnet_name + self.vnet_key = vnet_key + self.address_prefixes = address_prefixes + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **kwargs): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + if not self.vnet_name: + self.vnet_name = self.test_class_instance.kwargs.get(self.vnet_key) + if not self.vnet_name: + raise CliTestError("Error: No vnet configured!") + + self.test_class_instance.kwargs[self.key] = 'default' + return {self.parameter_name: name} + + def remove_resource(self, name, **kwargs): + pass diff --git a/src/kusto/azext_kusto/tests/latest/test_kusto_scenario.py b/src/kusto/azext_kusto/tests/latest/test_kusto_scenario.py new file mode 100644 index 00000000000..4de11ca8232 --- /dev/null +++ b/src/kusto/azext_kusto/tests/latest/test_kusto_scenario.py @@ -0,0 +1,540 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import os +import unittest + +from azure_devtools.scenario_tests import AllowLargeResponse +from azure.cli.testsdk import ScenarioTest +from .. import try_manual +from azure.cli.testsdk import ResourceGroupPreparer + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +@try_manual +def setup(test, rg): + pass + + +# EXAMPLE: KustoClustersCreateOrUpdate +@try_manual +def step_kustoclusterscreateorupdate(test, rg): + test.cmd('az kusto cluster create ' + '--cluster-name "{Clusters_3}" ' + '--identity-type "SystemAssigned" ' + '--location "westus" ' + '--enable-purge true ' + '--enable-streaming-ingest true ' + '--key-vault-properties key-name="keyName" key-vault-uri="https://dummy.keyvault.com" key-version="keyVers' + 'ion" ' + '--sku name="Standard_L8s" capacity=2 tier="Standard" ' + '--resource-group "{rg}"', + checks=[]) + test.cmd('az kusto cluster wait --created ' + '--cluster-name "{Clusters_3}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDatabasesCreateOrUpdate +@try_manual +def step_kustodatabasescreateorupdate(test, rg): + test.cmd('az kusto database create ' + '--cluster-name "{Clusters_3}" ' + '--database-name "KustoDatabase8" ' + '--read-write-database location="westus" soft-delete-period="P1D" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDataConnectionsCreateOrUpdate +@try_manual +def step_kustodataconnectionscreateorupdate(test, rg): + test.cmd('az kusto data-connection event-hub create ' + '--cluster-name "{Clusters_3}" ' + '--data-connection-name "{DataConnections8}" ' + '--database-name "KustoDatabase8" ' + '--location "westus" ' + '--consumer-group "testConsumerGroup1" ' + '--event-hub-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.EventHu' + 'b/namespaces/eventhubTestns1/eventhubs/eventhubTest1" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: AttachedDatabaseConfigurationsCreateOrUpdate +@try_manual +def step_attacheddatabaseconfigurationscreateorupdate(test, rg): + test.cmd('az kusto attached-database-configuration create ' + '--attached-database-configuration-name "{attachedDatabaseConfigurations1}" ' + '--cluster-name "{Clusters_3}" ' + '--location "westus" ' + '--cluster-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Kusto/Clu' + 'sters/{Clusters_2}" ' + '--database-name "db1" ' + '--default-principals-modification-kind "Union" ' + '--resource-group "{rg}"', + checks=[]) + test.cmd('az kusto attached-database-configuration wait --created ' + '--attached-database-configuration-name "{attachedDatabaseConfigurations1}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: AttachedDatabaseConfigurationsGet +@try_manual +def step_attacheddatabaseconfigurationsget(test, rg): + test.cmd('az kusto attached-database-configuration show ' + '--attached-database-configuration-name "{attachedDatabaseConfigurations1}" ' + '--cluster-name "{Clusters_3}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDataConnectionsGet +@try_manual +def step_kustodataconnectionsget(test, rg): + test.cmd('az kusto data-connection show ' + '--cluster-name "{Clusters_3}" ' + '--data-connection-name "{DataConnections8}" ' + '--database-name "KustoDatabase8" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDatabasesListByCluster +@try_manual +def step_kustodatabaseslistbycluster(test, rg): + test.cmd('az kusto database list ' + '--cluster-name "{Clusters_3}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoAttachedDatabaseConfigurationsListByCluster +@try_manual +def step_kustoattacheddatabaseconfigurationslistbycluster(test, rg): + test.cmd('az kusto attached-database-configuration list ' + '--cluster-name "{Clusters_3}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDatabasesGet +@try_manual +def step_kustodatabasesget(test, rg): + test.cmd('az kusto database show ' + '--cluster-name "{Clusters_3}" ' + '--database-name "KustoDatabase8" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDatabasesListByCluster +@try_manual +def step_kustodatabaseslistbycluster(test, rg): + test.cmd('az kusto database list ' + '--cluster-name "{Clusters_3}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClustersListResourceSkus +@try_manual +def step_kustoclusterslistresourceskus(test, rg): + test.cmd('az kusto cluster list-sku ' + '--cluster-name "{Clusters_3}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClustersGet +@try_manual +def step_kustoclustersget(test, rg): + test.cmd('az kusto cluster show ' + '--cluster-name "{Clusters_3}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClustersListByResourceGroup +@try_manual +def step_kustoclusterslistbyresourcegroup(test, rg): + test.cmd('az kusto cluster list ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClustersList +@try_manual +def step_kustoclusterslist(test, rg): + test.cmd('az kusto cluster list', + checks=[]) + + +# EXAMPLE: KustoClustersListSkus +@try_manual +def step_kustoclusterslistskus(test, rg): + test.cmd('az kusto cluster list-sku', + checks=[]) + + +# EXAMPLE: KustoOperationsList +@try_manual +def step_kustooperationslist(test, rg): + # EXAMPLE NOT FOUND! + pass + + +# EXAMPLE: KustoDataConnectionsUpdate +@try_manual +def step_kustodataconnectionsupdate(test, rg): + test.cmd('az kusto data-connection event-hub update ' + '--cluster-name "{Clusters_3}" ' + '--data-connection-name "{DataConnections8}" ' + '--database-name "KustoDatabase8" ' + '--location "westus" ' + '--consumer-group "testConsumerGroup1" ' + '--event-hub-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.EventHu' + 'b/namespaces/eventhubTestns1/eventhubs/eventhubTest1" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDataConnectionValidation +@try_manual +def step_kustodataconnectionvalidation(test, rg): + test.cmd('az kusto data-connection event-hub data-connection-validation ' + '--cluster-name "{Clusters_3}" ' + '--database-name "KustoDatabase8" ' + '--data-connection-name "{DataConnections8}" ' + '--consumer-group "testConsumerGroup1" ' + '--event-hub-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.EventHu' + 'b/namespaces/eventhubTestns1/eventhubs/eventhubTest1" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDataConnectionsCheckNameAvailability +@try_manual +def step_kustodataconnectionschecknameavailability(test, rg): + # EXAMPLE NOT FOUND! + pass + + +# EXAMPLE: KustoDatabaseRemovePrincipals +@try_manual +def step_kustodatabaseremoveprincipals(test, rg): + test.cmd('az kusto database remove-principal ' + '--cluster-name "{Clusters_3}" ' + '--database-name "databaseName1" ' + '--value name="Some User" type="User" app-id="" email="user@microsoft.com" fqn="aaduser role="Admin" ' + '--value name="Kusto" type="Group" app-id="" email="kusto@microsoft.com" fqn="aadgroup role="Viewer" ' + '--value name="SomeApp" type="App" app-id="some_guid_app_id" email="" fqn="aadapp role="Admin" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDatabaseListPrincipals +@try_manual +def step_kustodatabaselistprincipals(test, rg): + test.cmd('az kusto database list-principal ' + '--cluster-name "{Clusters_3}" ' + '--database-name "databaseName1" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDatabaseAddPrincipals +@try_manual +def step_kustodatabaseaddprincipals(test, rg): + test.cmd('az kusto database add-principal ' + '--cluster-name "{Clusters_3}" ' + '--database-name "databaseName1" ' + '--value name="Some User" type="User" app-id="" email="user@microsoft.com" fqn="aaduser role="Admin" ' + '--value name="Kusto" type="Group" app-id="" email="kusto@microsoft.com" fqn="aadgroup role="Viewer" ' + '--value name="SomeApp" type="App" app-id="some_guid_app_id" email="" fqn="aadapp role="Admin" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDatabasesUpdate +@try_manual +def step_kustodatabasesupdate(test, rg): + test.cmd('az kusto database update ' + '--cluster-name "{Clusters_3}" ' + '--database-name "KustoDatabase8" ' + '--read-write-database soft-delete-period="P1D" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClusterDetachFollowerDatabases +@try_manual +def step_kustoclusterdetachfollowerdatabases(test, rg): + test.cmd('az kusto cluster detach-follower-database ' + '--cluster-name "{Clusters_3}" ' + '--attached-database-configuration-name "{AttachedDatabaseConfigurations_2}" ' + '--cluster-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Kusto/clu' + 'sters/{leader4}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDatabaseCheckNameAvailability +@try_manual +def step_kustodatabasechecknameavailability(test, rg): + # EXAMPLE NOT FOUND! + pass + + +# EXAMPLE: KustoClusterListFollowerDatabases +@try_manual +def step_kustoclusterlistfollowerdatabases(test, rg): + test.cmd('az kusto cluster list-follower-database ' + '--cluster-name "{Clusters_3}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClustersStart +@try_manual +def step_kustoclustersstart(test, rg): + test.cmd('az kusto cluster start ' + '--cluster-name "{Clusters_3}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClustersStop +@try_manual +def step_kustoclustersstop(test, rg): + test.cmd('az kusto cluster stop ' + '--cluster-name "{Clusters_3}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClustersUpdate +@try_manual +def step_kustoclustersupdate(test, rg): + test.cmd('az kusto cluster update ' + '--cluster-name "{Clusters_3}" ' + '--identity-type "SystemAssigned" ' + '--location "westus" ' + '--enable-purge true ' + '--enable-streaming-ingest true ' + '--key-vault-properties key-name="keyName" key-vault-uri="https://dummy.keyvault.com" key-version="keyVers' + 'ion" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClustersCheckNameAvailability +@try_manual +def step_kustoclusterschecknameavailability(test, rg): + # EXAMPLE NOT FOUND! + pass + + +# EXAMPLE: AttachedDatabaseConfigurationsDelete +@try_manual +def step_attacheddatabaseconfigurationsdelete(test, rg): + test.cmd('az kusto attached-database-configuration delete ' + '--attached-database-configuration-name "{attachedDatabaseConfigurations1}" ' + '--cluster-name "{Clusters_3}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDataConnectionsDelete +@try_manual +def step_kustodataconnectionsdelete(test, rg): + test.cmd('az kusto data-connection delete ' + '--cluster-name "{Clusters_3}" ' + '--data-connection-name "{DataConnections_2}" ' + '--database-name "KustoDatabase8" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDatabasesDelete +@try_manual +def step_kustodatabasesdelete(test, rg): + test.cmd('az kusto database delete ' + '--cluster-name "{Clusters_3}" ' + '--database-name "KustoDatabase8" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClustersDelete +@try_manual +def step_kustoclustersdelete(test, rg): + test.cmd('az kusto cluster delete ' + '--cluster-name "{Clusters_3}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDatabasePrincipalAssignmentsGet +@try_manual +def step_kustodatabaseprincipalassignmentsget(test, rg): + test.cmd('az kusto database-principal-assignment show ' + '--cluster-name "{Clusters_4}" ' + '--database-name "Kustodatabase8" ' + '--principal-assignment-name "kustoprincipal1" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDatabasePrincipalAssignmentsCreateOrUpdate +@try_manual +def step_kustodatabaseprincipalassignmentscreateorupdate(test, rg): + test.cmd('az kusto database-principal-assignment create ' + '--cluster-name "{Clusters_4}" ' + '--database-name "Kustodatabase8" ' + '--principal-id "87654321-1234-1234-1234-123456789123" ' + '--principal-type "App" ' + '--role "Admin" ' + '--tenant-id "12345678-1234-1234-1234-123456789123" ' + '--principal-assignment-name "kustoprincipal1" ' + '--resource-group "{rg}"', + checks=[]) + test.cmd('az kusto database-principal-assignment wait --created ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoDatabasePrincipalAssignmentsDelete +@try_manual +def step_kustodatabaseprincipalassignmentsdelete(test, rg): + test.cmd('az kusto database-principal-assignment delete ' + '--cluster-name "{Clusters_4}" ' + '--database-name "Kustodatabase8" ' + '--principal-assignment-name "kustoprincipal1" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClusterPrincipalAssignmentsGet +@try_manual +def step_kustoclusterprincipalassignmentsget(test, rg): + test.cmd('az kusto cluster-principal-assignment show ' + '--cluster-name "{Clusters_4}" ' + '--principal-assignment-name "kustoprincipal1" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClusterPrincipalAssignmentsCreateOrUpdate +@try_manual +def step_kustoclusterprincipalassignmentscreateorupdate(test, rg): + test.cmd('az kusto cluster-principal-assignment create ' + '--cluster-name "{Clusters_4}" ' + '--principal-id "87654321-1234-1234-1234-123456789123" ' + '--principal-type "App" ' + '--role "Admin" ' + '--tenant-id "12345678-1234-1234-1234-123456789123" ' + '--principal-assignment-name "kustoprincipal1" ' + '--resource-group "{rg}"', + checks=[]) + test.cmd('az kusto cluster-principal-assignment wait --created ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: KustoClusterPrincipalAssignmentsDelete +@try_manual +def step_kustoclusterprincipalassignmentsdelete(test, rg): + test.cmd('az kusto cluster-principal-assignment delete ' + '--cluster-name "{Clusters_4}" ' + '--principal-assignment-name "kustoprincipal1" ' + '--resource-group "{rg}"', + checks=[]) + + +@try_manual +def cleanup(test, rg): + pass + + +@try_manual +def call_scenario(test, rg): + setup(test, rg) + step_kustoclusterscreateorupdate(test, rg) + step_kustodatabasescreateorupdate(test, rg) + step_kustodataconnectionscreateorupdate(test, rg) + step_attacheddatabaseconfigurationscreateorupdate(test, rg) + step_attacheddatabaseconfigurationsget(test, rg) + step_kustodataconnectionsget(test, rg) + step_kustodatabaseslistbycluster(test, rg) + step_kustoattacheddatabaseconfigurationslistbycluster(test, rg) + step_kustodatabasesget(test, rg) + step_kustodatabaseslistbycluster(test, rg) + step_kustoclusterslistresourceskus(test, rg) + step_kustoclustersget(test, rg) + step_kustoclusterslistbyresourcegroup(test, rg) + step_kustoclusterslist(test, rg) + step_kustoclusterslistskus(test, rg) + step_kustooperationslist(test, rg) + step_kustodataconnectionsupdate(test, rg) + step_kustodataconnectionvalidation(test, rg) + step_kustodataconnectionschecknameavailability(test, rg) + step_kustodatabaseremoveprincipals(test, rg) + step_kustodatabaselistprincipals(test, rg) + step_kustodatabaseaddprincipals(test, rg) + step_kustodatabasesupdate(test, rg) + step_kustoclusterdetachfollowerdatabases(test, rg) + step_kustodatabasechecknameavailability(test, rg) + step_kustoclusterlistfollowerdatabases(test, rg) + step_kustoclustersstart(test, rg) + step_kustoclustersstop(test, rg) + step_kustoclustersupdate(test, rg) + step_kustoclusterschecknameavailability(test, rg) + step_attacheddatabaseconfigurationsdelete(test, rg) + step_kustodataconnectionsdelete(test, rg) + step_kustodatabasesdelete(test, rg) + step_kustoclustersdelete(test, rg) + step_kustodatabaseprincipalassignmentsget(test, rg) + step_kustodatabaseprincipalassignmentscreateorupdate(test, rg) + step_kustodatabaseprincipalassignmentsdelete(test, rg) + step_kustoclusterprincipalassignmentsget(test, rg) + step_kustoclusterprincipalassignmentscreateorupdate(test, rg) + step_kustoclusterprincipalassignmentsdelete(test, rg) + cleanup(test, rg) + + +@try_manual +class KustoManagementClientScenarioTest(ScenarioTest): + + @ResourceGroupPreparer(name_prefix='clitestkusto_kustorptest'[:7], key='rg', parameter_name='rg') + def test_kusto(self, rg): + + self.kwargs.update({ + 'subscription_id': self.get_subscription_id() + }) + + self.kwargs.update({ + 'Clusters_5': 'Clusters_5', + 'AttachedDatabaseConfigurations_3': 'AttachedDatabaseConfigurations_3', + 'leader4': 'leader4', + 'Clusters_2': 'Clusters_2', + 'Clusters_3': 'Clusters_3', + 'Clusters_4': 'Clusters_4', + 'attachedDatabaseConfigurations1': 'attachedDatabaseConfigurations1', + 'AttachedDatabaseConfigurations_2': 'AttachedDatabaseConfigurations_2', + 'DataConnections8': 'DataConnections8', + 'DataConnections_2': 'DataConnections_2', + }) + + call_scenario(self, rg) diff --git a/src/kusto/azext_kusto/vendored_sdks/__init__.py b/src/kusto/azext_kusto/vendored_sdks/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/__init__.py b/src/kusto/azext_kusto/vendored_sdks/kusto/__init__.py new file mode 100644 index 00000000000..b4ef76736c1 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/__init__.py @@ -0,0 +1,19 @@ +# 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 ._kusto_management_client import KustoManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['KustoManagementClient'] + +try: + from .patch import patch_sdk + patch_sdk() +except ImportError: + pass diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/_configuration.py b/src/kusto/azext_kusto/vendored_sdks/kusto/_configuration.py new file mode 100644 index 00000000000..2e2c7a15d75 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/_configuration.py @@ -0,0 +1,69 @@ +# 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 + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +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.TokenCredential + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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-02-15" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-kusto/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> 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.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/_kusto_management_client.py b/src/kusto/azext_kusto/vendored_sdks/kusto/_kusto_management_client.py new file mode 100644 index 00000000000..ec0cbd5ae63 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/_kusto_management_client.py @@ -0,0 +1,96 @@ +# 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 + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + +from ._configuration import KustoManagementClientConfiguration +from .operations import ClusterOperations +from .operations import ClusterPrincipalAssignmentOperations +from .operations import DatabaseOperations +from .operations import DatabasePrincipalAssignmentOperations +from .operations import AttachedDatabaseConfigurationOperations +from .operations import DataConnectionOperations +from .operations 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: azure.mgmt.kusto.operations.ClusterOperations + :ivar cluster_principal_assignment: ClusterPrincipalAssignmentOperations operations + :vartype cluster_principal_assignment: azure.mgmt.kusto.operations.ClusterPrincipalAssignmentOperations + :ivar database: DatabaseOperations operations + :vartype database: azure.mgmt.kusto.operations.DatabaseOperations + :ivar database_principal_assignment: DatabasePrincipalAssignmentOperations operations + :vartype database_principal_assignment: azure.mgmt.kusto.operations.DatabasePrincipalAssignmentOperations + :ivar attached_database_configuration: AttachedDatabaseConfigurationOperations operations + :vartype attached_database_configuration: azure.mgmt.kusto.operations.AttachedDatabaseConfigurationOperations + :ivar data_connection: DataConnectionOperations operations + :vartype data_connection: azure.mgmt.kusto.operations.DataConnectionOperations + :ivar operation: OperationOperations operations + :vartype operation: azure.mgmt.kusto.operations.OperationOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = KustoManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._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) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> KustoManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/_version.py b/src/kusto/azext_kusto/vendored_sdks/kusto/_version.py new file mode 100644 index 00000000000..eae7c95b6fb --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/_version.py @@ -0,0 +1,9 @@ +# 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/__init__.py b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/__init__.py new file mode 100644 index 00000000000..1fb64aee341 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._kusto_management_client_async import KustoManagementClient +__all__ = ['KustoManagementClient'] 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 new file mode 100644 index 00000000000..e8322c1d173 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/_configuration_async.py @@ -0,0 +1,65 @@ +# 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 .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +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-02-15" + self.credential_scopes = ['https://management.azure.com/.default'] + kwargs.setdefault('sdk_moniker', 'mgmt-kusto/{}'.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.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 new file mode 100644 index 00000000000..15a0a57d813 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/_kusto_management_client_async.py @@ -0,0 +1,88 @@ +# 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 + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +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: azure.mgmt.kusto.aio.operations_async.ClusterOperations + :ivar cluster_principal_assignment: ClusterPrincipalAssignmentOperations operations + :vartype cluster_principal_assignment: azure.mgmt.kusto.aio.operations_async.ClusterPrincipalAssignmentOperations + :ivar database: DatabaseOperations operations + :vartype database: azure.mgmt.kusto.aio.operations_async.DatabaseOperations + :ivar database_principal_assignment: DatabasePrincipalAssignmentOperations operations + :vartype database_principal_assignment: azure.mgmt.kusto.aio.operations_async.DatabasePrincipalAssignmentOperations + :ivar attached_database_configuration: AttachedDatabaseConfigurationOperations operations + :vartype attached_database_configuration: azure.mgmt.kusto.aio.operations_async.AttachedDatabaseConfigurationOperations + :ivar data_connection: DataConnectionOperations operations + :vartype data_connection: azure.mgmt.kusto.aio.operations_async.DataConnectionOperations + :ivar operation: OperationOperations operations + :vartype operation: azure.mgmt.kusto.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 + """ + + 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 new file mode 100644 index 00000000000..e173d033126 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/__init__.py @@ -0,0 +1,25 @@ +# 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 new file mode 100644 index 00000000000..cb1fd41a1b2 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_attached_database_configuration_operations_async.py @@ -0,0 +1,398 @@ +# 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, 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 AsyncNoPolling, AsyncPollingMethod, async_poller +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: ~azure.mgmt.kusto.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 + ) -> "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: AttachedDatabaseConfigurationListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.AttachedDatabaseConfigurationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AttachedDatabaseConfigurationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_cluster.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + 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: ~azure.mgmt.kusto.models.AttachedDatabaseConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AttachedDatabaseConfiguration"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self.get.metadata['url'] + 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' + + # Construct and send request + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _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-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def 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 + ) -> "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 ~azure.mgmt.kusto.models.DefaultPrincipalsModificationKind + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns AttachedDatabaseConfiguration + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._delete_initial.metadata['url'] + 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] + + # Construct and send request + 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}'} + + async def delete( + self, + resource_group_name: str, + cluster_name: str, + attached_database_configuration_name: str, + **kwargs + ) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/attachedDatabaseConfigurations/{attachedDatabaseConfigurationName}'} 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 new file mode 100644 index 00000000000..4df01ed2005 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_cluster_operations_async.py @@ -0,0 +1,1561 @@ +# 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, 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 AsyncNoPolling, AsyncPollingMethod, async_poller +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: ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.Cluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self.get.metadata['url'] + 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' + + # Construct and send request + 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}'} + + 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["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, + value: Optional[List["LanguageExtension"]] = None, + type: Optional[Union[str, "models.IdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + **kwargs + ) -> "models.Cluster": + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _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, value=value, type_identity_type=type, user_assigned_identities=user_assigned_identities) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def 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["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, + value: Optional[List["LanguageExtension"]] = None, + type: Optional[Union[str, "models.IdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + **kwargs + ) -> "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: ~azure.mgmt.kusto.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[~azure.mgmt.kusto.models.TrustedExternalTenant] + :param optimized_autoscale: Optimized auto scale definition. + :type optimized_autoscale: ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.VirtualNetworkConfiguration + :param key_vault_properties: KeyVault properties for the cluster encryption. + :type key_vault_properties: ~azure.mgmt.kusto.models.KeyVaultProperties + :param enable_purge: A boolean value that indicates if the purge operations are enabled. + :type enable_purge: bool + :param value: The list of language extensions. + :type value: list[~azure.mgmt.kusto.models.LanguageExtension] + :param type: The identity type. + :type type: str or ~azure.mgmt.kusto.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, ~azure.mgmt.kusto.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns Cluster + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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, + value=value, + type=type, + user_assigned_identities=user_assigned_identities, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} + + 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["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, + value: Optional[List["LanguageExtension"]] = None, + type: Optional[Union[str, "models.IdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + **kwargs + ) -> "models.Cluster": + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _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, value=value, type_identity_type=type, user_assigned_identities=user_assigned_identities) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def 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["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, + value: Optional[List["LanguageExtension"]] = None, + type: Optional[Union[str, "models.IdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + **kwargs + ) -> "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: ~azure.mgmt.kusto.models.AzureSku + :param trusted_external_tenants: The cluster's external tenants. + :type trusted_external_tenants: list[~azure.mgmt.kusto.models.TrustedExternalTenant] + :param optimized_autoscale: Optimized auto scale definition. + :type optimized_autoscale: ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.VirtualNetworkConfiguration + :param key_vault_properties: KeyVault properties for the cluster encryption. + :type key_vault_properties: ~azure.mgmt.kusto.models.KeyVaultProperties + :param enable_purge: A boolean value that indicates if the purge operations are enabled. + :type enable_purge: bool + :param value: The list of language extensions. + :type value: list[~azure.mgmt.kusto.models.LanguageExtension] + :param type: The identity type. + :type type: str or ~azure.mgmt.kusto.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, ~azure.mgmt.kusto.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns Cluster + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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, + value=value, + type=type, + user_assigned_identities=user_assigned_identities, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._delete_initial.metadata['url'] + 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] + + # Construct and send request + 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}'} + + async def delete( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}'} + + async def _stop_initial( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._stop_initial.metadata['url'] + 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] + + # Construct and send request + 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'} + + async def stop( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._stop_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + stop.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/stop'} + + async def _start_initial( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._start_initial.metadata['url'] + 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] + + # Construct and send request + 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'} + + async def start( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + raw_result = await self._start_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/start'} + + def list_follower_database( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> "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: FollowerDatabaseListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.FollowerDatabaseListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FollowerDatabaseListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_follower_database.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + request = self._client.post(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'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _follower_database_to_remove = models.FollowerDatabaseDefinition(cluster_resource_id=cluster_resource_id, attached_database_configuration_name=attached_database_configuration_name) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._detach_follower_database_initial.metadata['url'] + 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') + + # Construct and send request + 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'} + + async def detach_follower_database( + self, + resource_group_name: str, + cluster_name: str, + cluster_resource_id: str, + attached_database_configuration_name: str, + **kwargs + ) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + detach_follower_database.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/detachFollowerDatabases'} + + async def _diagnose_virtual_network_initial( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> "models.DiagnoseVirtualNetworkResult": + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnoseVirtualNetworkResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._diagnose_virtual_network_initial.metadata['url'] + 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' + + # Construct and send request + 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'} + + async def diagnose_virtual_network( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> "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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns DiagnoseVirtualNetworkResult + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DiagnoseVirtualNetworkResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + 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 + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + diagnose_virtual_network.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/diagnoseVirtualNetwork'} + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> "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: ClusterListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.ClusterListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + def list( + self, + **kwargs + ) -> "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: ClusterListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.ClusterListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + def list_sku( + self, + **kwargs + ) -> "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: SkuDescriptionList or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.SkuDescriptionList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuDescriptionList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sku.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + 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 ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _cluster_name = models.ClusterCheckNameRequest(name=name, type=type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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' + + # Construct and send request + 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'} + + def list_sku_by_resource( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> "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: ListResourceSkusResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.ListResourceSkusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ListResourceSkusResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sku_by_resource.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + def list_language_extension( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> "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: LanguageExtensionsList or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.LanguageExtensionsList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LanguageExtensionsList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_language_extension.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + request = self._client.post(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'} + + async def _add_language_extension_initial( + self, + resource_group_name: str, + cluster_name: str, + value: Optional[List["LanguageExtension"]] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _language_extensions_to_add = models.LanguageExtensionsList(value=value) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._add_language_extension_initial.metadata['url'] + 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') + + # Construct and send request + 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'} + + async def add_language_extension( + self, + resource_group_name: str, + cluster_name: str, + value: Optional[List["LanguageExtension"]] = None, + **kwargs + ) -> 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[~azure.mgmt.kusto.models.LanguageExtension] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + add_language_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/addLanguageExtensions'} + + async def _remove_language_extension_initial( + self, + resource_group_name: str, + cluster_name: str, + value: Optional[List["LanguageExtension"]] = None, + **kwargs + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _language_extensions_to_remove = models.LanguageExtensionsList(value=value) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._remove_language_extension_initial.metadata['url'] + 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') + + # Construct and send request + 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'} + + async def remove_language_extension( + self, + resource_group_name: str, + cluster_name: str, + value: Optional[List["LanguageExtension"]] = None, + **kwargs + ) -> 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[~azure.mgmt.kusto.models.LanguageExtension] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + remove_language_extension.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/removeLanguageExtensions'} 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 new file mode 100644 index 00000000000..7a71deffb4f --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_cluster_principal_assignment_operations_async.py @@ -0,0 +1,463 @@ +# 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, 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 AsyncNoPolling, AsyncPollingMethod, async_poller +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: ~azure.mgmt.kusto.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 ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _principal_assignment_name = models.ClusterPrincipalAssignmentCheckNameRequest(name=name, type=type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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' + + # Construct and send request + 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'} + + 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: ~azure.mgmt.kusto.models.ClusterPrincipalAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterPrincipalAssignment"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self.get.metadata['url'] + 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' + + # Construct and send request + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.ClusterPrincipalAssignment(principal_id=principal_id, role=role, tenant_id=tenant_id, principal_type=principal_type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def 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 + ) -> "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 ~azure.mgmt.kusto.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 ~azure.mgmt.kusto.models.PrincipalType + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns ClusterPrincipalAssignment + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._delete_initial.metadata['url'] + 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] + + # Construct and send request + 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}'} + + async def delete( + self, + resource_group_name: str, + cluster_name: str, + principal_assignment_name: str, + **kwargs + ) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/principalAssignments/{principalAssignmentName}'} + + def list( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> "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: ClusterPrincipalAssignmentListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.ClusterPrincipalAssignmentListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterPrincipalAssignmentListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} 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 new file mode 100644 index 00000000000..6b9ddbd68f6 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_data_connection_operations_async.py @@ -0,0 +1,667 @@ +# 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, 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 AsyncNoPolling, AsyncPollingMethod, async_poller +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: ~azure.mgmt.kusto.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 + ) -> "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: DataConnectionListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.DataConnectionListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnectionListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_database.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + async def 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 + ) -> "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: ~azure.mgmt.kusto.models.DataConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnectionValidationListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.DataConnectionValidationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnectionValidationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.DataConnectionValidation(data_connection_name=data_connection_name, properties=properties) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.data_connection_validation.metadata['url'] + 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' + + # Construct and send request + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataConnectionValidationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + data_connection_validation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnectionValidation'} + + 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 ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _data_connection_name = models.DataConnectionCheckNameRequest(name=name, type=type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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' + + # Construct and send request + 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'} + + 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: ~azure.mgmt.kusto.models.DataConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self.get.metadata['url'] + 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' + + # Construct and send request + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def create_or_update( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + parameters: "models.DataConnection", + **kwargs + ) -> "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: ~azure.mgmt.kusto.models.DataConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns DataConnection + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DataConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def update( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + parameters: "models.DataConnection", + **kwargs + ) -> "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: ~azure.mgmt.kusto.models.DataConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns DataConnection + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DataConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._delete_initial.metadata['url'] + 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] + + # Construct and send request + 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}'} + + async def delete( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + data_connection_name: str, + **kwargs + ) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnections/{dataConnectionName}'} 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 new file mode 100644 index 00000000000..95d28aefc80 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_database_operations_async.py @@ -0,0 +1,778 @@ +# 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, 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 AsyncNoPolling, AsyncPollingMethod, async_poller +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: ~azure.mgmt.kusto.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 ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _resource_name = models.CheckNameRequest(name=name, type=type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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' + + # Construct and send request + 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'} + + def list_by_cluster( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> "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: DatabaseListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.DatabaseListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_cluster.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + 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: ~azure.mgmt.kusto.models.Database + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self.get.metadata['url'] + 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' + + # Construct and send request + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def create_or_update( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "models.Database", + **kwargs + ) -> "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: ~azure.mgmt.kusto.models.Database + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns Database + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def update( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + parameters: "models.Database", + **kwargs + ) -> "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: ~azure.mgmt.kusto.models.Database + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns Database + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._delete_initial.metadata['url'] + 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] + + # Construct and send request + 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}'} + + async def delete( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs + ) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}'} + + def list_principal( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs + ) -> "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: DatabasePrincipalListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.DatabasePrincipalListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_principal.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + request = self._client.post(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'} + + async def add_principal( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + value: Optional[List["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[~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.DatabasePrincipalListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _database_principals_to_add = models.DatabasePrincipalListRequest(value=value) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.add_principal.metadata['url'] + 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' + + # Construct and send request + 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'} + + async def remove_principal( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + value: Optional[List["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[~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.DatabasePrincipalListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _database_principals_to_remove = models.DatabasePrincipalListRequest(value=value) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.remove_principal.metadata['url'] + 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' + + # Construct and send request + 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'} 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 new file mode 100644 index 00000000000..bf6348e6a3d --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_database_principal_assignment_operations_async.py @@ -0,0 +1,487 @@ +# 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, 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 AsyncNoPolling, AsyncPollingMethod, async_poller +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: ~azure.mgmt.kusto.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 ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _principal_assignment_name = models.DatabasePrincipalAssignmentCheckNameRequest(name=name, type=type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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' + + # Construct and send request + 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'} + + 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: ~azure.mgmt.kusto.models.DatabasePrincipalAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalAssignment"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self.get.metadata['url'] + 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' + + # Construct and send request + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.DatabasePrincipalAssignment(principal_id=principal_id, role=role, tenant_id=tenant_id, principal_type=principal_type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def 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 + ) -> "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 ~azure.mgmt.kusto.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 ~azure.mgmt.kusto.models.PrincipalType + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns DatabasePrincipalAssignment + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._delete_initial.metadata['url'] + 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] + + # Construct and send request + 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}'} + + async def delete( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + principal_assignment_name: str, + **kwargs + ) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + return await async_poller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/principalAssignments/{principalAssignmentName}'} + + def list( + self, + resource_group_name: str, + cluster_name: str, + database_name: str, + **kwargs + ) -> "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: DatabasePrincipalAssignmentListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.DatabasePrincipalAssignmentListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalAssignmentListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} 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 new file mode 100644 index 00000000000..bc31ebca19b --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations_async/_operation_operations_async.py @@ -0,0 +1,100 @@ +# 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, 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: ~azure.mgmt.kusto.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 + ) -> "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: OperationListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # 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' + + # Construct and send request + 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'} diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/models/__init__.py b/src/kusto/azext_kusto/vendored_sdks/kusto/models/__init__.py new file mode 100644 index 00000000000..f8bfbe3e4df --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/models/__init__.py @@ -0,0 +1,221 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AttachedDatabaseConfiguration + from ._models_py3 import AttachedDatabaseConfigurationListResult + from ._models_py3 import AzureCapacity + from ._models_py3 import AzureResourceSku + from ._models_py3 import AzureSku + from ._models_py3 import CheckNameRequest + from ._models_py3 import CheckNameResult + from ._models_py3 import CloudErrorBody + from ._models_py3 import Cluster + from ._models_py3 import ClusterCheckNameRequest + from ._models_py3 import ClusterListResult + from ._models_py3 import ClusterPrincipalAssignment + from ._models_py3 import ClusterPrincipalAssignmentCheckNameRequest + from ._models_py3 import ClusterPrincipalAssignmentListResult + from ._models_py3 import ClusterUpdate + from ._models_py3 import ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties + from ._models_py3 import DataConnection + from ._models_py3 import DataConnectionCheckNameRequest + from ._models_py3 import DataConnectionListResult + from ._models_py3 import DataConnectionValidation + from ._models_py3 import DataConnectionValidationListResult + from ._models_py3 import DataConnectionValidationResult + from ._models_py3 import Database + from ._models_py3 import DatabaseListResult + from ._models_py3 import DatabasePrincipal + from ._models_py3 import DatabasePrincipalAssignment + from ._models_py3 import DatabasePrincipalAssignmentCheckNameRequest + from ._models_py3 import DatabasePrincipalAssignmentListResult + from ._models_py3 import DatabasePrincipalListRequest + from ._models_py3 import DatabasePrincipalListResult + from ._models_py3 import DatabaseStatistics + from ._models_py3 import DiagnoseVirtualNetworkResult + from ._models_py3 import EventGridDataConnection + from ._models_py3 import EventHubDataConnection + from ._models_py3 import FollowerDatabaseDefinition + from ._models_py3 import FollowerDatabaseListResult + from ._models_py3 import IotHubDataConnection + from ._models_py3 import KeyVaultProperties + from ._models_py3 import LanguageExtension + from ._models_py3 import LanguageExtensionsList + from ._models_py3 import ListResourceSkusResult + from ._models_py3 import Operation + from ._models_py3 import OperationDisplay + from ._models_py3 import OperationListResult + from ._models_py3 import OptimizedAutoscale + from ._models_py3 import ProxyResource + from ._models_py3 import ReadOnlyFollowingDatabase + from ._models_py3 import ReadWriteDatabase + from ._models_py3 import Resource + from ._models_py3 import SkuDescription + from ._models_py3 import SkuDescriptionList + from ._models_py3 import SkuLocationInfoItem + from ._models_py3 import TrackedResource + from ._models_py3 import TrustedExternalTenant + from ._models_py3 import VirtualNetworkConfiguration +except (SyntaxError, ImportError): + from ._models import AttachedDatabaseConfiguration # type: ignore + from ._models import AttachedDatabaseConfigurationListResult # type: ignore + from ._models import AzureCapacity # type: ignore + from ._models import AzureResourceSku # type: ignore + from ._models import AzureSku # type: ignore + from ._models import CheckNameRequest # type: ignore + from ._models import CheckNameResult # type: ignore + from ._models import CloudErrorBody # type: ignore + from ._models import Cluster # type: ignore + from ._models import ClusterCheckNameRequest # type: ignore + from ._models import ClusterListResult # type: ignore + from ._models import ClusterPrincipalAssignment # type: ignore + from ._models import ClusterPrincipalAssignmentCheckNameRequest # type: ignore + from ._models import ClusterPrincipalAssignmentListResult # type: ignore + from ._models import ClusterUpdate # type: ignore + from ._models import ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties # type: ignore + from ._models import DataConnection # type: ignore + from ._models import DataConnectionCheckNameRequest # type: ignore + from ._models import DataConnectionListResult # type: ignore + from ._models import DataConnectionValidation # type: ignore + from ._models import DataConnectionValidationListResult # type: ignore + from ._models import DataConnectionValidationResult # type: ignore + from ._models import Database # type: ignore + from ._models import DatabaseListResult # type: ignore + from ._models import DatabasePrincipal # type: ignore + from ._models import DatabasePrincipalAssignment # type: ignore + from ._models import DatabasePrincipalAssignmentCheckNameRequest # type: ignore + from ._models import DatabasePrincipalAssignmentListResult # type: ignore + from ._models import DatabasePrincipalListRequest # type: ignore + from ._models import DatabasePrincipalListResult # type: ignore + from ._models import DatabaseStatistics # type: ignore + from ._models import DiagnoseVirtualNetworkResult # type: ignore + from ._models import EventGridDataConnection # type: ignore + from ._models import EventHubDataConnection # type: ignore + from ._models import FollowerDatabaseDefinition # type: ignore + from ._models import FollowerDatabaseListResult # type: ignore + from ._models import IotHubDataConnection # type: ignore + from ._models import KeyVaultProperties # type: ignore + from ._models import LanguageExtension # type: ignore + from ._models import LanguageExtensionsList # type: ignore + from ._models import ListResourceSkusResult # type: ignore + from ._models import Operation # type: ignore + from ._models import OperationDisplay # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import OptimizedAutoscale # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import ReadOnlyFollowingDatabase # type: ignore + from ._models import ReadWriteDatabase # type: ignore + from ._models import Resource # type: ignore + from ._models import SkuDescription # type: ignore + from ._models import SkuDescriptionList # type: ignore + from ._models import SkuLocationInfoItem # type: ignore + from ._models import TrackedResource # type: ignore + from ._models import TrustedExternalTenant # type: ignore + from ._models import VirtualNetworkConfiguration # type: ignore + +from ._kusto_management_client_enums import ( + AzureScaleType, + AzureSkuName, + AzureSkuTier, + ClusterPrincipalRole, + Compression, + DatabasePrincipalRole, + DatabasePrincipalType, + DefaultPrincipalsModificationKind, + EventGridDataFormat, + EventHubDataFormat, + IdentityType, + IotHubDataFormat, + Kind, + LanguageExtensionName, + PrincipalType, + PrincipalsModificationKind, + ProvisioningState, + Reason, + State, + Type, +) + +__all__ = [ + 'AttachedDatabaseConfiguration', + 'AttachedDatabaseConfigurationListResult', + 'AzureCapacity', + 'AzureResourceSku', + 'AzureSku', + 'CheckNameRequest', + 'CheckNameResult', + 'CloudErrorBody', + 'Cluster', + 'ClusterCheckNameRequest', + 'ClusterListResult', + 'ClusterPrincipalAssignment', + 'ClusterPrincipalAssignmentCheckNameRequest', + 'ClusterPrincipalAssignmentListResult', + 'ClusterUpdate', + 'ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties', + 'DataConnection', + 'DataConnectionCheckNameRequest', + 'DataConnectionListResult', + 'DataConnectionValidation', + 'DataConnectionValidationListResult', + 'DataConnectionValidationResult', + 'Database', + 'DatabaseListResult', + 'DatabasePrincipal', + 'DatabasePrincipalAssignment', + 'DatabasePrincipalAssignmentCheckNameRequest', + 'DatabasePrincipalAssignmentListResult', + 'DatabasePrincipalListRequest', + 'DatabasePrincipalListResult', + 'DatabaseStatistics', + 'DiagnoseVirtualNetworkResult', + 'EventGridDataConnection', + 'EventHubDataConnection', + 'FollowerDatabaseDefinition', + 'FollowerDatabaseListResult', + 'IotHubDataConnection', + 'KeyVaultProperties', + 'LanguageExtension', + 'LanguageExtensionsList', + 'ListResourceSkusResult', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'OptimizedAutoscale', + 'ProxyResource', + 'ReadOnlyFollowingDatabase', + 'ReadWriteDatabase', + 'Resource', + 'SkuDescription', + 'SkuDescriptionList', + 'SkuLocationInfoItem', + 'TrackedResource', + 'TrustedExternalTenant', + 'VirtualNetworkConfiguration', + 'AzureScaleType', + 'AzureSkuName', + 'AzureSkuTier', + 'ClusterPrincipalRole', + 'Compression', + 'DatabasePrincipalRole', + 'DatabasePrincipalType', + 'DefaultPrincipalsModificationKind', + 'EventGridDataFormat', + 'EventHubDataFormat', + 'IdentityType', + 'IotHubDataFormat', + 'Kind', + 'LanguageExtensionName', + 'PrincipalType', + 'PrincipalsModificationKind', + 'ProvisioningState', + 'Reason', + 'State', + 'Type', +] diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/models/_kusto_management_client_enums.py b/src/kusto/azext_kusto/vendored_sdks/kusto/models/_kusto_management_client_enums.py new file mode 100644 index 00000000000..0d69900464b --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/models/_kusto_management_client_enums.py @@ -0,0 +1,231 @@ +# 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 enum import Enum + +class AzureScaleType(str, Enum): + """Scale type. + """ + + automatic = "automatic" + manual = "manual" + none = "none" + +class AzureSkuName(str, Enum): + """SKU name. + """ + + standard_ds13_v2_1_tb_ps = "Standard_DS13_v2+1TB_PS" + standard_ds13_v2_tb_ps = "Standard_DS13_v2+2TB_PS" + standard_ds14_v2_3_tb_ps = "Standard_DS14_v2+3TB_PS" + standard_ds14_v2_4_tb_ps = "Standard_DS14_v2+4TB_PS" + standard_d13_v2 = "Standard_D13_v2" + standard_d14_v2 = "Standard_D14_v2" + standard_l8_s = "Standard_L8s" + standard_l16_s = "Standard_L16s" + standard_d11_v2 = "Standard_D11_v2" + standard_d12_v2 = "Standard_D12_v2" + standard_l4_s = "Standard_L4s" + dev_no_sla_standard_d11_v2 = "Dev(No SLA)_Standard_D11_v2" + standard_e2_a_v4 = "Standard_E2a_v4" + standard_e4_a_v4 = "Standard_E4a_v4" + standard_e8_a_v4 = "Standard_E8a_v4" + standard_e16_a_v4 = "Standard_E16a_v4" + standard_e8_as_v4_1_tb_ps = "Standard_E8as_v4+1TB_PS" + standard_e8_as_v4_2_tb_ps = "Standard_E8as_v4+2TB_PS" + standard_e16_as_v4_3_tb_ps = "Standard_E16as_v4+3TB_PS" + standard_e16_as_v4_tb_ps = "Standard_E16as_v4+4TB_PS" + dev_no_sla_standard_e2_a_v4 = "Dev(No SLA)_Standard_E2a_v4" + +class AzureSkuTier(str, Enum): + """SKU tier. + """ + + basic = "Basic" + standard = "Standard" + +class ClusterPrincipalRole(str, Enum): + """Cluster principal role. + """ + + all_databases_admin = "AllDatabasesAdmin" + all_databases_viewer = "AllDatabasesViewer" + +class Compression(str, Enum): + """The compression type + """ + + none = "None" + g_zip = "GZip" + +class DatabasePrincipalRole(str, Enum): + """Database principal role. + """ + + admin = "Admin" + ingestor = "Ingestor" + monitor = "Monitor" + user = "User" + unrestricted_viewers = "UnrestrictedViewers" + viewer = "Viewer" + +class DatabasePrincipalType(str, Enum): + """Database principal type. + """ + + app = "App" + group = "Group" + user = "User" + +class DefaultPrincipalsModificationKind(str, Enum): + """The default principals modification kind + """ + + union = "Union" + replace = "Replace" + none = "None" + +class EventGridDataFormat(str, Enum): + """The data format of the message. Optionally the data format can be added to each message. + """ + + multijson = "MULTIJSON" + json = "JSON" + csv = "CSV" + tsv = "TSV" + scsv = "SCSV" + sohsv = "SOHSV" + psv = "PSV" + txt = "TXT" + raw = "RAW" + singlejson = "SINGLEJSON" + avro = "AVRO" + tsve = "TSVE" + parquet = "PARQUET" + orc = "ORC" + +class EventHubDataFormat(str, Enum): + """The data format of the message. Optionally the data format can be added to each message. + """ + + multijson = "MULTIJSON" + json = "JSON" + csv = "CSV" + tsv = "TSV" + scsv = "SCSV" + sohsv = "SOHSV" + psv = "PSV" + txt = "TXT" + raw = "RAW" + singlejson = "SINGLEJSON" + avro = "AVRO" + tsve = "TSVE" + parquet = "PARQUET" + orc = "ORC" + +class IdentityType(str, Enum): + """The identity type. + """ + + none = "None" + system_assigned = "SystemAssigned" + +class IotHubDataFormat(str, Enum): + """The data format of the message. Optionally the data format can be added to each message. + """ + + multijson = "MULTIJSON" + json = "JSON" + csv = "CSV" + tsv = "TSV" + scsv = "SCSV" + sohsv = "SOHSV" + psv = "PSV" + txt = "TXT" + raw = "RAW" + singlejson = "SINGLEJSON" + avro = "AVRO" + tsve = "TSVE" + parquet = "PARQUET" + orc = "ORC" + +class Kind(str, Enum): + """Kind of the database + """ + + read_write = "ReadWrite" + read_only_following = "ReadOnlyFollowing" + event_hub = "EventHub" + event_grid = "EventGrid" + iot_hub = "IotHub" + +class LanguageExtensionName(str, Enum): + """Language extension that can run within KQL query. + """ + + python = "PYTHON" + r = "R" + +class PrincipalsModificationKind(str, Enum): + """The principals modification kind of the database + """ + + union = "Union" + replace = "Replace" + none = "None" + +class PrincipalType(str, Enum): + """Principal type. + """ + + app = "App" + group = "Group" + user = "User" + +class ProvisioningState(str, Enum): + """The provisioned state of the resource. + """ + + running = "Running" + creating = "Creating" + deleting = "Deleting" + succeeded = "Succeeded" + failed = "Failed" + moving = "Moving" + +class Reason(str, Enum): + """Message providing the reason why the given name is invalid. + """ + + invalid = "Invalid" + already_exists = "AlreadyExists" + +class State(str, Enum): + """The state of the resource. + """ + + creating = "Creating" + unavailable = "Unavailable" + running = "Running" + deleting = "Deleting" + deleted = "Deleted" + stopping = "Stopping" + stopped = "Stopped" + starting = "Starting" + updating = "Updating" + +class Type(str, Enum): + """The type of resource, Microsoft.Kusto/clusters. + """ + + microsoft_kusto_clusters = "Microsoft.Kusto/clusters" + microsoft_kusto_clusters_databases = "Microsoft.Kusto/clusters/databases" + microsoft_kusto_clusters_attached_database_configurations = "Microsoft.Kusto/clusters/attachedDatabaseConfigurations" + microsoft_kusto_clusters_principal_assignments = "Microsoft.Kusto/clusters/principalAssignments" + microsoft_kusto_clusters_databases_data_connections = "Microsoft.Kusto/clusters/databases/dataConnections" + microsoft_kusto_clusters_databases_principal_assignments = "Microsoft.Kusto/clusters/databases/principalAssignments" diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/models/_models.py b/src/kusto/azext_kusto/vendored_sdks/kusto/models/_models.py new file mode 100644 index 00000000000..c38a705e717 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/models/_models.py @@ -0,0 +1,2211 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class Resource(msrest.serialization.Model): + """Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class AttachedDatabaseConfiguration(ProxyResource): + """Class representing an attached database configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + :param database_name: The name of the database which you would like to attach, use * if you + want to follow all current and future databases. + :type database_name: str + :param cluster_resource_id: The resource id of the cluster where the databases you would like + to attach reside. + :type cluster_resource_id: str + :ivar attached_database_names: The list of databases from the clusterResourceId which are + currently attached to the cluster. + :vartype attached_database_names: list[str] + :param default_principals_modification_kind: The default principals modification kind. Possible + values include: "Union", "Replace", "None". + :type default_principals_modification_kind: str or + ~azure.mgmt.kusto.models.DefaultPrincipalsModificationKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'attached_database_names': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, + 'cluster_resource_id': {'key': 'properties.clusterResourceId', 'type': 'str'}, + 'attached_database_names': {'key': 'properties.attachedDatabaseNames', 'type': '[str]'}, + 'default_principals_modification_kind': {'key': 'properties.defaultPrincipalsModificationKind', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AttachedDatabaseConfiguration, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.provisioning_state = None + self.database_name = kwargs.get('database_name', None) + self.cluster_resource_id = kwargs.get('cluster_resource_id', None) + self.attached_database_names = None + self.default_principals_modification_kind = kwargs.get('default_principals_modification_kind', None) + + +class AttachedDatabaseConfigurationListResult(msrest.serialization.Model): + """The list attached database configurations operation response. + + :param value: The list of attached database configurations. + :type value: list[~azure.mgmt.kusto.models.AttachedDatabaseConfiguration] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AttachedDatabaseConfiguration]'}, + } + + def __init__( + self, + **kwargs + ): + super(AttachedDatabaseConfigurationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class AzureCapacity(msrest.serialization.Model): + """Azure capacity definition. + + All required parameters must be populated in order to send to Azure. + + :param scale_type: Required. Scale type. Possible values include: "automatic", "manual", + "none". + :type scale_type: str or ~azure.mgmt.kusto.models.AzureScaleType + :param minimum: Required. Minimum allowed capacity. + :type minimum: int + :param maximum: Required. Maximum allowed capacity. + :type maximum: int + :param default: Required. The default capacity that would be used. + :type default: int + """ + + _validation = { + 'scale_type': {'required': True}, + 'minimum': {'required': True}, + 'maximum': {'required': True}, + 'default': {'required': True}, + } + + _attribute_map = { + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureCapacity, self).__init__(**kwargs) + self.scale_type = kwargs['scale_type'] + self.minimum = kwargs['minimum'] + self.maximum = kwargs['maximum'] + self.default = kwargs['default'] + + +class AzureResourceSku(msrest.serialization.Model): + """Azure resource SKU definition. + + :param resource_type: Resource Namespace and Type. + :type resource_type: str + :param sku: The SKU details. + :type sku: ~azure.mgmt.kusto.models.AzureSku + :param capacity: The number of instances of the cluster. + :type capacity: ~azure.mgmt.kusto.models.AzureCapacity + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'AzureSku'}, + 'capacity': {'key': 'capacity', 'type': 'AzureCapacity'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureResourceSku, self).__init__(**kwargs) + self.resource_type = kwargs.get('resource_type', None) + self.sku = kwargs.get('sku', None) + self.capacity = kwargs.get('capacity', None) + + +class AzureSku(msrest.serialization.Model): + """Azure SKU definition. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. SKU name. Possible values include: "Standard_DS13_v2+1TB_PS", + "Standard_DS13_v2+2TB_PS", "Standard_DS14_v2+3TB_PS", "Standard_DS14_v2+4TB_PS", + "Standard_D13_v2", "Standard_D14_v2", "Standard_L8s", "Standard_L16s", "Standard_D11_v2", + "Standard_D12_v2", "Standard_L4s", "Dev(No SLA)_Standard_D11_v2", "Standard_E2a_v4", + "Standard_E4a_v4", "Standard_E8a_v4", "Standard_E16a_v4", "Standard_E8as_v4+1TB_PS", + "Standard_E8as_v4+2TB_PS", "Standard_E16as_v4+3TB_PS", "Standard_E16as_v4+4TB_PS", "Dev(No + SLA)_Standard_E2a_v4". + :type name: str or ~azure.mgmt.kusto.models.AzureSkuName + :param capacity: The number of instances of the cluster. + :type capacity: int + :param tier: Required. SKU tier. Possible values include: "Basic", "Standard". + :type tier: str or ~azure.mgmt.kusto.models.AzureSkuTier + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AzureSku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.capacity = kwargs.get('capacity', None) + self.tier = kwargs['tier'] + + +class CheckNameRequest(msrest.serialization.Model): + """The result returned from a database check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Resource name. + :type name: str + :param type: Required. The type of resource, for instance Microsoft.Kusto/clusters/databases. + Possible values include: "Microsoft.Kusto/clusters", "Microsoft.Kusto/clusters/databases", + "Microsoft.Kusto/clusters/attachedDatabaseConfigurations", + "Microsoft.Kusto/clusters/principalAssignments", + "Microsoft.Kusto/clusters/databases/dataConnections", + "Microsoft.Kusto/clusters/databases/principalAssignments". + :type type: str or ~azure.mgmt.kusto.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameRequest, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = kwargs['type'] + + +class CheckNameResult(msrest.serialization.Model): + """The result returned from a check name availability request. + + :param name_available: Specifies a Boolean value that indicates if the name is available. + :type name_available: bool + :param name: The name that was checked. + :type name: str + :param message: Message indicating an unavailable name due to a conflict, or a description of + the naming rules that are violated. + :type message: str + :param reason: Message providing the reason why the given name is invalid. Possible values + include: "Invalid", "AlreadyExists". + :type reason: str or ~azure.mgmt.kusto.models.Reason + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CheckNameResult, self).__init__(**kwargs) + self.name_available = kwargs.get('name_available', None) + self.name = kwargs.get('name', None) + self.message = kwargs.get('message', None) + self.reason = kwargs.get('reason', None) + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from Kusto. + + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable for displaying in a + user interface. + :type message: str + :param target: The target of the particular error. For example, the name of the property in + error. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.kusto.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + self.target = kwargs.get('target', None) + self.details = kwargs.get('details', None) + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class Cluster(TrackedResource): + """Class representing a Kusto cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param sku: Required. The SKU of the cluster. + :type sku: ~azure.mgmt.kusto.models.AzureSku + :param zones: The availability zones of the cluster. + :type zones: list[str] + :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", + "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". + :vartype state: str or ~azure.mgmt.kusto.models.State + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + :ivar uri: The cluster URI. + :vartype uri: str + :ivar data_ingestion_uri: The cluster data ingestion URI. + :vartype data_ingestion_uri: str + :ivar state_reason: The reason for the cluster's current state. + :vartype state_reason: str + :param trusted_external_tenants: The cluster's external tenants. + :type trusted_external_tenants: list[~azure.mgmt.kusto.models.TrustedExternalTenant] + :param optimized_autoscale: Optimized auto scale definition. + :type optimized_autoscale: ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.VirtualNetworkConfiguration + :param key_vault_properties: KeyVault properties for the cluster encryption. + :type key_vault_properties: ~azure.mgmt.kusto.models.KeyVaultProperties + :param enable_purge: A boolean value that indicates if the purge operations are enabled. + :type enable_purge: bool + :param value: The list of language extensions. + :type value: list[~azure.mgmt.kusto.models.LanguageExtension] + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type_identity_type: The identity type. Possible values include: "None", + "SystemAssigned". + :type type_identity_type: str or ~azure.mgmt.kusto.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, + ~azure.mgmt.kusto.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + 'state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'uri': {'readonly': True}, + 'data_ingestion_uri': {'readonly': True}, + 'state_reason': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'AzureSku'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'uri': {'key': 'properties.uri', 'type': 'str'}, + 'data_ingestion_uri': {'key': 'properties.dataIngestionUri', 'type': 'str'}, + 'state_reason': {'key': 'properties.stateReason', 'type': 'str'}, + 'trusted_external_tenants': {'key': 'properties.trustedExternalTenants', 'type': '[TrustedExternalTenant]'}, + 'optimized_autoscale': {'key': 'properties.optimizedAutoscale', 'type': 'OptimizedAutoscale'}, + 'enable_disk_encryption': {'key': 'properties.enableDiskEncryption', 'type': 'bool'}, + 'enable_streaming_ingest': {'key': 'properties.enableStreamingIngest', 'type': 'bool'}, + 'virtual_network_configuration': {'key': 'properties.virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, + 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'KeyVaultProperties'}, + 'enable_purge': {'key': 'properties.enablePurge', 'type': 'bool'}, + 'value': {'key': 'properties.languageExtensions.value', 'type': '[LanguageExtension]'}, + 'principal_id': {'key': 'identity.principalId', 'type': 'str'}, + 'tenant_id': {'key': 'identity.tenantId', 'type': 'str'}, + 'type_identity_type': {'key': 'identity.type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'identity.userAssignedIdentities', 'type': '{ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + } + + def __init__( + self, + **kwargs + ): + super(Cluster, self).__init__(**kwargs) + self.sku = kwargs['sku'] + self.zones = kwargs.get('zones', None) + self.state = None + self.provisioning_state = None + self.uri = None + self.data_ingestion_uri = None + self.state_reason = None + self.trusted_external_tenants = kwargs.get('trusted_external_tenants', None) + self.optimized_autoscale = kwargs.get('optimized_autoscale', None) + self.enable_disk_encryption = kwargs.get('enable_disk_encryption', None) + self.enable_streaming_ingest = kwargs.get('enable_streaming_ingest', False) + self.virtual_network_configuration = kwargs.get('virtual_network_configuration', None) + self.key_vault_properties = kwargs.get('key_vault_properties', None) + self.enable_purge = kwargs.get('enable_purge', False) + self.value = kwargs.get('value', None) + self.principal_id = None + self.tenant_id = None + self.type_identity_type = kwargs.get('type_identity_type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class ClusterCheckNameRequest(msrest.serialization.Model): + """The result returned from a cluster check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Cluster name. + :type name: str + :param type: Required. The type of resource, Microsoft.Kusto/clusters. Possible values include: + "Microsoft.Kusto/clusters", "Microsoft.Kusto/clusters/databases", + "Microsoft.Kusto/clusters/attachedDatabaseConfigurations", + "Microsoft.Kusto/clusters/principalAssignments", + "Microsoft.Kusto/clusters/databases/dataConnections", + "Microsoft.Kusto/clusters/databases/principalAssignments". + :type type: str or ~azure.mgmt.kusto.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterCheckNameRequest, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = kwargs['type'] + + +class ClusterListResult(msrest.serialization.Model): + """The list Kusto clusters operation response. + + :param value: The list of Kusto clusters. + :type value: list[~azure.mgmt.kusto.models.Cluster] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Cluster]'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ClusterPrincipalAssignment(ProxyResource): + """Class representing a cluster principal assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param principal_id: The principal ID assigned to the cluster principal. It can be a user + email, application ID, or security group name. + :type principal_id: str + :param role: Cluster principal role. Possible values include: "AllDatabasesAdmin", + "AllDatabasesViewer". + :type role: str or ~azure.mgmt.kusto.models.ClusterPrincipalRole + :param tenant_id: The tenant id of the principal. + :type tenant_id: str + :param principal_type: Principal type. Possible values include: "App", "Group", "User". + :type principal_type: str or ~azure.mgmt.kusto.models.PrincipalType + :ivar tenant_name: The tenant name of the principal. + :vartype tenant_name: str + :ivar principal_name: The principal name. + :vartype principal_name: str + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tenant_name': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, + 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, + 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterPrincipalAssignment, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.role = kwargs.get('role', None) + self.tenant_id = kwargs.get('tenant_id', None) + self.principal_type = kwargs.get('principal_type', None) + self.tenant_name = None + self.principal_name = None + self.provisioning_state = None + + +class ClusterPrincipalAssignmentCheckNameRequest(msrest.serialization.Model): + """A principal assignment check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Principal Assignment resource name. + :type name: str + :param type: Required. The type of resource, Microsoft.Kusto/clusters/principalAssignments. + Possible values include: "Microsoft.Kusto/clusters", "Microsoft.Kusto/clusters/databases", + "Microsoft.Kusto/clusters/attachedDatabaseConfigurations", + "Microsoft.Kusto/clusters/principalAssignments", + "Microsoft.Kusto/clusters/databases/dataConnections", + "Microsoft.Kusto/clusters/databases/principalAssignments". + :type type: str or ~azure.mgmt.kusto.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterPrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = kwargs['type'] + + +class ClusterPrincipalAssignmentListResult(msrest.serialization.Model): + """The list Kusto cluster principal assignments operation response. + + :param value: The list of Kusto cluster principal assignments. + :type value: list[~azure.mgmt.kusto.models.ClusterPrincipalAssignment] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ClusterPrincipalAssignment]'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterPrincipalAssignmentListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ClusterUpdate(Resource): + """Class representing an update to a Kusto cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Resource location. + :type location: str + :param sku: The SKU of the cluster. + :type sku: ~azure.mgmt.kusto.models.AzureSku + :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", + "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". + :vartype state: str or ~azure.mgmt.kusto.models.State + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + :ivar uri: The cluster URI. + :vartype uri: str + :ivar data_ingestion_uri: The cluster data ingestion URI. + :vartype data_ingestion_uri: str + :ivar state_reason: The reason for the cluster's current state. + :vartype state_reason: str + :param trusted_external_tenants: The cluster's external tenants. + :type trusted_external_tenants: list[~azure.mgmt.kusto.models.TrustedExternalTenant] + :param optimized_autoscale: Optimized auto scale definition. + :type optimized_autoscale: ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.VirtualNetworkConfiguration + :param key_vault_properties: KeyVault properties for the cluster encryption. + :type key_vault_properties: ~azure.mgmt.kusto.models.KeyVaultProperties + :param enable_purge: A boolean value that indicates if the purge operations are enabled. + :type enable_purge: bool + :param value: The list of language extensions. + :type value: list[~azure.mgmt.kusto.models.LanguageExtension] + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type_identity_type: The identity type. Possible values include: "None", + "SystemAssigned". + :type type_identity_type: str or ~azure.mgmt.kusto.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, + ~azure.mgmt.kusto.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'uri': {'readonly': True}, + 'data_ingestion_uri': {'readonly': True}, + 'state_reason': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'AzureSku'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'uri': {'key': 'properties.uri', 'type': 'str'}, + 'data_ingestion_uri': {'key': 'properties.dataIngestionUri', 'type': 'str'}, + 'state_reason': {'key': 'properties.stateReason', 'type': 'str'}, + 'trusted_external_tenants': {'key': 'properties.trustedExternalTenants', 'type': '[TrustedExternalTenant]'}, + 'optimized_autoscale': {'key': 'properties.optimizedAutoscale', 'type': 'OptimizedAutoscale'}, + 'enable_disk_encryption': {'key': 'properties.enableDiskEncryption', 'type': 'bool'}, + 'enable_streaming_ingest': {'key': 'properties.enableStreamingIngest', 'type': 'bool'}, + 'virtual_network_configuration': {'key': 'properties.virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, + 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'KeyVaultProperties'}, + 'enable_purge': {'key': 'properties.enablePurge', 'type': 'bool'}, + 'value': {'key': 'properties.languageExtensions.value', 'type': '[LanguageExtension]'}, + 'principal_id': {'key': 'identity.principalId', 'type': 'str'}, + 'tenant_id': {'key': 'identity.tenantId', 'type': 'str'}, + 'type_identity_type': {'key': 'identity.type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'identity.userAssignedIdentities', 'type': '{ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + } + + def __init__( + self, + **kwargs + ): + super(ClusterUpdate, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs.get('location', None) + self.sku = kwargs.get('sku', None) + self.state = None + self.provisioning_state = None + self.uri = None + self.data_ingestion_uri = None + self.state_reason = None + self.trusted_external_tenants = kwargs.get('trusted_external_tenants', None) + self.optimized_autoscale = kwargs.get('optimized_autoscale', None) + self.enable_disk_encryption = kwargs.get('enable_disk_encryption', None) + self.enable_streaming_ingest = kwargs.get('enable_streaming_ingest', False) + self.virtual_network_configuration = kwargs.get('virtual_network_configuration', None) + self.key_vault_properties = kwargs.get('key_vault_properties', None) + self.enable_purge = kwargs.get('enable_purge', False) + self.value = kwargs.get('value', None) + self.principal_id = None + self.tenant_id = None + self.type_identity_type = kwargs.get('type_identity_type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class Database(ProxyResource): + """Class representing a Kusto database. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ReadOnlyFollowingDatabase, ReadWriteDatabase. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the database.Constant filled by server. Possible values + include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'ReadOnlyFollowing': 'ReadOnlyFollowingDatabase', 'ReadWrite': 'ReadWriteDatabase'} + } + + def __init__( + self, + **kwargs + ): + super(Database, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.kind = 'Database' + + +class DatabaseListResult(msrest.serialization.Model): + """The list Kusto databases operation response. + + :param value: The list of Kusto databases. + :type value: list[~azure.mgmt.kusto.models.Database] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Database]'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabaseListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class DatabasePrincipal(msrest.serialization.Model): + """A class representing database principal entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param role: Required. Database principal role. Possible values include: "Admin", "Ingestor", + "Monitor", "User", "UnrestrictedViewers", "Viewer". + :type role: str or ~azure.mgmt.kusto.models.DatabasePrincipalRole + :param name: Required. Database principal name. + :type name: str + :param type: Required. Database principal type. Possible values include: "App", "Group", + "User". + :type type: str or ~azure.mgmt.kusto.models.DatabasePrincipalType + :param fqn: Database principal fully qualified name. + :type fqn: str + :param email: Database principal email if exists. + :type email: str + :param app_id: Application id - relevant only for application principal type. + :type app_id: str + :ivar tenant_name: The tenant name of the principal. + :vartype tenant_name: str + """ + + _validation = { + 'role': {'required': True}, + 'name': {'required': True}, + 'type': {'required': True}, + 'tenant_name': {'readonly': True}, + } + + _attribute_map = { + 'role': {'key': 'role', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'fqn': {'key': 'fqn', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'app_id': {'key': 'appId', 'type': 'str'}, + 'tenant_name': {'key': 'tenantName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabasePrincipal, self).__init__(**kwargs) + self.role = kwargs['role'] + self.name = kwargs['name'] + self.type = kwargs['type'] + self.fqn = kwargs.get('fqn', None) + self.email = kwargs.get('email', None) + self.app_id = kwargs.get('app_id', None) + self.tenant_name = None + + +class DatabasePrincipalAssignment(ProxyResource): + """Class representing a database principal assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param principal_id: The principal ID assigned to the database principal. It can be a user + email, application ID, or security group name. + :type principal_id: str + :param role: Database principal role. Possible values include: "Admin", "Ingestor", "Monitor", + "User", "UnrestrictedViewers", "Viewer". + :type role: str or ~azure.mgmt.kusto.models.DatabasePrincipalRole + :param tenant_id: The tenant id of the principal. + :type tenant_id: str + :param principal_type: Principal type. Possible values include: "App", "Group", "User". + :type principal_type: str or ~azure.mgmt.kusto.models.PrincipalType + :ivar tenant_name: The tenant name of the principal. + :vartype tenant_name: str + :ivar principal_name: The principal name. + :vartype principal_name: str + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tenant_name': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, + 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, + 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabasePrincipalAssignment, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.role = kwargs.get('role', None) + self.tenant_id = kwargs.get('tenant_id', None) + self.principal_type = kwargs.get('principal_type', None) + self.tenant_name = None + self.principal_name = None + self.provisioning_state = None + + +class DatabasePrincipalAssignmentCheckNameRequest(msrest.serialization.Model): + """A principal assignment check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Principal Assignment resource name. + :type name: str + :param type: Required. The type of resource, + Microsoft.Kusto/clusters/databases/principalAssignments. Possible values include: + "Microsoft.Kusto/clusters", "Microsoft.Kusto/clusters/databases", + "Microsoft.Kusto/clusters/attachedDatabaseConfigurations", + "Microsoft.Kusto/clusters/principalAssignments", + "Microsoft.Kusto/clusters/databases/dataConnections", + "Microsoft.Kusto/clusters/databases/principalAssignments". + :type type: str or ~azure.mgmt.kusto.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabasePrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = kwargs['type'] + + +class DatabasePrincipalAssignmentListResult(msrest.serialization.Model): + """The list Kusto database principal assignments operation response. + + :param value: The list of Kusto database principal assignments. + :type value: list[~azure.mgmt.kusto.models.DatabasePrincipalAssignment] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DatabasePrincipalAssignment]'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabasePrincipalAssignmentListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class DatabasePrincipalListRequest(msrest.serialization.Model): + """The list Kusto database principals operation request. + + :param value: The list of Kusto database principals. + :type value: list[~azure.mgmt.kusto.models.DatabasePrincipal] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DatabasePrincipal]'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabasePrincipalListRequest, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class DatabasePrincipalListResult(msrest.serialization.Model): + """The list Kusto database principals operation response. + + :param value: The list of Kusto database principals. + :type value: list[~azure.mgmt.kusto.models.DatabasePrincipal] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DatabasePrincipal]'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabasePrincipalListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class DatabaseStatistics(msrest.serialization.Model): + """A class that contains database statistics information. + + :param size: The database size - the total size of compressed data and index in bytes. + :type size: float + """ + + _attribute_map = { + 'size': {'key': 'size', 'type': 'float'}, + } + + def __init__( + self, + **kwargs + ): + super(DatabaseStatistics, self).__init__(**kwargs) + self.size = kwargs.get('size', None) + + +class DataConnection(ProxyResource): + """Class representing an data connection. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: EventGridDataConnection, EventHubDataConnection, IotHubDataConnection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'EventGrid': 'EventGridDataConnection', 'EventHub': 'EventHubDataConnection', 'IotHub': 'IotHubDataConnection'} + } + + def __init__( + self, + **kwargs + ): + super(DataConnection, self).__init__(**kwargs) + self.location = kwargs.get('location', None) + self.kind = 'DataConnection' + + +class DataConnectionCheckNameRequest(msrest.serialization.Model): + """A data connection check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Data Connection name. + :type name: str + :param type: Required. The type of resource, + Microsoft.Kusto/clusters/databases/dataConnections. Possible values include: + "Microsoft.Kusto/clusters", "Microsoft.Kusto/clusters/databases", + "Microsoft.Kusto/clusters/attachedDatabaseConfigurations", + "Microsoft.Kusto/clusters/principalAssignments", + "Microsoft.Kusto/clusters/databases/dataConnections", + "Microsoft.Kusto/clusters/databases/principalAssignments". + :type type: str or ~azure.mgmt.kusto.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataConnectionCheckNameRequest, self).__init__(**kwargs) + self.name = kwargs['name'] + self.type = kwargs['type'] + + +class DataConnectionListResult(msrest.serialization.Model): + """The list Kusto data connections operation response. + + :param value: The list of Kusto data connections. + :type value: list[~azure.mgmt.kusto.models.DataConnection] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataConnection]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataConnectionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class DataConnectionValidation(msrest.serialization.Model): + """Class representing an data connection validation. + + :param data_connection_name: The name of the data connection. + :type data_connection_name: str + :param properties: The data connection properties to validate. + :type properties: ~azure.mgmt.kusto.models.DataConnection + """ + + _attribute_map = { + 'data_connection_name': {'key': 'dataConnectionName', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DataConnection'}, + } + + def __init__( + self, + **kwargs + ): + super(DataConnectionValidation, self).__init__(**kwargs) + self.data_connection_name = kwargs.get('data_connection_name', None) + self.properties = kwargs.get('properties', None) + + +class DataConnectionValidationListResult(msrest.serialization.Model): + """The list Kusto data connection validation result. + + :param value: The list of Kusto data connection validation errors. + :type value: list[~azure.mgmt.kusto.models.DataConnectionValidationResult] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataConnectionValidationResult]'}, + } + + def __init__( + self, + **kwargs + ): + super(DataConnectionValidationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class DataConnectionValidationResult(msrest.serialization.Model): + """The result returned from a data connection validation request. + + :param error_message: A message which indicates a problem in data connection validation. + :type error_message: str + """ + + _attribute_map = { + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DataConnectionValidationResult, self).__init__(**kwargs) + self.error_message = kwargs.get('error_message', None) + + +class DiagnoseVirtualNetworkResult(msrest.serialization.Model): + """DiagnoseVirtualNetworkResult. + + :param findings: The list of network connectivity diagnostic finding. + :type findings: list[str] + """ + + _attribute_map = { + 'findings': {'key': 'findings', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(DiagnoseVirtualNetworkResult, self).__init__(**kwargs) + self.findings = kwargs.get('findings', None) + + +class EventGridDataConnection(DataConnection): + """Class representing an Event Grid data connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + :param storage_account_resource_id: The resource ID of the storage account where the data + resides. + :type storage_account_resource_id: str + :param event_hub_resource_id: The resource ID where the event grid is configured to send + events. + :type event_hub_resource_id: str + :param consumer_group: The event hub consumer group. + :type consumer_group: str + :param table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :type table_name: str + :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :type mapping_rule_name: str + :param data_format: The data format of the message. Optionally the data format can be added to + each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC". + :type data_format: str or ~azure.mgmt.kusto.models.EventGridDataFormat + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, + 'event_hub_resource_id': {'key': 'properties.eventHubResourceId', 'type': 'str'}, + 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, + 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventGridDataConnection, self).__init__(**kwargs) + self.kind = 'EventGrid' + self.storage_account_resource_id = kwargs.get('storage_account_resource_id', None) + self.event_hub_resource_id = kwargs.get('event_hub_resource_id', None) + self.consumer_group = kwargs.get('consumer_group', None) + self.table_name = kwargs.get('table_name', None) + self.mapping_rule_name = kwargs.get('mapping_rule_name', None) + self.data_format = kwargs.get('data_format', None) + + +class EventHubDataConnection(DataConnection): + """Class representing an event hub data connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + :param event_hub_resource_id: The resource ID of the event hub to be used to create a data + connection. + :type event_hub_resource_id: str + :param consumer_group: The event hub consumer group. + :type consumer_group: str + :param table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :type table_name: str + :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :type mapping_rule_name: str + :param data_format: The data format of the message. Optionally the data format can be added to + each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC". + :type data_format: str or ~azure.mgmt.kusto.models.EventHubDataFormat + :param event_system_properties: System properties of the event hub. + :type event_system_properties: list[str] + :param compression: The event hub messages compression type. Possible values include: "None", + "GZip". + :type compression: str or ~azure.mgmt.kusto.models.Compression + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'event_hub_resource_id': {'key': 'properties.eventHubResourceId', 'type': 'str'}, + 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, + 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, + 'event_system_properties': {'key': 'properties.eventSystemProperties', 'type': '[str]'}, + 'compression': {'key': 'properties.compression', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(EventHubDataConnection, self).__init__(**kwargs) + self.kind = 'EventHub' + self.event_hub_resource_id = kwargs.get('event_hub_resource_id', None) + self.consumer_group = kwargs.get('consumer_group', None) + self.table_name = kwargs.get('table_name', None) + self.mapping_rule_name = kwargs.get('mapping_rule_name', None) + self.data_format = kwargs.get('data_format', None) + self.event_system_properties = kwargs.get('event_system_properties', None) + self.compression = kwargs.get('compression', None) + + +class FollowerDatabaseDefinition(msrest.serialization.Model): + """A class representing follower database request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param cluster_resource_id: Required. Resource id of the cluster that follows a database owned + by this cluster. + :type cluster_resource_id: str + :param attached_database_configuration_name: Required. Resource name of the attached database + configuration in the follower cluster. + :type attached_database_configuration_name: str + :ivar database_name: The database name owned by this cluster that was followed. * in case + following all databases. + :vartype database_name: str + """ + + _validation = { + 'cluster_resource_id': {'required': True}, + 'attached_database_configuration_name': {'required': True}, + 'database_name': {'readonly': True}, + } + + _attribute_map = { + 'cluster_resource_id': {'key': 'clusterResourceId', 'type': 'str'}, + 'attached_database_configuration_name': {'key': 'attachedDatabaseConfigurationName', 'type': 'str'}, + 'database_name': {'key': 'databaseName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(FollowerDatabaseDefinition, self).__init__(**kwargs) + self.cluster_resource_id = kwargs['cluster_resource_id'] + self.attached_database_configuration_name = kwargs['attached_database_configuration_name'] + self.database_name = None + + +class FollowerDatabaseListResult(msrest.serialization.Model): + """The list Kusto database principals operation response. + + :param value: The list of follower database result. + :type value: list[~azure.mgmt.kusto.models.FollowerDatabaseDefinition] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FollowerDatabaseDefinition]'}, + } + + def __init__( + self, + **kwargs + ): + super(FollowerDatabaseListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class IotHubDataConnection(DataConnection): + """Class representing an iot hub data connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + :param iot_hub_resource_id: The resource ID of the Iot hub to be used to create a data + connection. + :type iot_hub_resource_id: str + :param consumer_group: The iot hub consumer group. + :type consumer_group: str + :param table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :type table_name: str + :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :type mapping_rule_name: str + :param data_format: The data format of the message. Optionally the data format can be added to + each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC". + :type data_format: str or ~azure.mgmt.kusto.models.IotHubDataFormat + :param event_system_properties: System properties of the iot hub. + :type event_system_properties: list[str] + :param shared_access_policy_name: The name of the share access policy. + :type shared_access_policy_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'iot_hub_resource_id': {'key': 'properties.iotHubResourceId', 'type': 'str'}, + 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, + 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, + 'event_system_properties': {'key': 'properties.eventSystemProperties', 'type': '[str]'}, + 'shared_access_policy_name': {'key': 'properties.sharedAccessPolicyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(IotHubDataConnection, self).__init__(**kwargs) + self.kind = 'IotHub' + self.iot_hub_resource_id = kwargs.get('iot_hub_resource_id', None) + self.consumer_group = kwargs.get('consumer_group', None) + self.table_name = kwargs.get('table_name', None) + self.mapping_rule_name = kwargs.get('mapping_rule_name', None) + self.data_format = kwargs.get('data_format', None) + self.event_system_properties = kwargs.get('event_system_properties', None) + self.shared_access_policy_name = kwargs.get('shared_access_policy_name', None) + + +class KeyVaultProperties(msrest.serialization.Model): + """Properties of the key vault. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. The name of the key vault key. + :type key_name: str + :param key_version: Required. The version of the key vault key. + :type key_version: str + :param key_vault_uri: Required. The Uri of the key vault. + :type key_vault_uri: str + """ + + _validation = { + 'key_name': {'required': True}, + 'key_version': {'required': True}, + 'key_vault_uri': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'key_version': {'key': 'keyVersion', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_name = kwargs['key_name'] + self.key_version = kwargs['key_version'] + self.key_vault_uri = kwargs['key_vault_uri'] + + +class LanguageExtension(msrest.serialization.Model): + """The language extension object. + + :param language_extension_name: The language extension name. Possible values include: "PYTHON", + "R". + :type language_extension_name: str or ~azure.mgmt.kusto.models.LanguageExtensionName + """ + + _attribute_map = { + 'language_extension_name': {'key': 'languageExtensionName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LanguageExtension, self).__init__(**kwargs) + self.language_extension_name = kwargs.get('language_extension_name', None) + + +class LanguageExtensionsList(msrest.serialization.Model): + """The list of language extension objects. + + :param value: The list of language extensions. + :type value: list[~azure.mgmt.kusto.models.LanguageExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[LanguageExtension]'}, + } + + def __init__( + self, + **kwargs + ): + super(LanguageExtensionsList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class ListResourceSkusResult(msrest.serialization.Model): + """List of available SKUs for a Kusto Cluster. + + :param value: The collection of available SKUs for an existing resource. + :type value: list[~azure.mgmt.kusto.models.AzureResourceSku] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AzureResourceSku]'}, + } + + def __init__( + self, + **kwargs + ): + super(ListResourceSkusResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class Operation(msrest.serialization.Model): + """A REST API operation. + + :param name: This is of the format {provider}/{resource}/{operation}. + :type name: str + :param display: The object that describes the operation. + :type display: ~azure.mgmt.kusto.models.OperationDisplay + :param origin: The intended executor of the operation. + :type origin: str + :param properties: Any object. + :type properties: object + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__( + self, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.origin = kwargs.get('origin', None) + self.properties = kwargs.get('properties', None) + + +class OperationDisplay(msrest.serialization.Model): + """The object that describes the operation. + + :param provider: Friendly name of the resource provider. + :type provider: str + :param operation: For example: read, write, delete. + :type operation: str + :param resource: The resource type on which the operation is performed. + :type resource: str + :param description: The friendly name of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.operation = kwargs.get('operation', None) + self.resource = kwargs.get('resource', None) + self.description = kwargs.get('description', None) + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. + + :param value: The list of operations supported by the resource provider. + :type value: list[~azure.mgmt.kusto.models.Operation] + :param next_link: The URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class OptimizedAutoscale(msrest.serialization.Model): + """A class that contains the optimized auto scale definition. + + All required parameters must be populated in order to send to Azure. + + :param version: Required. The version of the template defined, for instance 1. + :type version: int + :param is_enabled: Required. A boolean value that indicate if the optimized autoscale feature + is enabled or not. + :type is_enabled: bool + :param minimum: Required. Minimum allowed instances count. + :type minimum: int + :param maximum: Required. Maximum allowed instances count. + :type maximum: int + """ + + _validation = { + 'version': {'required': True}, + 'is_enabled': {'required': True}, + 'minimum': {'required': True}, + 'maximum': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'int'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(OptimizedAutoscale, self).__init__(**kwargs) + self.version = kwargs['version'] + self.is_enabled = kwargs['is_enabled'] + self.minimum = kwargs['minimum'] + self.maximum = kwargs['maximum'] + + +class ReadOnlyFollowingDatabase(Database): + """Class representing a read only following database. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the database.Constant filled by server. Possible values + include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + :ivar soft_delete_period: The time the data should be kept before it stops being accessible to + queries in TimeSpan. + :vartype soft_delete_period: ~datetime.timedelta + :param hot_cache_period: The time the data should be kept in cache for fast queries in + TimeSpan. + :type hot_cache_period: ~datetime.timedelta + :ivar statistics: The statistics of the database. + :vartype statistics: ~azure.mgmt.kusto.models.DatabaseStatistics + :ivar leader_cluster_resource_id: The name of the leader cluster. + :vartype leader_cluster_resource_id: str + :ivar attached_database_configuration_name: The name of the attached database configuration + cluster. + :vartype attached_database_configuration_name: str + :ivar principals_modification_kind: The principals modification kind of the database. Possible + values include: "Union", "Replace", "None". + :vartype principals_modification_kind: str or + ~azure.mgmt.kusto.models.PrincipalsModificationKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'soft_delete_period': {'readonly': True}, + 'statistics': {'readonly': True}, + 'leader_cluster_resource_id': {'readonly': True}, + 'attached_database_configuration_name': {'readonly': True}, + 'principals_modification_kind': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, + 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, + 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, + 'leader_cluster_resource_id': {'key': 'properties.leaderClusterResourceId', 'type': 'str'}, + 'attached_database_configuration_name': {'key': 'properties.attachedDatabaseConfigurationName', 'type': 'str'}, + 'principals_modification_kind': {'key': 'properties.principalsModificationKind', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReadOnlyFollowingDatabase, self).__init__(**kwargs) + self.kind = 'ReadOnlyFollowing' + self.provisioning_state = None + self.soft_delete_period = None + self.hot_cache_period = kwargs.get('hot_cache_period', None) + self.statistics = None + self.leader_cluster_resource_id = None + self.attached_database_configuration_name = None + self.principals_modification_kind = None + + +class ReadWriteDatabase(Database): + """Class representing a read write database. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the database.Constant filled by server. Possible values + include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + :param soft_delete_period: The time the data should be kept before it stops being accessible to + queries in TimeSpan. + :type soft_delete_period: ~datetime.timedelta + :param hot_cache_period: The time the data should be kept in cache for fast queries in + TimeSpan. + :type hot_cache_period: ~datetime.timedelta + :ivar statistics: The statistics of the database. + :vartype statistics: ~azure.mgmt.kusto.models.DatabaseStatistics + :ivar is_followed: Indicates whether the database is followed. + :vartype is_followed: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'statistics': {'readonly': True}, + 'is_followed': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, + 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, + 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, + 'is_followed': {'key': 'properties.isFollowed', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ReadWriteDatabase, self).__init__(**kwargs) + self.kind = 'ReadWrite' + self.provisioning_state = None + self.soft_delete_period = kwargs.get('soft_delete_period', None) + self.hot_cache_period = kwargs.get('hot_cache_period', None) + self.statistics = None + self.is_followed = None + + +class SkuDescription(msrest.serialization.Model): + """The Kusto SKU description of given resource type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_type: The resource type. + :vartype resource_type: str + :ivar name: The name of the SKU. + :vartype name: str + :ivar tier: The tier of the SKU. + :vartype tier: str + :ivar locations: The set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Locations and zones. + :vartype location_info: list[~azure.mgmt.kusto.models.SkuLocationInfoItem] + :ivar restrictions: The restrictions because of which SKU cannot be used. + :vartype restrictions: list[object] + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'name': {'readonly': True}, + 'tier': {'readonly': True}, + 'locations': {'readonly': True}, + 'location_info': {'readonly': True}, + 'restrictions': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfoItem]'}, + 'restrictions': {'key': 'restrictions', 'type': '[object]'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuDescription, self).__init__(**kwargs) + self.resource_type = None + self.name = None + self.tier = None + self.locations = None + self.location_info = None + self.restrictions = None + + +class SkuDescriptionList(msrest.serialization.Model): + """The list of the EngagementFabric SKU descriptions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: SKU descriptions. + :vartype value: list[~azure.mgmt.kusto.models.SkuDescription] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuDescriptionList, self).__init__(**kwargs) + self.value = None + + +class SkuLocationInfoItem(msrest.serialization.Model): + """The locations and zones info for SKU. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The available location of the SKU. + :type location: str + :param zones: The available zone of the SKU. + :type zones: list[str] + """ + + _validation = { + 'location': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuLocationInfoItem, self).__init__(**kwargs) + self.location = kwargs['location'] + self.zones = kwargs.get('zones', None) + + +class TrustedExternalTenant(msrest.serialization.Model): + """Represents a tenant ID that is trusted by the cluster. + + :param value: GUID representing an external tenant. + :type value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrustedExternalTenant, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + + +class VirtualNetworkConfiguration(msrest.serialization.Model): + """A class that contains virtual network definition. + + All required parameters must be populated in order to send to Azure. + + :param subnet_id: Required. The subnet resource id. + :type subnet_id: str + :param engine_public_ip_id: Required. Engine service's public IP address resource id. + :type engine_public_ip_id: str + :param data_management_public_ip_id: Required. Data management's service public IP address + resource id. + :type data_management_public_ip_id: str + """ + + _validation = { + 'subnet_id': {'required': True}, + 'engine_public_ip_id': {'required': True}, + 'data_management_public_ip_id': {'required': True}, + } + + _attribute_map = { + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'engine_public_ip_id': {'key': 'enginePublicIpId', 'type': 'str'}, + 'data_management_public_ip_id': {'key': 'dataManagementPublicIpId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VirtualNetworkConfiguration, self).__init__(**kwargs) + self.subnet_id = kwargs['subnet_id'] + self.engine_public_ip_id = kwargs['engine_public_ip_id'] + self.data_management_public_ip_id = kwargs['data_management_public_ip_id'] diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/models/_models_py3.py b/src/kusto/azext_kusto/vendored_sdks/kusto/models/_models_py3.py new file mode 100644 index 00000000000..c0114c710a3 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/models/_models_py3.py @@ -0,0 +1,2412 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +import msrest.serialization + + +class Resource(msrest.serialization.Model): + """Resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class ProxyResource(Resource): + """The resource model definition for a ARM proxy resource. It will have everything other than required location and tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + + +class AttachedDatabaseConfiguration(ProxyResource): + """Class representing an attached database configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + :param database_name: The name of the database which you would like to attach, use * if you + want to follow all current and future databases. + :type database_name: str + :param cluster_resource_id: The resource id of the cluster where the databases you would like + to attach reside. + :type cluster_resource_id: str + :ivar attached_database_names: The list of databases from the clusterResourceId which are + currently attached to the cluster. + :vartype attached_database_names: list[str] + :param default_principals_modification_kind: The default principals modification kind. Possible + values include: "Union", "Replace", "None". + :type default_principals_modification_kind: str or + ~azure.mgmt.kusto.models.DefaultPrincipalsModificationKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'attached_database_names': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'database_name': {'key': 'properties.databaseName', 'type': 'str'}, + 'cluster_resource_id': {'key': 'properties.clusterResourceId', 'type': 'str'}, + 'attached_database_names': {'key': 'properties.attachedDatabaseNames', 'type': '[str]'}, + 'default_principals_modification_kind': {'key': 'properties.defaultPrincipalsModificationKind', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + database_name: Optional[str] = None, + cluster_resource_id: Optional[str] = None, + default_principals_modification_kind: Optional[Union[str, "DefaultPrincipalsModificationKind"]] = None, + **kwargs + ): + super(AttachedDatabaseConfiguration, self).__init__(**kwargs) + self.location = location + self.provisioning_state = None + self.database_name = database_name + self.cluster_resource_id = cluster_resource_id + self.attached_database_names = None + self.default_principals_modification_kind = default_principals_modification_kind + + +class AttachedDatabaseConfigurationListResult(msrest.serialization.Model): + """The list attached database configurations operation response. + + :param value: The list of attached database configurations. + :type value: list[~azure.mgmt.kusto.models.AttachedDatabaseConfiguration] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AttachedDatabaseConfiguration]'}, + } + + def __init__( + self, + *, + value: Optional[List["AttachedDatabaseConfiguration"]] = None, + **kwargs + ): + super(AttachedDatabaseConfigurationListResult, self).__init__(**kwargs) + self.value = value + + +class AzureCapacity(msrest.serialization.Model): + """Azure capacity definition. + + All required parameters must be populated in order to send to Azure. + + :param scale_type: Required. Scale type. Possible values include: "automatic", "manual", + "none". + :type scale_type: str or ~azure.mgmt.kusto.models.AzureScaleType + :param minimum: Required. Minimum allowed capacity. + :type minimum: int + :param maximum: Required. Maximum allowed capacity. + :type maximum: int + :param default: Required. The default capacity that would be used. + :type default: int + """ + + _validation = { + 'scale_type': {'required': True}, + 'minimum': {'required': True}, + 'maximum': {'required': True}, + 'default': {'required': True}, + } + + _attribute_map = { + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + } + + def __init__( + self, + *, + scale_type: Union[str, "AzureScaleType"], + minimum: int, + maximum: int, + default: int, + **kwargs + ): + super(AzureCapacity, self).__init__(**kwargs) + self.scale_type = scale_type + self.minimum = minimum + self.maximum = maximum + self.default = default + + +class AzureResourceSku(msrest.serialization.Model): + """Azure resource SKU definition. + + :param resource_type: Resource Namespace and Type. + :type resource_type: str + :param sku: The SKU details. + :type sku: ~azure.mgmt.kusto.models.AzureSku + :param capacity: The number of instances of the cluster. + :type capacity: ~azure.mgmt.kusto.models.AzureCapacity + """ + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'AzureSku'}, + 'capacity': {'key': 'capacity', 'type': 'AzureCapacity'}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + sku: Optional["AzureSku"] = None, + capacity: Optional["AzureCapacity"] = None, + **kwargs + ): + super(AzureResourceSku, self).__init__(**kwargs) + self.resource_type = resource_type + self.sku = sku + self.capacity = capacity + + +class AzureSku(msrest.serialization.Model): + """Azure SKU definition. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. SKU name. Possible values include: "Standard_DS13_v2+1TB_PS", + "Standard_DS13_v2+2TB_PS", "Standard_DS14_v2+3TB_PS", "Standard_DS14_v2+4TB_PS", + "Standard_D13_v2", "Standard_D14_v2", "Standard_L8s", "Standard_L16s", "Standard_D11_v2", + "Standard_D12_v2", "Standard_L4s", "Dev(No SLA)_Standard_D11_v2", "Standard_E2a_v4", + "Standard_E4a_v4", "Standard_E8a_v4", "Standard_E16a_v4", "Standard_E8as_v4+1TB_PS", + "Standard_E8as_v4+2TB_PS", "Standard_E16as_v4+3TB_PS", "Standard_E16as_v4+4TB_PS", "Dev(No + SLA)_Standard_E2a_v4". + :type name: str or ~azure.mgmt.kusto.models.AzureSkuName + :param capacity: The number of instances of the cluster. + :type capacity: int + :param tier: Required. SKU tier. Possible values include: "Basic", "Standard". + :type tier: str or ~azure.mgmt.kusto.models.AzureSkuTier + """ + + _validation = { + 'name': {'required': True}, + 'tier': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Union[str, "AzureSkuName"], + tier: Union[str, "AzureSkuTier"], + capacity: Optional[int] = None, + **kwargs + ): + super(AzureSku, self).__init__(**kwargs) + self.name = name + self.capacity = capacity + self.tier = tier + + +class CheckNameRequest(msrest.serialization.Model): + """The result returned from a database check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Resource name. + :type name: str + :param type: Required. The type of resource, for instance Microsoft.Kusto/clusters/databases. + Possible values include: "Microsoft.Kusto/clusters", "Microsoft.Kusto/clusters/databases", + "Microsoft.Kusto/clusters/attachedDatabaseConfigurations", + "Microsoft.Kusto/clusters/principalAssignments", + "Microsoft.Kusto/clusters/databases/dataConnections", + "Microsoft.Kusto/clusters/databases/principalAssignments". + :type type: str or ~azure.mgmt.kusto.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + type: Union[str, "Type"], + **kwargs + ): + super(CheckNameRequest, self).__init__(**kwargs) + self.name = name + self.type = type + + +class CheckNameResult(msrest.serialization.Model): + """The result returned from a check name availability request. + + :param name_available: Specifies a Boolean value that indicates if the name is available. + :type name_available: bool + :param name: The name that was checked. + :type name: str + :param message: Message indicating an unavailable name due to a conflict, or a description of + the naming rules that are violated. + :type message: str + :param reason: Message providing the reason why the given name is invalid. Possible values + include: "Invalid", "AlreadyExists". + :type reason: str or ~azure.mgmt.kusto.models.Reason + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'reason': {'key': 'reason', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + name: Optional[str] = None, + message: Optional[str] = None, + reason: Optional[Union[str, "Reason"]] = None, + **kwargs + ): + super(CheckNameResult, self).__init__(**kwargs) + self.name_available = name_available + self.name = name + self.message = message + self.reason = reason + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from Kusto. + + :param code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :type code: str + :param message: A message describing the error, intended to be suitable for displaying in a + user interface. + :type message: str + :param target: The target of the particular error. For example, the name of the property in + error. + :type target: str + :param details: A list of additional details about the error. + :type details: list[~azure.mgmt.kusto.models.CloudErrorBody] + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[CloudErrorBody]'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[List["CloudErrorBody"]] = None, + **kwargs + ): + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + self.target = target + self.details = details + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class Cluster(TrackedResource): + """Class representing a Kusto cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + :param sku: Required. The SKU of the cluster. + :type sku: ~azure.mgmt.kusto.models.AzureSku + :param zones: The availability zones of the cluster. + :type zones: list[str] + :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", + "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". + :vartype state: str or ~azure.mgmt.kusto.models.State + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + :ivar uri: The cluster URI. + :vartype uri: str + :ivar data_ingestion_uri: The cluster data ingestion URI. + :vartype data_ingestion_uri: str + :ivar state_reason: The reason for the cluster's current state. + :vartype state_reason: str + :param trusted_external_tenants: The cluster's external tenants. + :type trusted_external_tenants: list[~azure.mgmt.kusto.models.TrustedExternalTenant] + :param optimized_autoscale: Optimized auto scale definition. + :type optimized_autoscale: ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.VirtualNetworkConfiguration + :param key_vault_properties: KeyVault properties for the cluster encryption. + :type key_vault_properties: ~azure.mgmt.kusto.models.KeyVaultProperties + :param enable_purge: A boolean value that indicates if the purge operations are enabled. + :type enable_purge: bool + :param value: The list of language extensions. + :type value: list[~azure.mgmt.kusto.models.LanguageExtension] + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type_identity_type: The identity type. Possible values include: "None", + "SystemAssigned". + :type type_identity_type: str or ~azure.mgmt.kusto.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, + ~azure.mgmt.kusto.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'sku': {'required': True}, + 'state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'uri': {'readonly': True}, + 'data_ingestion_uri': {'readonly': True}, + 'state_reason': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'AzureSku'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'uri': {'key': 'properties.uri', 'type': 'str'}, + 'data_ingestion_uri': {'key': 'properties.dataIngestionUri', 'type': 'str'}, + 'state_reason': {'key': 'properties.stateReason', 'type': 'str'}, + 'trusted_external_tenants': {'key': 'properties.trustedExternalTenants', 'type': '[TrustedExternalTenant]'}, + 'optimized_autoscale': {'key': 'properties.optimizedAutoscale', 'type': 'OptimizedAutoscale'}, + 'enable_disk_encryption': {'key': 'properties.enableDiskEncryption', 'type': 'bool'}, + 'enable_streaming_ingest': {'key': 'properties.enableStreamingIngest', 'type': 'bool'}, + 'virtual_network_configuration': {'key': 'properties.virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, + 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'KeyVaultProperties'}, + 'enable_purge': {'key': 'properties.enablePurge', 'type': 'bool'}, + 'value': {'key': 'properties.languageExtensions.value', 'type': '[LanguageExtension]'}, + 'principal_id': {'key': 'identity.principalId', 'type': 'str'}, + 'tenant_id': {'key': 'identity.tenantId', 'type': 'str'}, + 'type_identity_type': {'key': 'identity.type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'identity.userAssignedIdentities', 'type': '{ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + } + + def __init__( + self, + *, + location: str, + sku: "AzureSku", + tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, + trusted_external_tenants: Optional[List["TrustedExternalTenant"]] = None, + optimized_autoscale: Optional["OptimizedAutoscale"] = None, + enable_disk_encryption: Optional[bool] = None, + enable_streaming_ingest: Optional[bool] = False, + virtual_network_configuration: Optional["VirtualNetworkConfiguration"] = None, + key_vault_properties: Optional["KeyVaultProperties"] = None, + enable_purge: Optional[bool] = False, + value: Optional[List["LanguageExtension"]] = None, + type_identity_type: Optional[Union[str, "IdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + **kwargs + ): + super(Cluster, self).__init__(tags=tags, location=location, **kwargs) + self.sku = sku + self.zones = zones + self.state = None + self.provisioning_state = None + self.uri = None + self.data_ingestion_uri = None + self.state_reason = None + self.trusted_external_tenants = trusted_external_tenants + self.optimized_autoscale = optimized_autoscale + self.enable_disk_encryption = enable_disk_encryption + self.enable_streaming_ingest = enable_streaming_ingest + self.virtual_network_configuration = virtual_network_configuration + self.key_vault_properties = key_vault_properties + self.enable_purge = enable_purge + self.value = value + self.principal_id = None + self.tenant_id = None + self.type_identity_type = type_identity_type + self.user_assigned_identities = user_assigned_identities + + +class ClusterCheckNameRequest(msrest.serialization.Model): + """The result returned from a cluster check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Cluster name. + :type name: str + :param type: Required. The type of resource, Microsoft.Kusto/clusters. Possible values include: + "Microsoft.Kusto/clusters", "Microsoft.Kusto/clusters/databases", + "Microsoft.Kusto/clusters/attachedDatabaseConfigurations", + "Microsoft.Kusto/clusters/principalAssignments", + "Microsoft.Kusto/clusters/databases/dataConnections", + "Microsoft.Kusto/clusters/databases/principalAssignments". + :type type: str or ~azure.mgmt.kusto.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + type: Union[str, "Type"], + **kwargs + ): + super(ClusterCheckNameRequest, self).__init__(**kwargs) + self.name = name + self.type = type + + +class ClusterListResult(msrest.serialization.Model): + """The list Kusto clusters operation response. + + :param value: The list of Kusto clusters. + :type value: list[~azure.mgmt.kusto.models.Cluster] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Cluster]'}, + } + + def __init__( + self, + *, + value: Optional[List["Cluster"]] = None, + **kwargs + ): + super(ClusterListResult, self).__init__(**kwargs) + self.value = value + + +class ClusterPrincipalAssignment(ProxyResource): + """Class representing a cluster principal assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param principal_id: The principal ID assigned to the cluster principal. It can be a user + email, application ID, or security group name. + :type principal_id: str + :param role: Cluster principal role. Possible values include: "AllDatabasesAdmin", + "AllDatabasesViewer". + :type role: str or ~azure.mgmt.kusto.models.ClusterPrincipalRole + :param tenant_id: The tenant id of the principal. + :type tenant_id: str + :param principal_type: Principal type. Possible values include: "App", "Group", "User". + :type principal_type: str or ~azure.mgmt.kusto.models.PrincipalType + :ivar tenant_name: The tenant name of the principal. + :vartype tenant_name: str + :ivar principal_name: The principal name. + :vartype principal_name: str + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tenant_name': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, + 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, + 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + principal_id: Optional[str] = None, + role: Optional[Union[str, "ClusterPrincipalRole"]] = None, + tenant_id: Optional[str] = None, + principal_type: Optional[Union[str, "PrincipalType"]] = None, + **kwargs + ): + super(ClusterPrincipalAssignment, self).__init__(**kwargs) + self.principal_id = principal_id + self.role = role + self.tenant_id = tenant_id + self.principal_type = principal_type + self.tenant_name = None + self.principal_name = None + self.provisioning_state = None + + +class ClusterPrincipalAssignmentCheckNameRequest(msrest.serialization.Model): + """A principal assignment check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Principal Assignment resource name. + :type name: str + :param type: Required. The type of resource, Microsoft.Kusto/clusters/principalAssignments. + Possible values include: "Microsoft.Kusto/clusters", "Microsoft.Kusto/clusters/databases", + "Microsoft.Kusto/clusters/attachedDatabaseConfigurations", + "Microsoft.Kusto/clusters/principalAssignments", + "Microsoft.Kusto/clusters/databases/dataConnections", + "Microsoft.Kusto/clusters/databases/principalAssignments". + :type type: str or ~azure.mgmt.kusto.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + type: Union[str, "Type"], + **kwargs + ): + super(ClusterPrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) + self.name = name + self.type = type + + +class ClusterPrincipalAssignmentListResult(msrest.serialization.Model): + """The list Kusto cluster principal assignments operation response. + + :param value: The list of Kusto cluster principal assignments. + :type value: list[~azure.mgmt.kusto.models.ClusterPrincipalAssignment] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ClusterPrincipalAssignment]'}, + } + + def __init__( + self, + *, + value: Optional[List["ClusterPrincipalAssignment"]] = None, + **kwargs + ): + super(ClusterPrincipalAssignmentListResult, self).__init__(**kwargs) + self.value = value + + +class ClusterUpdate(Resource): + """Class representing an update to a Kusto cluster. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Resource location. + :type location: str + :param sku: The SKU of the cluster. + :type sku: ~azure.mgmt.kusto.models.AzureSku + :ivar state: The state of the resource. Possible values include: "Creating", "Unavailable", + "Running", "Deleting", "Deleted", "Stopping", "Stopped", "Starting", "Updating". + :vartype state: str or ~azure.mgmt.kusto.models.State + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + :ivar uri: The cluster URI. + :vartype uri: str + :ivar data_ingestion_uri: The cluster data ingestion URI. + :vartype data_ingestion_uri: str + :ivar state_reason: The reason for the cluster's current state. + :vartype state_reason: str + :param trusted_external_tenants: The cluster's external tenants. + :type trusted_external_tenants: list[~azure.mgmt.kusto.models.TrustedExternalTenant] + :param optimized_autoscale: Optimized auto scale definition. + :type optimized_autoscale: ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.VirtualNetworkConfiguration + :param key_vault_properties: KeyVault properties for the cluster encryption. + :type key_vault_properties: ~azure.mgmt.kusto.models.KeyVaultProperties + :param enable_purge: A boolean value that indicates if the purge operations are enabled. + :type enable_purge: bool + :param value: The list of language extensions. + :type value: list[~azure.mgmt.kusto.models.LanguageExtension] + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type_identity_type: The identity type. Possible values include: "None", + "SystemAssigned". + :type type_identity_type: str or ~azure.mgmt.kusto.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, + ~azure.mgmt.kusto.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'uri': {'readonly': True}, + 'data_ingestion_uri': {'readonly': True}, + 'state_reason': {'readonly': True}, + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'AzureSku'}, + 'state': {'key': 'properties.state', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'uri': {'key': 'properties.uri', 'type': 'str'}, + 'data_ingestion_uri': {'key': 'properties.dataIngestionUri', 'type': 'str'}, + 'state_reason': {'key': 'properties.stateReason', 'type': 'str'}, + 'trusted_external_tenants': {'key': 'properties.trustedExternalTenants', 'type': '[TrustedExternalTenant]'}, + 'optimized_autoscale': {'key': 'properties.optimizedAutoscale', 'type': 'OptimizedAutoscale'}, + 'enable_disk_encryption': {'key': 'properties.enableDiskEncryption', 'type': 'bool'}, + 'enable_streaming_ingest': {'key': 'properties.enableStreamingIngest', 'type': 'bool'}, + 'virtual_network_configuration': {'key': 'properties.virtualNetworkConfiguration', 'type': 'VirtualNetworkConfiguration'}, + 'key_vault_properties': {'key': 'properties.keyVaultProperties', 'type': 'KeyVaultProperties'}, + 'enable_purge': {'key': 'properties.enablePurge', 'type': 'bool'}, + 'value': {'key': 'properties.languageExtensions.value', 'type': '[LanguageExtension]'}, + 'principal_id': {'key': 'identity.principalId', 'type': 'str'}, + 'tenant_id': {'key': 'identity.tenantId', 'type': 'str'}, + 'type_identity_type': {'key': 'identity.type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'identity.userAssignedIdentities', 'type': '{ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + sku: Optional["AzureSku"] = None, + trusted_external_tenants: Optional[List["TrustedExternalTenant"]] = None, + optimized_autoscale: Optional["OptimizedAutoscale"] = None, + enable_disk_encryption: Optional[bool] = None, + enable_streaming_ingest: Optional[bool] = False, + virtual_network_configuration: Optional["VirtualNetworkConfiguration"] = None, + key_vault_properties: Optional["KeyVaultProperties"] = None, + enable_purge: Optional[bool] = False, + value: Optional[List["LanguageExtension"]] = None, + type_identity_type: Optional[Union[str, "IdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None, + **kwargs + ): + super(ClusterUpdate, self).__init__(**kwargs) + self.tags = tags + self.location = location + self.sku = sku + self.state = None + self.provisioning_state = None + self.uri = None + self.data_ingestion_uri = None + self.state_reason = None + self.trusted_external_tenants = trusted_external_tenants + self.optimized_autoscale = optimized_autoscale + self.enable_disk_encryption = enable_disk_encryption + self.enable_streaming_ingest = enable_streaming_ingest + self.virtual_network_configuration = virtual_network_configuration + self.key_vault_properties = key_vault_properties + self.enable_purge = enable_purge + self.value = value + self.principal_id = None + self.tenant_id = None + self.type_identity_type = type_identity_type + self.user_assigned_identities = user_assigned_identities + + +class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model): + """ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class Database(ProxyResource): + """Class representing a Kusto database. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: ReadOnlyFollowingDatabase, ReadWriteDatabase. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the database.Constant filled by server. Possible values + include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'ReadOnlyFollowing': 'ReadOnlyFollowingDatabase', 'ReadWrite': 'ReadWriteDatabase'} + } + + def __init__( + self, + *, + location: Optional[str] = None, + **kwargs + ): + super(Database, self).__init__(**kwargs) + self.location = location + self.kind = 'Database' + + +class DatabaseListResult(msrest.serialization.Model): + """The list Kusto databases operation response. + + :param value: The list of Kusto databases. + :type value: list[~azure.mgmt.kusto.models.Database] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Database]'}, + } + + def __init__( + self, + *, + value: Optional[List["Database"]] = None, + **kwargs + ): + super(DatabaseListResult, self).__init__(**kwargs) + self.value = value + + +class DatabasePrincipal(msrest.serialization.Model): + """A class representing database principal entity. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param role: Required. Database principal role. Possible values include: "Admin", "Ingestor", + "Monitor", "User", "UnrestrictedViewers", "Viewer". + :type role: str or ~azure.mgmt.kusto.models.DatabasePrincipalRole + :param name: Required. Database principal name. + :type name: str + :param type: Required. Database principal type. Possible values include: "App", "Group", + "User". + :type type: str or ~azure.mgmt.kusto.models.DatabasePrincipalType + :param fqn: Database principal fully qualified name. + :type fqn: str + :param email: Database principal email if exists. + :type email: str + :param app_id: Application id - relevant only for application principal type. + :type app_id: str + :ivar tenant_name: The tenant name of the principal. + :vartype tenant_name: str + """ + + _validation = { + 'role': {'required': True}, + 'name': {'required': True}, + 'type': {'required': True}, + 'tenant_name': {'readonly': True}, + } + + _attribute_map = { + 'role': {'key': 'role', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'fqn': {'key': 'fqn', 'type': 'str'}, + 'email': {'key': 'email', 'type': 'str'}, + 'app_id': {'key': 'appId', 'type': 'str'}, + 'tenant_name': {'key': 'tenantName', 'type': 'str'}, + } + + def __init__( + self, + *, + role: Union[str, "DatabasePrincipalRole"], + name: str, + type: Union[str, "DatabasePrincipalType"], + fqn: Optional[str] = None, + email: Optional[str] = None, + app_id: Optional[str] = None, + **kwargs + ): + super(DatabasePrincipal, self).__init__(**kwargs) + self.role = role + self.name = name + self.type = type + self.fqn = fqn + self.email = email + self.app_id = app_id + self.tenant_name = None + + +class DatabasePrincipalAssignment(ProxyResource): + """Class representing a database principal assignment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param principal_id: The principal ID assigned to the database principal. It can be a user + email, application ID, or security group name. + :type principal_id: str + :param role: Database principal role. Possible values include: "Admin", "Ingestor", "Monitor", + "User", "UnrestrictedViewers", "Viewer". + :type role: str or ~azure.mgmt.kusto.models.DatabasePrincipalRole + :param tenant_id: The tenant id of the principal. + :type tenant_id: str + :param principal_type: Principal type. Possible values include: "App", "Group", "User". + :type principal_type: str or ~azure.mgmt.kusto.models.PrincipalType + :ivar tenant_name: The tenant name of the principal. + :vartype tenant_name: str + :ivar principal_name: The principal name. + :vartype principal_name: str + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'tenant_name': {'readonly': True}, + 'principal_name': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'principal_id': {'key': 'properties.principalId', 'type': 'str'}, + 'role': {'key': 'properties.role', 'type': 'str'}, + 'tenant_id': {'key': 'properties.tenantId', 'type': 'str'}, + 'principal_type': {'key': 'properties.principalType', 'type': 'str'}, + 'tenant_name': {'key': 'properties.tenantName', 'type': 'str'}, + 'principal_name': {'key': 'properties.principalName', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + principal_id: Optional[str] = None, + role: Optional[Union[str, "DatabasePrincipalRole"]] = None, + tenant_id: Optional[str] = None, + principal_type: Optional[Union[str, "PrincipalType"]] = None, + **kwargs + ): + super(DatabasePrincipalAssignment, self).__init__(**kwargs) + self.principal_id = principal_id + self.role = role + self.tenant_id = tenant_id + self.principal_type = principal_type + self.tenant_name = None + self.principal_name = None + self.provisioning_state = None + + +class DatabasePrincipalAssignmentCheckNameRequest(msrest.serialization.Model): + """A principal assignment check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Principal Assignment resource name. + :type name: str + :param type: Required. The type of resource, + Microsoft.Kusto/clusters/databases/principalAssignments. Possible values include: + "Microsoft.Kusto/clusters", "Microsoft.Kusto/clusters/databases", + "Microsoft.Kusto/clusters/attachedDatabaseConfigurations", + "Microsoft.Kusto/clusters/principalAssignments", + "Microsoft.Kusto/clusters/databases/dataConnections", + "Microsoft.Kusto/clusters/databases/principalAssignments". + :type type: str or ~azure.mgmt.kusto.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + type: Union[str, "Type"], + **kwargs + ): + super(DatabasePrincipalAssignmentCheckNameRequest, self).__init__(**kwargs) + self.name = name + self.type = type + + +class DatabasePrincipalAssignmentListResult(msrest.serialization.Model): + """The list Kusto database principal assignments operation response. + + :param value: The list of Kusto database principal assignments. + :type value: list[~azure.mgmt.kusto.models.DatabasePrincipalAssignment] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DatabasePrincipalAssignment]'}, + } + + def __init__( + self, + *, + value: Optional[List["DatabasePrincipalAssignment"]] = None, + **kwargs + ): + super(DatabasePrincipalAssignmentListResult, self).__init__(**kwargs) + self.value = value + + +class DatabasePrincipalListRequest(msrest.serialization.Model): + """The list Kusto database principals operation request. + + :param value: The list of Kusto database principals. + :type value: list[~azure.mgmt.kusto.models.DatabasePrincipal] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DatabasePrincipal]'}, + } + + def __init__( + self, + *, + value: Optional[List["DatabasePrincipal"]] = None, + **kwargs + ): + super(DatabasePrincipalListRequest, self).__init__(**kwargs) + self.value = value + + +class DatabasePrincipalListResult(msrest.serialization.Model): + """The list Kusto database principals operation response. + + :param value: The list of Kusto database principals. + :type value: list[~azure.mgmt.kusto.models.DatabasePrincipal] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DatabasePrincipal]'}, + } + + def __init__( + self, + *, + value: Optional[List["DatabasePrincipal"]] = None, + **kwargs + ): + super(DatabasePrincipalListResult, self).__init__(**kwargs) + self.value = value + + +class DatabaseStatistics(msrest.serialization.Model): + """A class that contains database statistics information. + + :param size: The database size - the total size of compressed data and index in bytes. + :type size: float + """ + + _attribute_map = { + 'size': {'key': 'size', 'type': 'float'}, + } + + def __init__( + self, + *, + size: Optional[float] = None, + **kwargs + ): + super(DatabaseStatistics, self).__init__(**kwargs) + self.size = size + + +class DataConnection(ProxyResource): + """Class representing an data connection. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: EventGridDataConnection, EventHubDataConnection, IotHubDataConnection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'EventGrid': 'EventGridDataConnection', 'EventHub': 'EventHubDataConnection', 'IotHub': 'IotHubDataConnection'} + } + + def __init__( + self, + *, + location: Optional[str] = None, + **kwargs + ): + super(DataConnection, self).__init__(**kwargs) + self.location = location + self.kind = 'DataConnection' + + +class DataConnectionCheckNameRequest(msrest.serialization.Model): + """A data connection check name availability request. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Data Connection name. + :type name: str + :param type: Required. The type of resource, + Microsoft.Kusto/clusters/databases/dataConnections. Possible values include: + "Microsoft.Kusto/clusters", "Microsoft.Kusto/clusters/databases", + "Microsoft.Kusto/clusters/attachedDatabaseConfigurations", + "Microsoft.Kusto/clusters/principalAssignments", + "Microsoft.Kusto/clusters/databases/dataConnections", + "Microsoft.Kusto/clusters/databases/principalAssignments". + :type type: str or ~azure.mgmt.kusto.models.Type + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + type: Union[str, "Type"], + **kwargs + ): + super(DataConnectionCheckNameRequest, self).__init__(**kwargs) + self.name = name + self.type = type + + +class DataConnectionListResult(msrest.serialization.Model): + """The list Kusto data connections operation response. + + :param value: The list of Kusto data connections. + :type value: list[~azure.mgmt.kusto.models.DataConnection] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataConnection]'}, + } + + def __init__( + self, + *, + value: Optional[List["DataConnection"]] = None, + **kwargs + ): + super(DataConnectionListResult, self).__init__(**kwargs) + self.value = value + + +class DataConnectionValidation(msrest.serialization.Model): + """Class representing an data connection validation. + + :param data_connection_name: The name of the data connection. + :type data_connection_name: str + :param properties: The data connection properties to validate. + :type properties: ~azure.mgmt.kusto.models.DataConnection + """ + + _attribute_map = { + 'data_connection_name': {'key': 'dataConnectionName', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'DataConnection'}, + } + + def __init__( + self, + *, + data_connection_name: Optional[str] = None, + properties: Optional["DataConnection"] = None, + **kwargs + ): + super(DataConnectionValidation, self).__init__(**kwargs) + self.data_connection_name = data_connection_name + self.properties = properties + + +class DataConnectionValidationListResult(msrest.serialization.Model): + """The list Kusto data connection validation result. + + :param value: The list of Kusto data connection validation errors. + :type value: list[~azure.mgmt.kusto.models.DataConnectionValidationResult] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DataConnectionValidationResult]'}, + } + + def __init__( + self, + *, + value: Optional[List["DataConnectionValidationResult"]] = None, + **kwargs + ): + super(DataConnectionValidationListResult, self).__init__(**kwargs) + self.value = value + + +class DataConnectionValidationResult(msrest.serialization.Model): + """The result returned from a data connection validation request. + + :param error_message: A message which indicates a problem in data connection validation. + :type error_message: str + """ + + _attribute_map = { + 'error_message': {'key': 'errorMessage', 'type': 'str'}, + } + + def __init__( + self, + *, + error_message: Optional[str] = None, + **kwargs + ): + super(DataConnectionValidationResult, self).__init__(**kwargs) + self.error_message = error_message + + +class DiagnoseVirtualNetworkResult(msrest.serialization.Model): + """DiagnoseVirtualNetworkResult. + + :param findings: The list of network connectivity diagnostic finding. + :type findings: list[str] + """ + + _attribute_map = { + 'findings': {'key': 'findings', 'type': '[str]'}, + } + + def __init__( + self, + *, + findings: Optional[List[str]] = None, + **kwargs + ): + super(DiagnoseVirtualNetworkResult, self).__init__(**kwargs) + self.findings = findings + + +class EventGridDataConnection(DataConnection): + """Class representing an Event Grid data connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + :param storage_account_resource_id: The resource ID of the storage account where the data + resides. + :type storage_account_resource_id: str + :param event_hub_resource_id: The resource ID where the event grid is configured to send + events. + :type event_hub_resource_id: str + :param consumer_group: The event hub consumer group. + :type consumer_group: str + :param table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :type table_name: str + :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :type mapping_rule_name: str + :param data_format: The data format of the message. Optionally the data format can be added to + each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC". + :type data_format: str or ~azure.mgmt.kusto.models.EventGridDataFormat + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'storage_account_resource_id': {'key': 'properties.storageAccountResourceId', 'type': 'str'}, + 'event_hub_resource_id': {'key': 'properties.eventHubResourceId', 'type': 'str'}, + 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, + 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + storage_account_resource_id: Optional[str] = None, + event_hub_resource_id: Optional[str] = None, + consumer_group: Optional[str] = None, + table_name: Optional[str] = None, + mapping_rule_name: Optional[str] = None, + data_format: Optional[Union[str, "EventGridDataFormat"]] = None, + **kwargs + ): + super(EventGridDataConnection, self).__init__(location=location, **kwargs) + self.kind = 'EventGrid' + self.storage_account_resource_id = storage_account_resource_id + self.event_hub_resource_id = event_hub_resource_id + self.consumer_group = consumer_group + self.table_name = table_name + self.mapping_rule_name = mapping_rule_name + self.data_format = data_format + + +class EventHubDataConnection(DataConnection): + """Class representing an event hub data connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + :param event_hub_resource_id: The resource ID of the event hub to be used to create a data + connection. + :type event_hub_resource_id: str + :param consumer_group: The event hub consumer group. + :type consumer_group: str + :param table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :type table_name: str + :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :type mapping_rule_name: str + :param data_format: The data format of the message. Optionally the data format can be added to + each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC". + :type data_format: str or ~azure.mgmt.kusto.models.EventHubDataFormat + :param event_system_properties: System properties of the event hub. + :type event_system_properties: list[str] + :param compression: The event hub messages compression type. Possible values include: "None", + "GZip". + :type compression: str or ~azure.mgmt.kusto.models.Compression + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'event_hub_resource_id': {'key': 'properties.eventHubResourceId', 'type': 'str'}, + 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, + 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, + 'event_system_properties': {'key': 'properties.eventSystemProperties', 'type': '[str]'}, + 'compression': {'key': 'properties.compression', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + event_hub_resource_id: Optional[str] = None, + consumer_group: Optional[str] = None, + table_name: Optional[str] = None, + mapping_rule_name: Optional[str] = None, + data_format: Optional[Union[str, "EventHubDataFormat"]] = None, + event_system_properties: Optional[List[str]] = None, + compression: Optional[Union[str, "Compression"]] = None, + **kwargs + ): + super(EventHubDataConnection, self).__init__(location=location, **kwargs) + self.kind = 'EventHub' + self.event_hub_resource_id = event_hub_resource_id + self.consumer_group = consumer_group + self.table_name = table_name + self.mapping_rule_name = mapping_rule_name + self.data_format = data_format + self.event_system_properties = event_system_properties + self.compression = compression + + +class FollowerDatabaseDefinition(msrest.serialization.Model): + """A class representing follower database request. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :param cluster_resource_id: Required. Resource id of the cluster that follows a database owned + by this cluster. + :type cluster_resource_id: str + :param attached_database_configuration_name: Required. Resource name of the attached database + configuration in the follower cluster. + :type attached_database_configuration_name: str + :ivar database_name: The database name owned by this cluster that was followed. * in case + following all databases. + :vartype database_name: str + """ + + _validation = { + 'cluster_resource_id': {'required': True}, + 'attached_database_configuration_name': {'required': True}, + 'database_name': {'readonly': True}, + } + + _attribute_map = { + 'cluster_resource_id': {'key': 'clusterResourceId', 'type': 'str'}, + 'attached_database_configuration_name': {'key': 'attachedDatabaseConfigurationName', 'type': 'str'}, + 'database_name': {'key': 'databaseName', 'type': 'str'}, + } + + def __init__( + self, + *, + cluster_resource_id: str, + attached_database_configuration_name: str, + **kwargs + ): + super(FollowerDatabaseDefinition, self).__init__(**kwargs) + self.cluster_resource_id = cluster_resource_id + self.attached_database_configuration_name = attached_database_configuration_name + self.database_name = None + + +class FollowerDatabaseListResult(msrest.serialization.Model): + """The list Kusto database principals operation response. + + :param value: The list of follower database result. + :type value: list[~azure.mgmt.kusto.models.FollowerDatabaseDefinition] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[FollowerDatabaseDefinition]'}, + } + + def __init__( + self, + *, + value: Optional[List["FollowerDatabaseDefinition"]] = None, + **kwargs + ): + super(FollowerDatabaseListResult, self).__init__(**kwargs) + self.value = value + + +class IotHubDataConnection(DataConnection): + """Class representing an iot hub data connection. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the endpoint for the data connection.Constant filled by server. + Possible values include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + :param iot_hub_resource_id: The resource ID of the Iot hub to be used to create a data + connection. + :type iot_hub_resource_id: str + :param consumer_group: The iot hub consumer group. + :type consumer_group: str + :param table_name: The table where the data should be ingested. Optionally the table + information can be added to each message. + :type table_name: str + :param mapping_rule_name: The mapping rule to be used to ingest the data. Optionally the + mapping information can be added to each message. + :type mapping_rule_name: str + :param data_format: The data format of the message. Optionally the data format can be added to + each message. Possible values include: "MULTIJSON", "JSON", "CSV", "TSV", "SCSV", "SOHSV", + "PSV", "TXT", "RAW", "SINGLEJSON", "AVRO", "TSVE", "PARQUET", "ORC". + :type data_format: str or ~azure.mgmt.kusto.models.IotHubDataFormat + :param event_system_properties: System properties of the iot hub. + :type event_system_properties: list[str] + :param shared_access_policy_name: The name of the share access policy. + :type shared_access_policy_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'iot_hub_resource_id': {'key': 'properties.iotHubResourceId', 'type': 'str'}, + 'consumer_group': {'key': 'properties.consumerGroup', 'type': 'str'}, + 'table_name': {'key': 'properties.tableName', 'type': 'str'}, + 'mapping_rule_name': {'key': 'properties.mappingRuleName', 'type': 'str'}, + 'data_format': {'key': 'properties.dataFormat', 'type': 'str'}, + 'event_system_properties': {'key': 'properties.eventSystemProperties', 'type': '[str]'}, + 'shared_access_policy_name': {'key': 'properties.sharedAccessPolicyName', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + iot_hub_resource_id: Optional[str] = None, + consumer_group: Optional[str] = None, + table_name: Optional[str] = None, + mapping_rule_name: Optional[str] = None, + data_format: Optional[Union[str, "IotHubDataFormat"]] = None, + event_system_properties: Optional[List[str]] = None, + shared_access_policy_name: Optional[str] = None, + **kwargs + ): + super(IotHubDataConnection, self).__init__(location=location, **kwargs) + self.kind = 'IotHub' + self.iot_hub_resource_id = iot_hub_resource_id + self.consumer_group = consumer_group + self.table_name = table_name + self.mapping_rule_name = mapping_rule_name + self.data_format = data_format + self.event_system_properties = event_system_properties + self.shared_access_policy_name = shared_access_policy_name + + +class KeyVaultProperties(msrest.serialization.Model): + """Properties of the key vault. + + All required parameters must be populated in order to send to Azure. + + :param key_name: Required. The name of the key vault key. + :type key_name: str + :param key_version: Required. The version of the key vault key. + :type key_version: str + :param key_vault_uri: Required. The Uri of the key vault. + :type key_vault_uri: str + """ + + _validation = { + 'key_name': {'required': True}, + 'key_version': {'required': True}, + 'key_vault_uri': {'required': True}, + } + + _attribute_map = { + 'key_name': {'key': 'keyName', 'type': 'str'}, + 'key_version': {'key': 'keyVersion', 'type': 'str'}, + 'key_vault_uri': {'key': 'keyVaultUri', 'type': 'str'}, + } + + def __init__( + self, + *, + key_name: str, + key_version: str, + key_vault_uri: str, + **kwargs + ): + super(KeyVaultProperties, self).__init__(**kwargs) + self.key_name = key_name + self.key_version = key_version + self.key_vault_uri = key_vault_uri + + +class LanguageExtension(msrest.serialization.Model): + """The language extension object. + + :param language_extension_name: The language extension name. Possible values include: "PYTHON", + "R". + :type language_extension_name: str or ~azure.mgmt.kusto.models.LanguageExtensionName + """ + + _attribute_map = { + 'language_extension_name': {'key': 'languageExtensionName', 'type': 'str'}, + } + + def __init__( + self, + *, + language_extension_name: Optional[Union[str, "LanguageExtensionName"]] = None, + **kwargs + ): + super(LanguageExtension, self).__init__(**kwargs) + self.language_extension_name = language_extension_name + + +class LanguageExtensionsList(msrest.serialization.Model): + """The list of language extension objects. + + :param value: The list of language extensions. + :type value: list[~azure.mgmt.kusto.models.LanguageExtension] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[LanguageExtension]'}, + } + + def __init__( + self, + *, + value: Optional[List["LanguageExtension"]] = None, + **kwargs + ): + super(LanguageExtensionsList, self).__init__(**kwargs) + self.value = value + + +class ListResourceSkusResult(msrest.serialization.Model): + """List of available SKUs for a Kusto Cluster. + + :param value: The collection of available SKUs for an existing resource. + :type value: list[~azure.mgmt.kusto.models.AzureResourceSku] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AzureResourceSku]'}, + } + + def __init__( + self, + *, + value: Optional[List["AzureResourceSku"]] = None, + **kwargs + ): + super(ListResourceSkusResult, self).__init__(**kwargs) + self.value = value + + +class Operation(msrest.serialization.Model): + """A REST API operation. + + :param name: This is of the format {provider}/{resource}/{operation}. + :type name: str + :param display: The object that describes the operation. + :type display: ~azure.mgmt.kusto.models.OperationDisplay + :param origin: The intended executor of the operation. + :type origin: str + :param properties: Any object. + :type properties: object + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'object'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + properties: Optional[object] = None, + **kwargs + ): + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + self.properties = properties + + +class OperationDisplay(msrest.serialization.Model): + """The object that describes the operation. + + :param provider: Friendly name of the resource provider. + :type provider: str + :param operation: For example: read, write, delete. + :type operation: str + :param resource: The resource type on which the operation is performed. + :type resource: str + :param description: The friendly name of the operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + operation: Optional[str] = None, + resource: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.operation = operation + self.resource = resource + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. + + :param value: The list of operations supported by the resource provider. + :type value: list[~azure.mgmt.kusto.models.Operation] + :param next_link: The URL to get the next set of operation list results if there are any. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Operation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Operation"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class OptimizedAutoscale(msrest.serialization.Model): + """A class that contains the optimized auto scale definition. + + All required parameters must be populated in order to send to Azure. + + :param version: Required. The version of the template defined, for instance 1. + :type version: int + :param is_enabled: Required. A boolean value that indicate if the optimized autoscale feature + is enabled or not. + :type is_enabled: bool + :param minimum: Required. Minimum allowed instances count. + :type minimum: int + :param maximum: Required. Maximum allowed instances count. + :type maximum: int + """ + + _validation = { + 'version': {'required': True}, + 'is_enabled': {'required': True}, + 'minimum': {'required': True}, + 'maximum': {'required': True}, + } + + _attribute_map = { + 'version': {'key': 'version', 'type': 'int'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + } + + def __init__( + self, + *, + version: int, + is_enabled: bool, + minimum: int, + maximum: int, + **kwargs + ): + super(OptimizedAutoscale, self).__init__(**kwargs) + self.version = version + self.is_enabled = is_enabled + self.minimum = minimum + self.maximum = maximum + + +class ReadOnlyFollowingDatabase(Database): + """Class representing a read only following database. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the database.Constant filled by server. Possible values + include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + :ivar soft_delete_period: The time the data should be kept before it stops being accessible to + queries in TimeSpan. + :vartype soft_delete_period: ~datetime.timedelta + :param hot_cache_period: The time the data should be kept in cache for fast queries in + TimeSpan. + :type hot_cache_period: ~datetime.timedelta + :ivar statistics: The statistics of the database. + :vartype statistics: ~azure.mgmt.kusto.models.DatabaseStatistics + :ivar leader_cluster_resource_id: The name of the leader cluster. + :vartype leader_cluster_resource_id: str + :ivar attached_database_configuration_name: The name of the attached database configuration + cluster. + :vartype attached_database_configuration_name: str + :ivar principals_modification_kind: The principals modification kind of the database. Possible + values include: "Union", "Replace", "None". + :vartype principals_modification_kind: str or + ~azure.mgmt.kusto.models.PrincipalsModificationKind + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'soft_delete_period': {'readonly': True}, + 'statistics': {'readonly': True}, + 'leader_cluster_resource_id': {'readonly': True}, + 'attached_database_configuration_name': {'readonly': True}, + 'principals_modification_kind': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, + 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, + 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, + 'leader_cluster_resource_id': {'key': 'properties.leaderClusterResourceId', 'type': 'str'}, + 'attached_database_configuration_name': {'key': 'properties.attachedDatabaseConfigurationName', 'type': 'str'}, + 'principals_modification_kind': {'key': 'properties.principalsModificationKind', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + hot_cache_period: Optional[datetime.timedelta] = None, + **kwargs + ): + super(ReadOnlyFollowingDatabase, self).__init__(location=location, **kwargs) + self.kind = 'ReadOnlyFollowing' + self.provisioning_state = None + self.soft_delete_period = None + self.hot_cache_period = hot_cache_period + self.statistics = None + self.leader_cluster_resource_id = None + self.attached_database_configuration_name = None + self.principals_modification_kind = None + + +class ReadWriteDatabase(Database): + """Class representing a read write database. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param location: Resource location. + :type location: str + :param kind: Required. Kind of the database.Constant filled by server. Possible values + include: "ReadWrite", "ReadOnlyFollowing", "EventHub", "EventGrid", "IotHub". + :type kind: str or ~azure.mgmt.kusto.models.Kind + :ivar provisioning_state: The provisioned state of the resource. Possible values include: + "Running", "Creating", "Deleting", "Succeeded", "Failed", "Moving". + :vartype provisioning_state: str or ~azure.mgmt.kusto.models.ProvisioningState + :param soft_delete_period: The time the data should be kept before it stops being accessible to + queries in TimeSpan. + :type soft_delete_period: ~datetime.timedelta + :param hot_cache_period: The time the data should be kept in cache for fast queries in + TimeSpan. + :type hot_cache_period: ~datetime.timedelta + :ivar statistics: The statistics of the database. + :vartype statistics: ~azure.mgmt.kusto.models.DatabaseStatistics + :ivar is_followed: Indicates whether the database is followed. + :vartype is_followed: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'statistics': {'readonly': True}, + 'is_followed': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'soft_delete_period': {'key': 'properties.softDeletePeriod', 'type': 'duration'}, + 'hot_cache_period': {'key': 'properties.hotCachePeriod', 'type': 'duration'}, + 'statistics': {'key': 'properties.statistics', 'type': 'DatabaseStatistics'}, + 'is_followed': {'key': 'properties.isFollowed', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + soft_delete_period: Optional[datetime.timedelta] = None, + hot_cache_period: Optional[datetime.timedelta] = None, + **kwargs + ): + super(ReadWriteDatabase, self).__init__(location=location, **kwargs) + self.kind = 'ReadWrite' + self.provisioning_state = None + self.soft_delete_period = soft_delete_period + self.hot_cache_period = hot_cache_period + self.statistics = None + self.is_followed = None + + +class SkuDescription(msrest.serialization.Model): + """The Kusto SKU description of given resource type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_type: The resource type. + :vartype resource_type: str + :ivar name: The name of the SKU. + :vartype name: str + :ivar tier: The tier of the SKU. + :vartype tier: str + :ivar locations: The set of locations that the SKU is available. + :vartype locations: list[str] + :ivar location_info: Locations and zones. + :vartype location_info: list[~azure.mgmt.kusto.models.SkuLocationInfoItem] + :ivar restrictions: The restrictions because of which SKU cannot be used. + :vartype restrictions: list[object] + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'name': {'readonly': True}, + 'tier': {'readonly': True}, + 'locations': {'readonly': True}, + 'location_info': {'readonly': True}, + 'restrictions': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + 'location_info': {'key': 'locationInfo', 'type': '[SkuLocationInfoItem]'}, + 'restrictions': {'key': 'restrictions', 'type': '[object]'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuDescription, self).__init__(**kwargs) + self.resource_type = None + self.name = None + self.tier = None + self.locations = None + self.location_info = None + self.restrictions = None + + +class SkuDescriptionList(msrest.serialization.Model): + """The list of the EngagementFabric SKU descriptions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: SKU descriptions. + :vartype value: list[~azure.mgmt.kusto.models.SkuDescription] + """ + + _validation = { + 'value': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SkuDescription]'}, + } + + def __init__( + self, + **kwargs + ): + super(SkuDescriptionList, self).__init__(**kwargs) + self.value = None + + +class SkuLocationInfoItem(msrest.serialization.Model): + """The locations and zones info for SKU. + + All required parameters must be populated in order to send to Azure. + + :param location: Required. The available location of the SKU. + :type location: str + :param zones: The available zone of the SKU. + :type zones: list[str] + """ + + _validation = { + 'location': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'zones': {'key': 'zones', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: str, + zones: Optional[List[str]] = None, + **kwargs + ): + super(SkuLocationInfoItem, self).__init__(**kwargs) + self.location = location + self.zones = zones + + +class TrustedExternalTenant(msrest.serialization.Model): + """Represents a tenant ID that is trusted by the cluster. + + :param value: GUID representing an external tenant. + :type value: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + **kwargs + ): + super(TrustedExternalTenant, self).__init__(**kwargs) + self.value = value + + +class VirtualNetworkConfiguration(msrest.serialization.Model): + """A class that contains virtual network definition. + + All required parameters must be populated in order to send to Azure. + + :param subnet_id: Required. The subnet resource id. + :type subnet_id: str + :param engine_public_ip_id: Required. Engine service's public IP address resource id. + :type engine_public_ip_id: str + :param data_management_public_ip_id: Required. Data management's service public IP address + resource id. + :type data_management_public_ip_id: str + """ + + _validation = { + 'subnet_id': {'required': True}, + 'engine_public_ip_id': {'required': True}, + 'data_management_public_ip_id': {'required': True}, + } + + _attribute_map = { + 'subnet_id': {'key': 'subnetId', 'type': 'str'}, + 'engine_public_ip_id': {'key': 'enginePublicIpId', 'type': 'str'}, + 'data_management_public_ip_id': {'key': 'dataManagementPublicIpId', 'type': 'str'}, + } + + def __init__( + self, + *, + subnet_id: str, + engine_public_ip_id: str, + data_management_public_ip_id: str, + **kwargs + ): + super(VirtualNetworkConfiguration, self).__init__(**kwargs) + self.subnet_id = subnet_id + self.engine_public_ip_id = engine_public_ip_id + self.data_management_public_ip_id = data_management_public_ip_id diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/operations/__init__.py b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/__init__.py new file mode 100644 index 00000000000..5750cdc82c5 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/__init__.py @@ -0,0 +1,25 @@ +# 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 import ClusterOperations +from ._cluster_principal_assignment_operations import ClusterPrincipalAssignmentOperations +from ._database_operations import DatabaseOperations +from ._database_principal_assignment_operations import DatabasePrincipalAssignmentOperations +from ._attached_database_configuration_operations import AttachedDatabaseConfigurationOperations +from ._data_connection_operations import DataConnectionOperations +from ._operation_operations import OperationOperations + +__all__ = [ + 'ClusterOperations', + 'ClusterPrincipalAssignmentOperations', + 'DatabaseOperations', + 'DatabasePrincipalAssignmentOperations', + 'AttachedDatabaseConfigurationOperations', + 'DataConnectionOperations', + 'OperationOperations', +] 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 new file mode 100644 index 00000000000..b3d7d5b634b --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_attached_database_configuration_operations.py @@ -0,0 +1,408 @@ +# 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, 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: ~azure.mgmt.kusto.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: (...) -> "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: AttachedDatabaseConfigurationListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.AttachedDatabaseConfigurationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AttachedDatabaseConfigurationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_cluster.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + 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: ~azure.mgmt.kusto.models.AttachedDatabaseConfiguration + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.AttachedDatabaseConfiguration"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self.get.metadata['url'] + 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' + + # Construct and send request + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _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-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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: (...) -> "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 ~azure.mgmt.kusto.models.DefaultPrincipalsModificationKind + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns AttachedDatabaseConfiguration + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('AttachedDatabaseConfiguration', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._delete_initial.metadata['url'] + 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] + + # Construct and send request + 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}'} + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + attached_database_configuration_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns None + :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] + 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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} 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 new file mode 100644 index 00000000000..c3f93184c5c --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_operations.py @@ -0,0 +1,1591 @@ +# 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, 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: ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.Cluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self.get.metadata['url'] + 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' + + # Construct and send request + 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}'} + + 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["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] + value=None, # type: Optional[List["LanguageExtension"]] + type=None, # type: Optional[Union[str, "models.IdentityType"]] + user_assigned_identities=None, # type: Optional[Dict[str, "ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] + **kwargs # type: Any + ): + # type: (...) -> "models.Cluster" + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _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, value=value, type_identity_type=type, user_assigned_identities=user_assigned_identities) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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["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] + value=None, # type: Optional[List["LanguageExtension"]] + type=None, # type: Optional[Union[str, "models.IdentityType"]] + user_assigned_identities=None, # type: Optional[Dict[str, "ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] + **kwargs # type: Any + ): + # type: (...) -> "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: ~azure.mgmt.kusto.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[~azure.mgmt.kusto.models.TrustedExternalTenant] + :param optimized_autoscale: Optimized auto scale definition. + :type optimized_autoscale: ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.VirtualNetworkConfiguration + :param key_vault_properties: KeyVault properties for the cluster encryption. + :type key_vault_properties: ~azure.mgmt.kusto.models.KeyVaultProperties + :param enable_purge: A boolean value that indicates if the purge operations are enabled. + :type enable_purge: bool + :param value: The list of language extensions. + :type value: list[~azure.mgmt.kusto.models.LanguageExtension] + :param type: The identity type. + :type type: str or ~azure.mgmt.kusto.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, ~azure.mgmt.kusto.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns Cluster + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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, + value=value, + type=type, + user_assigned_identities=user_assigned_identities, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + 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["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] + value=None, # type: Optional[List["LanguageExtension"]] + type=None, # type: Optional[Union[str, "models.IdentityType"]] + user_assigned_identities=None, # type: Optional[Dict[str, "ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] + **kwargs # type: Any + ): + # type: (...) -> "models.Cluster" + cls = kwargs.pop('cls', None) # type: ClsType["models.Cluster"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _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, value=value, type_identity_type=type, user_assigned_identities=user_assigned_identities) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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["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] + value=None, # type: Optional[List["LanguageExtension"]] + type=None, # type: Optional[Union[str, "models.IdentityType"]] + user_assigned_identities=None, # type: Optional[Dict[str, "ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] + **kwargs # type: Any + ): + # type: (...) -> "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: ~azure.mgmt.kusto.models.AzureSku + :param trusted_external_tenants: The cluster's external tenants. + :type trusted_external_tenants: list[~azure.mgmt.kusto.models.TrustedExternalTenant] + :param optimized_autoscale: Optimized auto scale definition. + :type optimized_autoscale: ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.VirtualNetworkConfiguration + :param key_vault_properties: KeyVault properties for the cluster encryption. + :type key_vault_properties: ~azure.mgmt.kusto.models.KeyVaultProperties + :param enable_purge: A boolean value that indicates if the purge operations are enabled. + :type enable_purge: bool + :param value: The list of language extensions. + :type value: list[~azure.mgmt.kusto.models.LanguageExtension] + :param type: The identity type. + :type type: str or ~azure.mgmt.kusto.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, ~azure.mgmt.kusto.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns Cluster + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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, + value=value, + type=type, + user_assigned_identities=user_assigned_identities, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Cluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._delete_initial.metadata['url'] + 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] + + # Construct and send request + 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}'} + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns None + :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] + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._stop_initial.metadata['url'] + 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] + + # Construct and send request + 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'} + + def begin_stop( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns None + :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] + raw_result = self._stop_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._start_initial.metadata['url'] + 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] + + # Construct and send request + 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'} + + def begin_start( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns None + :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] + raw_result = self._start_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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'} + + def list_follower_database( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: FollowerDatabaseListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.FollowerDatabaseListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.FollowerDatabaseListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_follower_database.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + request = self._client.post(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'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _follower_database_to_remove = models.FollowerDatabaseDefinition(cluster_resource_id=cluster_resource_id, attached_database_configuration_name=attached_database_configuration_name) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._detach_follower_database_initial.metadata['url'] + 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') + + # Construct and send request + 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'} + + 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: (...) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns None + :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] + 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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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'} + + def _diagnose_virtual_network_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "models.DiagnoseVirtualNetworkResult" + cls = kwargs.pop('cls', None) # type: ClsType["models.DiagnoseVirtualNetworkResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._diagnose_virtual_network_initial.metadata['url'] + 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' + + # Construct and send request + 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'} + + def begin_diagnose_virtual_network( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns DiagnoseVirtualNetworkResult + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + raw_result = self._diagnose_virtual_network_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cls=lambda x,y,z: x, + **kwargs + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DiagnoseVirtualNetworkResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + 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 + 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'} + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: ClusterListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.ClusterListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> "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: ClusterListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.ClusterListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + def list_sku( + self, + **kwargs # type: Any + ): + # type: (...) -> "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: SkuDescriptionList or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.SkuDescriptionList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SkuDescriptionList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sku.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + 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 ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _cluster_name = models.ClusterCheckNameRequest(name=name, type=type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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' + + # Construct and send request + 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'} + + def list_sku_by_resource( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: ListResourceSkusResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.ListResourceSkusResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ListResourceSkusResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_sku_by_resource.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + def list_language_extension( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: LanguageExtensionsList or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.LanguageExtensionsList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.LanguageExtensionsList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_language_extension.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + request = self._client.post(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'} + + def _add_language_extension_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + value=None, # type: Optional[List["LanguageExtension"]] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _language_extensions_to_add = models.LanguageExtensionsList(value=value) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._add_language_extension_initial.metadata['url'] + 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') + + # Construct and send request + 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'} + + def begin_add_language_extension( + self, + resource_group_name, # type: str + cluster_name, # type: str + value=None, # type: Optional[List["LanguageExtension"]] + **kwargs # type: Any + ): + # type: (...) -> 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[~azure.mgmt.kusto.models.LanguageExtension] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :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] + 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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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'} + + def _remove_language_extension_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + value=None, # type: Optional[List["LanguageExtension"]] + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _language_extensions_to_remove = models.LanguageExtensionsList(value=value) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._remove_language_extension_initial.metadata['url'] + 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') + + # Construct and send request + 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'} + + def begin_remove_language_extension( + self, + resource_group_name, # type: str + cluster_name, # type: str + value=None, # type: Optional[List["LanguageExtension"]] + **kwargs # type: Any + ): + # type: (...) -> 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[~azure.mgmt.kusto.models.LanguageExtension] + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns None + :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] + 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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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'} 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 new file mode 100644 index 00000000000..4bb9028c622 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_principal_assignment_operations.py @@ -0,0 +1,474 @@ +# 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, 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: ~azure.mgmt.kusto.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 ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _principal_assignment_name = models.ClusterPrincipalAssignmentCheckNameRequest(name=name, type=type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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' + + # Construct and send request + 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'} + + 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: ~azure.mgmt.kusto.models.ClusterPrincipalAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterPrincipalAssignment"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self.get.metadata['url'] + 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' + + # Construct and send request + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.ClusterPrincipalAssignment(principal_id=principal_id, role=role, tenant_id=tenant_id, principal_type=principal_type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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: (...) -> "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 ~azure.mgmt.kusto.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 ~azure.mgmt.kusto.models.PrincipalType + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns ClusterPrincipalAssignment + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ClusterPrincipalAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._delete_initial.metadata['url'] + 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] + + # Construct and send request + 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}'} + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + principal_assignment_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns None + :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] + 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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + def list( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: ClusterPrincipalAssignmentListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.ClusterPrincipalAssignmentListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ClusterPrincipalAssignmentListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} 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 new file mode 100644 index 00000000000..781c8811769 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_data_connection_operations.py @@ -0,0 +1,681 @@ +# 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, 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: ~azure.mgmt.kusto.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: (...) -> "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: DataConnectionListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.DataConnectionListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnectionListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_database.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + def 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: (...) -> "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: ~azure.mgmt.kusto.models.DataConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DataConnectionValidationListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.DataConnectionValidationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnectionValidationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.DataConnectionValidation(data_connection_name=data_connection_name, properties=properties) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.data_connection_validation.metadata['url'] + 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' + + # Construct and send request + 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]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DataConnectionValidationListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + data_connection_validation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Kusto/clusters/{clusterName}/databases/{databaseName}/dataConnectionValidation'} + + 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 ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _data_connection_name = models.DataConnectionCheckNameRequest(name=name, type=type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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' + + # Construct and send request + 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'} + + 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: ~azure.mgmt.kusto.models.DataConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DataConnection"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self.get.metadata['url'] + 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' + + # Construct and send request + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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: (...) -> "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: ~azure.mgmt.kusto.models.DataConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns DataConnection + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DataConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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: (...) -> "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: ~azure.mgmt.kusto.models.DataConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns DataConnection + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DataConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._delete_initial.metadata['url'] + 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] + + # Construct and send request + 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}'} + + 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: (...) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns None + :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] + 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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} 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 new file mode 100644 index 00000000000..355d5fd9cbc --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_database_operations.py @@ -0,0 +1,794 @@ +# 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, 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: ~azure.mgmt.kusto.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 ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _resource_name = models.CheckNameRequest(name=name, type=type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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' + + # Construct and send request + 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'} + + def list_by_cluster( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: DatabaseListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.DatabaseListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabaseListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_cluster.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} + + 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: ~azure.mgmt.kusto.models.Database + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Database"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self.get.metadata['url'] + 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' + + # Construct and send request + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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: (...) -> "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: ~azure.mgmt.kusto.models.Database + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns Database + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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: (...) -> "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: ~azure.mgmt.kusto.models.Database + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns Database + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Database', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._delete_initial.metadata['url'] + 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] + + # Construct and send request + 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}'} + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns None + :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] + 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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + def list_principal( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: DatabasePrincipalListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.DatabasePrincipalListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_principal.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + request = self._client.post(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'} + + def add_principal( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + value=None, # type: Optional[List["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[~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.DatabasePrincipalListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _database_principals_to_add = models.DatabasePrincipalListRequest(value=value) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.add_principal.metadata['url'] + 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' + + # Construct and send request + 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'} + + def remove_principal( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + value=None, # type: Optional[List["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[~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.DatabasePrincipalListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _database_principals_to_remove = models.DatabasePrincipalListRequest(value=value) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.remove_principal.metadata['url'] + 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' + + # Construct and send request + 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'} 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 new file mode 100644 index 00000000000..4fe55c98aa3 --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_database_principal_assignment_operations.py @@ -0,0 +1,498 @@ +# 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, 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: ~azure.mgmt.kusto.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 ~azure.mgmt.kusto.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: ~azure.mgmt.kusto.models.CheckNameResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.CheckNameResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _principal_assignment_name = models.DatabasePrincipalAssignmentCheckNameRequest(name=name, type=type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.check_name_availability.metadata['url'] + 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' + + # Construct and send request + 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'} + + 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: ~azure.mgmt.kusto.models.DatabasePrincipalAssignment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalAssignment"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self.get.metadata['url'] + 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' + + # Construct and send request + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _parameters = models.DatabasePrincipalAssignment(principal_id=principal_id, role=role, tenant_id=tenant_id, principal_type=principal_type) + api_version = "2020-02-15" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self._create_or_update_initial.metadata['url'] + 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' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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: (...) -> "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 ~azure.mgmt.kusto.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 ~azure.mgmt.kusto.models.PrincipalType + :keyword callable cls: A custom type or function that will be passed the direct response + :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 + :return: An instance of LROPoller that returns DatabasePrincipalAssignment + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.kusto.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"] + 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 + ) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('DatabasePrincipalAssignment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + # Construct URL + url = self._delete_initial.metadata['url'] + 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] + + # Construct and send request + 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}'} + + 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: (...) -> 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 polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :return: An instance of LROPoller that returns None + :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] + 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 + ) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + lro_delay = kwargs.get( + 'polling_interval', + self._config.polling_interval + ) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + 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}'} + + def list( + self, + resource_group_name, # type: str + cluster_name, # type: str + database_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: DatabasePrincipalAssignmentListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.DatabasePrincipalAssignmentListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DatabasePrincipalAssignmentListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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) + else: + url = next_link + + # 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' + + # Construct and send request + 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'} 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 new file mode 100644 index 00000000000..0dccf9c0c3a --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_operation_operations.py @@ -0,0 +1,105 @@ +# 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, 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: ~azure.mgmt.kusto.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: (...) -> "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: OperationListResult or the result of cls(response) + :rtype: ~azure.mgmt.kusto.models.OperationListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.OperationListResult"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2020-02-15" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + else: + url = next_link + + # 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' + + # Construct and send request + 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'} diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/py.typed b/src/kusto/azext_kusto/vendored_sdks/kusto/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/kusto/azext_kusto/vendored_sdks/kusto/setup.py b/src/kusto/azext_kusto/vendored_sdks/kusto/setup.py new file mode 100644 index 00000000000..ef33e13c91d --- /dev/null +++ b/src/kusto/azext_kusto/vendored_sdks/kusto/setup.py @@ -0,0 +1,37 @@ +# 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/report.md b/src/kusto/report.md new file mode 100644 index 00000000000..57dc35ceb3f --- /dev/null +++ b/src/kusto/report.md @@ -0,0 +1,561 @@ +# Azure CLI Module Creation Report + +### kusto attached-database-configuration create + +create a kusto attached-database-configuration. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--attached-database-configuration-name**|string|The name of the attached database configuration.|attached_database_configuration_name| +|**--location**|string|Resource location.|location| +|**--database-name**|string|The name of the database which you would like to attach, use * if you want to follow all current and future databases.|database_name| +|**--cluster-resource-id**|string|The resource id of the cluster where the databases you would like to attach reside.|cluster_resource_id| +|**--default-principals-modification-kind**|choice|The default principals modification kind|default_principals_modification_kind| +### kusto attached-database-configuration delete + +delete a kusto attached-database-configuration. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--attached-database-configuration-name**|string|The name of the attached database configuration.|attached_database_configuration_name| +### kusto attached-database-configuration list + +list a kusto attached-database-configuration. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +### kusto attached-database-configuration show + +show a kusto attached-database-configuration. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--attached-database-configuration-name**|string|The name of the attached database configuration.|attached_database_configuration_name| +### kusto attached-database-configuration update + +create a kusto attached-database-configuration. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--attached-database-configuration-name**|string|The name of the attached database configuration.|attached_database_configuration_name| +|**--location**|string|Resource location.|location| +|**--database-name**|string|The name of the database which you would like to attach, use * if you want to follow all current and future databases.|database_name| +|**--cluster-resource-id**|string|The resource id of the cluster where the databases you would like to attach reside.|cluster_resource_id| +|**--default-principals-modification-kind**|choice|The default principals modification kind|default_principals_modification_kind| +### kusto cluster add-language-extension + +add-language-extension a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--value**|array|The list of language extensions.|value| +### kusto cluster create + +create a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--location**|string|The geo-location where the resource lives|location| +|**--sku**|object|The SKU of the cluster.|sku| +|**--tags**|dictionary|Resource tags.|tags| +|**--zones**|array|The availability zones of the cluster.|zones| +|**--trusted-external-tenants**|array|The cluster's external tenants.|trusted_external_tenants| +|**--optimized-autoscale**|object|Optimized auto scale definition.|optimized_autoscale| +|**--enable-disk-encryption**|boolean|A boolean value that indicates if the cluster's disks are encrypted.|enable_disk_encryption| +|**--enable-streaming-ingest**|boolean|A boolean value that indicates if the streaming ingest is enabled.|enable_streaming_ingest| +|**--virtual-network-configuration**|object|Virtual network definition.|virtual_network_configuration| +|**--key-vault-properties**|object|KeyVault properties for the cluster encryption.|key_vault_properties| +|**--enable-purge**|boolean|A boolean value that indicates if the purge operations are enabled.|enable_purge| +|**--language-extensions-value**|array|The list of language extensions.|value| +|**--identity-type**|sealed-choice|The identity type.|type_identity_type| +|**--identity-user-assigned-identities**|dictionary|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}'.|user_assigned_identities| +### kusto cluster delete + +delete a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +### kusto cluster detach-follower-database + +detach-follower-database a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--cluster-resource-id**|string|Resource id of the cluster that follows a database owned by this cluster.|cluster_resource_id| +|**--attached-database-configuration-name**|string|Resource name of the attached database configuration in the follower cluster.|attached_database_configuration_name| +### kusto cluster diagnose-virtual-network + +diagnose-virtual-network a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +### kusto cluster list + +list a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +### kusto cluster list-follower-database + +list-follower-database a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +### kusto cluster list-language-extension + +list-language-extension a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +### kusto cluster list-sku + +list-sku a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +### kusto cluster remove-language-extension + +remove-language-extension a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--value**|array|The list of language extensions.|value| +### kusto cluster show + +show a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +### kusto cluster start + +start a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +### kusto cluster stop + +stop a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +### kusto cluster update + +update a kusto cluster. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--tags**|dictionary|Resource tags.|tags| +|**--location**|string|Resource location.|location| +|**--sku**|object|The SKU of the cluster.|sku| +|**--trusted-external-tenants**|array|The cluster's external tenants.|trusted_external_tenants| +|**--optimized-autoscale**|object|Optimized auto scale definition.|optimized_autoscale| +|**--enable-disk-encryption**|boolean|A boolean value that indicates if the cluster's disks are encrypted.|enable_disk_encryption| +|**--enable-streaming-ingest**|boolean|A boolean value that indicates if the streaming ingest is enabled.|enable_streaming_ingest| +|**--virtual-network-configuration**|object|Virtual network definition.|virtual_network_configuration| +|**--key-vault-properties**|object|KeyVault properties for the cluster encryption.|key_vault_properties| +|**--enable-purge**|boolean|A boolean value that indicates if the purge operations are enabled.|enable_purge| +|**--language-extensions-value**|array|The list of language extensions.|value| +|**--identity-type**|sealed-choice|The identity type.|type_identity_type| +|**--identity-user-assigned-identities**|dictionary|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}'.|user_assigned_identities| +### kusto cluster-principal-assignment create + +create a kusto cluster-principal-assignment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--principal-assignment-name**|string|The name of the Kusto principalAssignment.|principal_assignment_name| +|**--principal-id**|string|The principal ID assigned to the cluster principal. It can be a user email, application ID, or security group name.|principal_id| +|**--role**|choice|Cluster principal role.|role| +|**--tenant-id**|string|The tenant id of the principal|tenant_id| +|**--principal-type**|choice|Principal type.|principal_type| +### kusto cluster-principal-assignment delete + +delete a kusto cluster-principal-assignment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--principal-assignment-name**|string|The name of the Kusto principalAssignment.|principal_assignment_name| +### kusto cluster-principal-assignment list + +list a kusto cluster-principal-assignment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +### kusto cluster-principal-assignment show + +show a kusto cluster-principal-assignment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--principal-assignment-name**|string|The name of the Kusto principalAssignment.|principal_assignment_name| +### kusto cluster-principal-assignment update + +create a kusto cluster-principal-assignment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--principal-assignment-name**|string|The name of the Kusto principalAssignment.|principal_assignment_name| +|**--principal-id**|string|The principal ID assigned to the cluster principal. It can be a user email, application ID, or security group name.|principal_id| +|**--role**|choice|Cluster principal role.|role| +|**--tenant-id**|string|The tenant id of the principal|tenant_id| +|**--principal-type**|choice|Principal type.|principal_type| +### kusto data-connection delete + +delete a kusto data-connection. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--data-connection-name**|string|The name of the data connection.|data_connection_name| +### kusto data-connection event-grid create + +event-grid create a kusto data-connection. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--data-connection-name**|string|The name of the data connection.|data_connection_name| +|**--location**|string|Resource location.|event_grid_location| +|**--storage-account-resource-id**|string|The resource ID of the storage account where the data resides.|event_grid_storage_account_resource_id| +|**--event-hub-resource-id**|string|The resource ID where the event grid is configured to send events.|event_grid_event_hub_resource_id| +|**--consumer-group**|string|The event hub consumer group.|event_grid_consumer_group| +|**--table-name**|string|The table where the data should be ingested. Optionally the table information can be added to each message.|event_grid_table_name| +|**--mapping-rule-name**|string|The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.|event_grid_mapping_rule_name| +### kusto data-connection event-grid data-connection-validation + +event-grid data-connection-validation a kusto data-connection. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--data-connection-name**|string|The name of the data connection.|data_connection_name| +|**--location**|string|Resource location.|event_grid_location| +|**--storage-account-resource-id**|string|The resource ID of the storage account where the data resides.|event_grid_storage_account_resource_id| +|**--event-hub-resource-id**|string|The resource ID where the event grid is configured to send events.|event_grid_event_hub_resource_id| +|**--consumer-group**|string|The event hub consumer group.|event_grid_consumer_group| +|**--table-name**|string|The table where the data should be ingested. Optionally the table information can be added to each message.|event_grid_table_name| +|**--mapping-rule-name**|string|The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.|event_grid_mapping_rule_name| +### kusto data-connection event-grid update + +event-grid update a kusto data-connection. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--data-connection-name**|string|The name of the data connection.|data_connection_name| +|**--location**|string|Resource location.|event_grid_location| +|**--storage-account-resource-id**|string|The resource ID of the storage account where the data resides.|event_grid_storage_account_resource_id| +|**--event-hub-resource-id**|string|The resource ID where the event grid is configured to send events.|event_grid_event_hub_resource_id| +|**--consumer-group**|string|The event hub consumer group.|event_grid_consumer_group| +|**--table-name**|string|The table where the data should be ingested. Optionally the table information can be added to each message.|event_grid_table_name| +|**--mapping-rule-name**|string|The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.|event_grid_mapping_rule_name| +### kusto data-connection event-hub create + +event-hub create a kusto data-connection. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--data-connection-name**|string|The name of the data connection.|data_connection_name| +|**--location**|string|Resource location.|event_hub_location| +|**--event-hub-resource-id**|string|The resource ID of the event hub to be used to create a data connection.|event_hub_event_hub_resource_id| +|**--consumer-group**|string|The event hub consumer group.|event_hub_consumer_group| +|**--table-name**|string|The table where the data should be ingested. Optionally the table information can be added to each message.|event_hub_table_name| +|**--mapping-rule-name**|string|The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.|event_hub_mapping_rule_name| +|**--data-format**|choice|The data format of the message. Optionally the data format can be added to each message.|event_hub_data_format| +|**--event-system-properties**|array|System properties of the event hub|event_hub_event_system_properties| +### kusto data-connection event-hub data-connection-validation + +event-hub data-connection-validation a kusto data-connection. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--data-connection-name**|string|The name of the data connection.|data_connection_name| +|**--location**|string|Resource location.|event_hub_location| +|**--event-hub-resource-id**|string|The resource ID of the event hub to be used to create a data connection.|event_hub_event_hub_resource_id| +|**--consumer-group**|string|The event hub consumer group.|event_hub_consumer_group| +|**--table-name**|string|The table where the data should be ingested. Optionally the table information can be added to each message.|event_hub_table_name| +|**--mapping-rule-name**|string|The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.|event_hub_mapping_rule_name| +|**--data-format**|choice|The data format of the message. Optionally the data format can be added to each message.|event_hub_data_format| +|**--event-system-properties**|array|System properties of the event hub|event_hub_event_system_properties| +### kusto data-connection event-hub update + +event-hub update a kusto data-connection. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--data-connection-name**|string|The name of the data connection.|data_connection_name| +|**--location**|string|Resource location.|event_hub_location| +|**--event-hub-resource-id**|string|The resource ID of the event hub to be used to create a data connection.|event_hub_event_hub_resource_id| +|**--consumer-group**|string|The event hub consumer group.|event_hub_consumer_group| +|**--table-name**|string|The table where the data should be ingested. Optionally the table information can be added to each message.|event_hub_table_name| +|**--mapping-rule-name**|string|The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.|event_hub_mapping_rule_name| +|**--data-format**|choice|The data format of the message. Optionally the data format can be added to each message.|event_hub_data_format| +|**--event-system-properties**|array|System properties of the event hub|event_hub_event_system_properties| +### kusto data-connection iot-hub create + +iot-hub create a kusto data-connection. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--data-connection-name**|string|The name of the data connection.|data_connection_name| +|**--location**|string|Resource location.|iot_hub_location| +|**--iot-hub-resource-id**|string|The resource ID of the Iot hub to be used to create a data connection.|iot_hub_iot_hub_resource_id| +|**--consumer-group**|string|The iot hub consumer group.|iot_hub_consumer_group| +|**--table-name**|string|The table where the data should be ingested. Optionally the table information can be added to each message.|iot_hub_table_name| +|**--mapping-rule-name**|string|The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.|iot_hub_mapping_rule_name| +|**--data-format**|choice|The data format of the message. Optionally the data format can be added to each message.|iot_hub_data_format| +|**--event-system-properties**|array|System properties of the iot hub|iot_hub_event_system_properties| +### kusto data-connection iot-hub data-connection-validation + +iot-hub data-connection-validation a kusto data-connection. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--data-connection-name**|string|The name of the data connection.|data_connection_name| +|**--location**|string|Resource location.|iot_hub_location| +|**--iot-hub-resource-id**|string|The resource ID of the Iot hub to be used to create a data connection.|iot_hub_iot_hub_resource_id| +|**--consumer-group**|string|The iot hub consumer group.|iot_hub_consumer_group| +|**--table-name**|string|The table where the data should be ingested. Optionally the table information can be added to each message.|iot_hub_table_name| +|**--mapping-rule-name**|string|The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.|iot_hub_mapping_rule_name| +|**--data-format**|choice|The data format of the message. Optionally the data format can be added to each message.|iot_hub_data_format| +|**--event-system-properties**|array|System properties of the iot hub|iot_hub_event_system_properties| +### kusto data-connection iot-hub update + +iot-hub update a kusto data-connection. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--data-connection-name**|string|The name of the data connection.|data_connection_name| +|**--location**|string|Resource location.|iot_hub_location| +|**--iot-hub-resource-id**|string|The resource ID of the Iot hub to be used to create a data connection.|iot_hub_iot_hub_resource_id| +|**--consumer-group**|string|The iot hub consumer group.|iot_hub_consumer_group| +|**--table-name**|string|The table where the data should be ingested. Optionally the table information can be added to each message.|iot_hub_table_name| +|**--mapping-rule-name**|string|The mapping rule to be used to ingest the data. Optionally the mapping information can be added to each message.|iot_hub_mapping_rule_name| +|**--data-format**|choice|The data format of the message. Optionally the data format can be added to each message.|iot_hub_data_format| +|**--event-system-properties**|array|System properties of the iot hub|iot_hub_event_system_properties| +### kusto data-connection list + +list a kusto data-connection. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +### kusto data-connection show + +show a kusto data-connection. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--data-connection-name**|string|The name of the data connection.|data_connection_name| +### kusto database add-principal + +add-principal a kusto database. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--value**|array|The list of Kusto database principals.|value| +### kusto database create + +create a kusto database. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--read-write-database**|object|Class representing a read write database.|read_write_database| +|**--read-only-following-database**|object|Class representing a read only following database.|read_only_following_database| +### kusto database delete + +delete a kusto database. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +### kusto database list + +list a kusto database. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +### kusto database list-principal + +list-principal a kusto database. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +### kusto database remove-principal + +remove-principal a kusto database. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--value**|array|The list of Kusto database principals.|value| +### kusto database show + +show a kusto database. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +### kusto database update + +update a kusto database. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--read-write-database**|object|Class representing a read write database.|read_write_database| +|**--read-only-following-database**|object|Class representing a read only following database.|read_only_following_database| +### kusto database-principal-assignment create + +create a kusto database-principal-assignment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--principal-assignment-name**|string|The name of the Kusto principalAssignment.|principal_assignment_name| +|**--principal-id**|string|The principal ID assigned to the database principal. It can be a user email, application ID, or security group name.|principal_id| +|**--role**|choice|Database principal role.|role| +|**--tenant-id**|string|The tenant id of the principal|tenant_id| +|**--principal-type**|choice|Principal type.|principal_type| +### kusto database-principal-assignment delete + +delete a kusto database-principal-assignment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--principal-assignment-name**|string|The name of the Kusto principalAssignment.|principal_assignment_name| +### kusto database-principal-assignment list + +list a kusto database-principal-assignment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +### kusto database-principal-assignment show + +show a kusto database-principal-assignment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--principal-assignment-name**|string|The name of the Kusto principalAssignment.|principal_assignment_name| +### kusto database-principal-assignment update + +create a kusto database-principal-assignment. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name| +|**--cluster-name**|string|The name of the Kusto cluster.|cluster_name| +|**--database-name**|string|The name of the database in the Kusto cluster.|database_name| +|**--principal-assignment-name**|string|The name of the Kusto principalAssignment.|principal_assignment_name| +|**--principal-id**|string|The principal ID assigned to the database principal. It can be a user email, application ID, or security group name.|principal_id| +|**--role**|choice|Database principal role.|role| +|**--tenant-id**|string|The tenant id of the principal|tenant_id| +|**--principal-type**|choice|Principal type.|principal_type| \ No newline at end of file diff --git a/src/kusto/setup.cfg b/src/kusto/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/kusto/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/kusto/setup.py b/src/kusto/setup.py new file mode 100644 index 00000000000..6bcb85dcd06 --- /dev/null +++ b/src/kusto/setup.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# -------------------------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages + +# TODO: Confirm this is the right version number you want and it matches your +# HISTORY.rst entry. +VERSION = '0.1.0' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +# TODO: Add any additional SDK dependencies here +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='kusto', + version=VERSION, + description='Microsoft Azure Command-Line Tools KustoManagementClient Extension', + # TODO: Update author and email, if applicable + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + # TODO: consider pointing directly to your source code instead of the generic repo + url='https://github.com/Azure/azure-cli-extensions', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_kusto': ['azext_metadata.json']}, +)