# --------------------------------------------------------------------------
# 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 .. import try_manual


# EXAMPLE: /AttachedDatabaseConfigurations/put/AttachedDatabaseConfigurationsCreateOrUpdate
@try_manual
def step_attached_database_configuration_create(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto attached-database-configuration create '
             '--name "{myAttachedDatabaseConfiguration}" '
             '--cluster-name "{myCluster1}" '
             '--location "westus2" '
             '--cluster-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Kusto/Clu'
             'sters/{myCluster}" '
             '--database-name "KustoDatabase" '
             '--default-principals-modification-kind "Union" '
             '--table-level-sharing-properties external-tables-to-exclude="ExternalTable2" '
             'external-tables-to-include="ExternalTable1" materialized-views-to-exclude="MaterializedViewTable2" '
             'materialized-views-to-include="MaterializedViewTable1" tables-to-exclude="Table2" '
             'tables-to-include="Table1" '
             '--resource-group "{rg}" ',
             checks=[])
    test.cmd('az kusto attached-database-configuration wait --created '
             '--name "{myAttachedDatabaseConfiguration}" '
             '--cluster-name "{myCluster1}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /AttachedDatabaseConfigurations/get/AttachedDatabaseConfigurationsGet
@try_manual
def step_attached_database_configuration_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto attached-database-configuration show '
             '--name "{myAttachedDatabaseConfiguration}" '
             '--cluster-name "{myCluster1}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /AttachedDatabaseConfigurations/get/KustoAttachedDatabaseConfigurationsListByCluster
@try_manual
def step_attached_database_configuration_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto attached-database-configuration list '
             '--cluster-name "{myCluster1}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/put/KustoClustersCreateOrUpdate
@try_manual
def step_cluster_create(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster create '
             '--name "{myCluster}" '
             '--type "SystemAssigned" '
             '--location "westus2" '
             '--allowed-ip-range-list "0.0.0.0/0" '
             '--enable-auto-stop true '
             '--enable-double-encryption false '
             '--enable-purge true '
             '--enable-streaming-ingest true '
             '--key-vault-properties key-name="" key-vault-uri="" key-version="" '
             '--sku name="Standard_E2a_v4" capacity=2 tier="Standard" '
             '--public-network-access "Enabled" '
             '--resource-group "{rg}" ',
             checks=[])
    test.cmd('az kusto cluster wait --created '
             '--name "{myCluster}" '
             '--resource-group "{rg}" ',
             checks=[])


@try_manual
def step_leader_cluster_create(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster create '
             '--name "{myCluster1}" '
             '--type "SystemAssigned" '
             '--location "westus2" '
             '--sku name="Standard_E2a_v4" capacity=2 tier="Standard" '
             '--resource-group "{rg}" ',
             checks=[])
    test.cmd('az kusto cluster wait --created '
             '--name "{myCluster1}" '
             '--resource-group "{rg}" ',
             checks=[])

# EXAMPLE: /Clusters/get/Get Kusto cluster outbound network dependencies


@try_manual
def step_cluster_list_outbound(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster list-outbound-network-dependency-endpoint '
             '--name "{myCluster}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/get/KustoClustersGet
@try_manual
def step_cluster_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster show '
             '--name "{myCluster}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/get/KustoClustersList
@try_manual
def step_cluster_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster list '
             '-g "" ',
             checks=checks)


# EXAMPLE: /Clusters/get/KustoClustersListByResourceGroup
@try_manual
def step_cluster_list_by_resource_group(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster list '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/get/KustoClustersListResourceSkus
@try_manual
def step_cluster_list_sku_by_resource_group(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster list-sku '
             '--name "{myCluster}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/get/KustoClustersListSkus
@try_manual
def step_cluster_list_sku(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster list-sku '
             '-g "" ',
             checks=checks)


# EXAMPLE: /Clusters/patch/KustoClustersUpdate
@try_manual
def step_cluster_update(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster update '
             '--name "{myCluster1}" '
             '--type "SystemAssigned" '
             '--location "westus2" '
             '--enable-auto-stop true '
             '--enable-purge true '
             '--enable-streaming-ingest true '
             '--engine-type "V3" '
             '--restrict-outbound-network-access "Disabled" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/post/KustoClusterAddLanguageExtensions
@try_manual
def step_cluster_add_language_extension(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster add-language-extension '
             '--name "{myCluster}" '
             '--value language-extension-name="PYTHON" '
             '--value language-extension-name="R" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/post/KustoClusterDetachFollowerDatabases
@try_manual
def step_cluster_detach_follower_database(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster detach-follower-database '
             '--name "{myCluster}" '
             '--attached-database-configuration-name "{myAttachedDatabaseConfiguration}" '
             '--cluster-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Kusto/clu'
             'sters/{myCluster1}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/post/KustoClusterDiagnoseVirtualNetwork
@try_manual
def step_cluster_diagnose_virtual_network(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster diagnose-virtual-network '
             '--name "{myCluster}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/post/KustoClusterListFollowerDatabases
@try_manual
def step_cluster_list_follower_database(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster list-follower-database '
             '--name "{myCluster}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/post/KustoClusterListLanguageExtensions
@try_manual
def step_cluster_list_language_extension(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster list-language-extension '
             '--name "{myCluster}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/post/KustoClusterRemoveLanguageExtensions
@try_manual
def step_cluster_remove_language_extension(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster remove-language-extension '
             '--name "{myCluster}" '
             '--value language-extension-name="PYTHON" '
             '--value language-extension-name="R" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/post/KustoClustersStart
@try_manual
def step_cluster_start(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster start '
             '--name "{myCluster1}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/post/KustoClustersStop
@try_manual
def step_cluster_stop(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster stop '
             '--name "{myCluster1}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /ClusterPrincipalAssignments/put/KustoClusterPrincipalAssignmentsCreateOrUpdate
@try_manual
def step_cluster_principal_assignment_create(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster-principal-assignment create '
             '--cluster-name "{myCluster}" '
             '--principal-assignment-name "testcli1" '
             '--principal-type "App" '
             '--principal-id "ad064aa1-8b51-41ec-9c64-0d3037577d63" '
             '--role "AllDatabasesAdmin" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /ClusterPrincipalAssignments/get/KustoClusterPrincipalAssignmentsGet
@try_manual
def step_cluster_principal_assignment_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster-principal-assignment show '
             '--cluster-name "{myCluster}" '
             '--principal-assignment-name "testcli1" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /ClusterPrincipalAssignments/get/KustoPrincipalAssignmentsList
@try_manual
def step_cluster_principal_assignment_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster-principal-assignment list '
             '--cluster-name "{myCluster}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /DatabasePrincipalAssignments/put/KustoDatabasePrincipalAssignmentsCreateOrUpdate
@try_manual
def step_database_principal_assignment_create(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto database-principal-assignment create '
             '--cluster-name "{myCluster}" '
             '--database-name "kustoDatabase" '
             '--role "Admin" '
             '--principal-type "App" '
             '--principal-id "ad064aa1-8b51-41ec-9c64-0d3037577d63" '
             '--principal-assignment-name "testcli1" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /DatabasePrincipalAssignments/get/KustoDatabasePrincipalAssignmentsGet
@try_manual
def step_database_principal_assignment_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto database-principal-assignment show '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--principal-assignment-name "testcli1" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /DatabasePrincipalAssignments/get/KustoPrincipalAssignmentsList
@try_manual
def step_database_principal_assignment_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto database-principal-assignment list '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /DatabasePrincipalAssignments/delete/KustoDatabasePrincipalAssignmentsDelete
@try_manual
def step_database_principal_assignment_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto database-principal-assignment delete -y '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--principal-assignment-name "testcli1" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Databases/put/Kusto ReadWrite database create or update
@try_manual
def step_database_create(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto database create '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--read-write-database location="westus2" soft-delete-period="P1D" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Databases/get/KustoDatabasesGet
@try_manual
def step_database_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto database show '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Databases/get/KustoDatabasesListByCluster
@try_manual
def step_database_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto database list '
             '--cluster-name "{myCluster}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Databases/patch/KustoDatabasesUpdate
@try_manual
def step_database_update(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto database update '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--read-write-database hot-cache-period="P1D" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Databases/post/KustoDatabaseAddPrincipals
@try_manual
def step_database_add_principal(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto database add-principal '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--value name="clitest" type="App" app-id="7bd74dc8-dd5f-4cee-8e64-866138abcf89" role="Admin" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Databases/post/KustoDatabaseListPrincipals
@try_manual
def step_database_list_principal(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto database list-principal '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Databases/post/KustoDatabaseRemovePrincipals
@try_manual
def step_database_remove_principal(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto database remove-principal '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--value name="clitest" type="App" app-id="7bd74dc8-dd5f-4cee-8e64-866138abcf89" role="Admin" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Databases/delete/KustoDatabasesDelete
@try_manual
def step_database_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto database delete -y '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /DataConnections/put/KustoDataConnectionsCreateOrUpdate
@try_manual
def step_data_connection_event_hub_create(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto data-connection event-hub create '
             '--cluster-name "{myCluster}" '
             '--name "{myDataConnection}" '
             '--database-name "KustoDatabase" '
             '--location "westus2" '
             '--consumer-group "$Default" '
             '--event-hub-resource-id "/subscriptions/{subscription_id}/resourceGroups/testrg/providers/Microsoft.EventHu'
             'b/namespaces/testcli/eventhubs/eventhubTest1" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /DataConnections/get/KustoDatabasesListByCluster
@try_manual
def step_data_connection_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto data-connection list '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /DataConnections/get/KustoDataConnectionsGet
@try_manual
def step_data_connection_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto data-connection show '
             '--cluster-name "{myCluster}" '
             '--name "{myDataConnection}" '
             '--database-name "KustoDatabase" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /DataConnections/patch/KustoDataConnectionsUpdate
@try_manual
def step_data_connection_event_hub_update(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto data-connection event-hub update '
             '--cluster-name "{myCluster}" '
             '--name "{myDataConnection}" '
             '--database-name "KustoDatabase" '
             '--location "westus2" '
             '--resource-group "{rg}" '
             '--consumer-group "$Default" '
             '--event-hub-resource-id "/subscriptions/{subscription_id}/resourceGroups/testrg/providers/Microsoft.EventHu'
             'b/namespaces/testcli/eventhubs/eventhubTest1" ',
             checks=checks)


# EXAMPLE: /DataConnections/post/KustoDataConnectionValidation
@try_manual
def step_data_connection_validation(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto data-connection event-hub data-connection-validation '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--name "{myDataConnection}" '
             '--consumer-group "$Default" '
             '--event-hub-resource-id "/subscriptions/{subscription_id}/resourceGroups/testrg/providers/Microsoft.EventHu'
             'b/namespaces/testcli/eventhubs/eventhubTest1" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /DataConnections/delete/KustoDataConnectionsDelete
@try_manual
def step_data_connection_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto data-connection delete -y '
             '--cluster-name "{myCluster}" '
             '--name "{myDataConnection}" '
             '--database-name "KustoDatabase" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /ManagedPrivateEndpoints/put/KustoManagedPrivateEndpointsCreateOrUpdate
@try_manual
def step_managed_private_endpoint_create(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto managed-private-endpoint create '
             '--cluster-name "{myCluster}" '
             '--name "{myManagedPrivateEndpoint}" '
             '--group-id "blob" '
             '--private-link-resource-id "/subscriptions/{subscription_id}/resourceGroups/testrg/providers/Microsoft.Stor'
             'age/storageAccounts/clisatest" '
             '--request-message "Please Approve." '
             '--resource-group "{rg}" ',
             checks=[])
    test.cmd('az kusto managed-private-endpoint wait --created '
             '--cluster-name "{myCluster}" '
             '--name "{myManagedPrivateEndpoint}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /ManagedPrivateEndpoints/get/KustoManagedPrivateEndpointsGet
@try_manual
def step_managed_private_endpoint_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto managed-private-endpoint show '
             '--cluster-name "{myCluster}" '
             '--name "{myManagedPrivateEndpoint}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /ManagedPrivateEndpoints/get/KustoManagedPrivateEndpointsList
@try_manual
def step_managed_private_endpoint_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto managed-private-endpoint list '
             '--cluster-name "{myCluster}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /ManagedPrivateEndpoints/patch/KustoManagedPrivateEndpointsUpdate
@try_manual
def step_managed_private_endpoint_update(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto managed-private-endpoint update '
             '--cluster-name "{myCluster}" '
             '--name "{myManagedPrivateEndpoint}" '
             '--group-id "blob" '
             '--private-link-resource-id "/subscriptions/{subscription_id}/resourceGroups/testrg/providers/Microsoft.Stor'
             'age/storageAccounts/clisatest" '
             '--request-message "Please Approve." '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /ManagedPrivateEndpoints/delete/ManagedPrivateEndpointsDelete
@try_manual
def step_managed_private_endpoint_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto managed-private-endpoint delete -y '
             '--cluster-name "{myCluster}" '
             '--name "{myManagedPrivateEndpoint}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Clusters/delete/KustoClustersDelete
@try_manual
def step_cluster_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster delete -y '
             '--name "{myCluster1}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /AttachedDatabaseConfigurations/delete/AttachedDatabaseConfigurationsDelete
@try_manual
def step_attached_database_configuration_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto attached-database-configuration delete -y '
             '--name "{myAttachedDatabaseConfiguration}" '
             '--cluster-name "{myCluster}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /ClusterPrincipalAssignments/delete/KustoClusterPrincipalAssignmentsDelete
@try_manual
def step_cluster_principal_assignment_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto cluster-principal-assignment delete -y '
             '--cluster-name "{myCluster}" '
             '--principal-assignment-name "testcli1" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /OperationsResults/get/KustoOperationResultsGet
@try_manual
def step_operation_result_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto operation-result show '
             '--operation-id "30972f1b-b61d-4fd8-bd34-3dcfa24670f3" '
             '--location "westus2" ',
             checks=checks)


# EXAMPLE: /OperationsResultsLocation/get/KustoOperationsResultsLocationGet
@try_manual
def step_operation_result_location_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto operation-result-location show '
             '--operation-id "30972f1b-b61d-4fd8-bd34-3dcfa24670f3" '
             '--location "westus"',
             checks=checks)


# EXAMPLE: /PrivateEndpointConnections/put/Approve or reject a private endpoint connection with a given name.
@try_manual
def step_private_endpoint_connection_create(test, checks=None):
    test.cmd('az network private-endpoint create '
             '-n "{myPrivateEndpoint}" '
             '-g "testrg" '
             '--group-id "cluster" '
             '--manual-request true '
             '--subnet "/subscriptions/{subscription_id}/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/MyVnet/subnets/MySubnet" '
             '--private-connection-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Kusto/Clusters/{myCluster}" '
             '--connection-name "test"',
             checks=checks)
    step_private_endpoint_connection_list(test)
    test.cmd('az kusto private-endpoint-connection create '
             '--cluster-name "{myCluster}" '
             '--private-link-service-connection-state description="Approved by test" status="Approved" '
             '--name "{myPrivateEndpointConnection}" '
             '--resource-group "{rg}"',
             checks=[])
    test.cmd('az kusto private-endpoint-connection wait --created '
             '--cluster-name "{myCluster}" '
             '--name "{myPrivateEndpointConnection}" '
             '--resource-group "{rg}"',
             checks=checks)

# EXAMPLE: /PrivateEndpointConnections/get/Gets private endpoint connection.


@try_manual
def step_private_endpoint_connection_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto private-endpoint-connection show '
             '--cluster-name "{myCluster}" '
             '--name "{myPrivateEndpointConnection}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /PrivateEndpointConnections/get/KustoPrivateEndpointConnectionsList
@try_manual
def step_private_endpoint_connection_list(test, checks=None):
    if checks is None:
        checks = []
    myPrivateEndpointConnectionRes = test.cmd('az kusto private-endpoint-connection list '
                                              '--cluster-name "{myCluster}" '
                                              '--resource-group "{rg}" ',
                                              checks=checks).get_output_in_json()
    print(myPrivateEndpointConnectionRes[0]["name"])
    test.kwargs.update({
        'myPrivateEndpointConnection': myPrivateEndpointConnectionRes[0]["name"]
    })


# EXAMPLE: /PrivateEndpointConnections/delete/Deletes a private endpoint connection with a given name.
@try_manual
def step_private_endpoint_connection_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto private-endpoint-connection delete -y '
             '--cluster-name "{myCluster}" '
             '--name "{myPrivateEndpointConnection}" '
             '--resource-group "{rg}" ',
             checks=checks)

# EXAMPLE: /PrivateLinkResources/get/Gets private endpoint connection.


@try_manual
def step_private_link_resource_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto private-link-resource show '
             '--cluster-name "{myCluster}" '
             '--name "cluster" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /PrivateLinkResources/get/Gets private endpoint connections.
@try_manual
def step_private_link_resource_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto private-link-resource list '
             '--cluster-name "{myCluster}" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Scripts/put/KustoScriptsCreateOrUpdate
@try_manual
def step_script_create(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto script create '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--continue-on-errors true '
             '--script-url "https://clisatest.blob.core.windows.net/kustosa/kustoscript.txt" '
             '--script-url-sas-token "sp=r&st=2021-10-10T13:27:37Z&se=2024-09-06T21:27:37Z&sv=2020-08-04&sr=b&sig=bQv3g3VpesJ3nv9Fbs%2Bc0V0PQby9AY%2BFLzQBxk5a9us%3D" '
             '--resource-group "{rg}" '
             '--name "{myScript}" ',
             checks=[])
    test.cmd('az kusto script wait --created '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--resource-group "{rg}" '
             '--name "{myScript}" ',
             checks=checks)


# EXAMPLE: /Scripts/get/KustoScriptsGet
@try_manual
def step_script_show(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto script show '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--resource-group "{rg}" '
             '--name "{myScript}" ',
             checks=checks)


# EXAMPLE: /Scripts/get/KustoScriptsList
@try_manual
def step_script_list(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto script list '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--resource-group "{rg}" ',
             checks=checks)


# EXAMPLE: /Scripts/patch/KustoScriptsUpdate
@try_manual
def step_script_update(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto script update '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--continue-on-errors true '
             '--script-url "https://clisatest.blob.core.windows.net/kustosa/kustoscript.txt" '
             '--script-url-sas-token "sp=r&st=2021-10-10T13:27:37Z&se=2024-09-06T21:27:37Z&sv=2020-08-04&sr=b&sig=bQv3g3VpesJ3nv9Fbs%2Bc0V0PQby9AY%2BFLzQBxk5a9us%3D" '
             '--resource-group "{rg}" '
             '--name "{myScript}" ',
             checks=checks)


# EXAMPLE: /Scripts/delete/KustoScriptsDelete
@try_manual
def step_script_delete(test, checks=None):
    if checks is None:
        checks = []
    test.cmd('az kusto script delete -y '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--resource-group "{rg}" '
             '--name "{myScript}" ',
             checks=[])
    test.cmd('az kusto script wait --deleted '
             '--cluster-name "{myCluster}" '
             '--database-name "KustoDatabase" '
             '--resource-group "{rg}" '
             '--name "{myScript}" ',
             checks=checks)
