Skip to content

Commit

Permalink
Update from master
Browse files Browse the repository at this point in the history
  • Loading branch information
SDK Automation committed Aug 13, 2020
1 parent 44ed22a commit 002b9c9
Show file tree
Hide file tree
Showing 18 changed files with 3,145 additions and 3,691 deletions.
104 changes: 71 additions & 33 deletions src/kusto/azext_kusto/generated/_help.py

Large diffs are not rendered by default.

83 changes: 47 additions & 36 deletions src/kusto/azext_kusto/generated/_params.py

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/kusto/azext_kusto/generated/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ def kusto_cluster_create(client,
identity_type=None,
identity_user_assigned_identities=None,
no_wait=False):
if enable_streaming_ingest is None:
if enable_streaming_ingest == None:
enable_streaming_ingest = False
if enable_purge is None:
if enable_purge == None:
enable_purge = False
if enable_double_encryption is None:
if enable_double_encryption == None:
enable_double_encryption = False
if isinstance(identity_user_assigned_identities, str):
identity_user_assigned_identities = json.loads(identity_user_assigned_identities)
Expand Down Expand Up @@ -91,11 +91,11 @@ def kusto_cluster_update(client,
identity_type=None,
identity_user_assigned_identities=None,
no_wait=False):
if enable_streaming_ingest is None:
if enable_streaming_ingest == None:
enable_streaming_ingest = False
if enable_purge is None:
if enable_purge == None:
enable_purge = False
if enable_double_encryption is None:
if enable_double_encryption == None:
enable_double_encryption = False
if isinstance(identity_user_assigned_identities, str):
identity_user_assigned_identities = json.loads(identity_user_assigned_identities)
Expand Down
485 changes: 143 additions & 342 deletions src/kusto/azext_kusto/manual/_help.py

Large diffs are not rendered by default.

573 changes: 0 additions & 573 deletions src/kusto/azext_kusto/manual/_params.py

This file was deleted.

881 changes: 0 additions & 881 deletions src/kusto/azext_kusto/manual/custom.py

This file was deleted.

4,360 changes: 2,699 additions & 1,661 deletions src/kusto/azext_kusto/manual/tests/latest/recordings/test_kusto.yaml

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions src/kusto/azext_kusto/manual/tests/latest/test_kusto_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ def step_kustoclusterscreateorupdate2(test, rg):
test.cmd('az kusto cluster create '
'--cluster-name "{Clusters_2}" '
'--identity-type "SystemAssigned" '
'--location "southcentralus" '
'--location "westus" '
'--enable-purge true '
'--enable-streaming-ingest true '
'--key-vault-properties key-name="" key-vault-uri="" key-version="" '
'--sku name="Standard_D11_v2" capacity=2 tier="Standard" '
'--sku name="Standard_L8s" capacity=2 tier="Standard" '
'--resource-group "{rg}"',
checks=[])

Expand All @@ -46,11 +46,11 @@ def step_kustoclusterscreateorupdate(test, rg):
test.cmd('az kusto cluster create '
'--cluster-name "{Clusters_3}" '
'--identity-type "SystemAssigned" '
'--location "southcentralus" '
'--location "westus" '
'--enable-purge true '
'--enable-streaming-ingest true '
'--key-vault-properties key-name="" key-vault-uri="" key-version="" '
'--sku name="Standard_D11_v2" capacity=2 tier="Standard" '
'--sku name="Standard_L8s" capacity=2 tier="Standard" '
'--resource-group "{rg}"',
checks=[])
test.cmd('az kusto cluster wait --created '
Expand Down Expand Up @@ -130,7 +130,7 @@ def step_kustodatabasescreateorupdate(test, rg):
test.cmd('az kusto database create '
'--cluster-name "{Clusters_3}" '
'--database-name "KustoDatabase8" '
'--read-write-database location="southcentralus" soft-delete-period="P1D" '
'--read-write-database location="westus" soft-delete-period="P1D" '
'--resource-group "{rg}"',
checks=[])

Expand All @@ -155,8 +155,8 @@ def step_kustodatabaseslistbycluster(test, rg):
@try_manual
def step_kustodatabasesget(test, rg):
test.cmd('az kusto database show '
'--database-name "KustoDatabase8" '
'--cluster-name "{Clusters_3}" '
'--database-name "KustoDatabase8" '
'--resource-group "{rg}"',
checks=[])

Expand Down Expand Up @@ -260,7 +260,7 @@ def step_attacheddatabaseconfigurationscreateorupdate(test, rg):
test.cmd('az kusto attached-database-configuration create '
'--attached-database-configuration-name "{attachedDatabaseConfigurations_1}" '
'--cluster-name "{Clusters_2}" '
'--location "southcentralus" '
'--location "westus" '
'--cluster-resource-id "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.Kusto/Clu'
'sters/{Clusters_3}" '
'--database-name "Kustodatabase8" '
Expand Down Expand Up @@ -348,7 +348,7 @@ def step_kustodataconnectionvalidation(test, rg):
'--database-name "KustoDatabase8" '
'--data-connection-name "{DataConnections8}" '
'--consumer-group "$Default" '
'--event-hub-resource-id "/subscriptions/11d5f159-a21d-4a6c-8053-c3aae30057cf/resourceGroups/RPTestResourceGroupDoNotDelete/providers/Microsoft.EventHub/namespaces/RpTestEventHubNamespaceDoNotDelete/eventhubs/rptesteventhub" '
'--event-hub-resource-id "/subscriptions/fbccad30-f0ed-4ac4-9497-93bf6141062f/resourceGroups/cliautogeneration-rg/providers/Microsoft.EventHub/namespaces/cliautogeneration/eventhubs/cliautogeneration-evenhub" '
'--resource-group "{rg}"',
checks=[])

Expand All @@ -360,9 +360,9 @@ def step_kustodataconnectionscreateorupdate(test, rg):
'--cluster-name "{Clusters_3}" '
'--data-connection-name "{DataConnections8}" '
'--database-name "KustoDatabase8" '
'--location "southcentralus" '
'--location "westus" '
'--consumer-group "$Default" '
'--event-hub-resource-id "/subscriptions/11d5f159-a21d-4a6c-8053-c3aae30057cf/resourceGroups/RPTestResourceGroupDoNotDelete/providers/Microsoft.EventHub/namespaces/RpTestEventHubNamespaceDoNotDelete/eventhubs/rptesteventhub" '
'--event-hub-resource-id "/subscriptions/fbccad30-f0ed-4ac4-9497-93bf6141062f/resourceGroups/cliautogeneration-rg/providers/Microsoft.EventHub/namespaces/cliautogeneration/eventhubs/cliautogeneration-evenhub" '
'--resource-group "{rg}"',
checks=[])

Expand All @@ -385,9 +385,9 @@ def step_kustodataconnectionsupdate(test, rg):
'--cluster-name "{Clusters_3}" '
'--data-connection-name "{DataConnections8}" '
'--database-name "KustoDatabase8" '
'--location "southcentralus" '
'--location "westus" '
'--consumer-group "$Default" '
'--event-hub-resource-id "/subscriptions/11d5f159-a21d-4a6c-8053-c3aae30057cf/resourceGroups/RPTestResourceGroupDoNotDelete/providers/Microsoft.EventHub/namespaces/RpTestEventHubNamespaceDoNotDelete/eventhubs/rptesteventhub" '
'--event-hub-resource-id "/subscriptions/fbccad30-f0ed-4ac4-9497-93bf6141062f/resourceGroups/cliautogeneration-rg/providers/Microsoft.EventHub/namespaces/cliautogeneration/eventhubs/cliautogeneration-evenhub" '
'--resource-group "{rg}"',
checks=[])

Expand All @@ -413,7 +413,6 @@ def call_scenario(test, rg):
setup(test, rg)
step_kustoclusterscreateorupdate2(test, rg)
step_kustoclusterscreateorupdate(test, rg)
step_kustodatabasescreateorupdate(test, rg)
step_kustoclusterschecknameavailability(test, rg)
step_kustoclustersget(test, rg)
step_kustoclusterslist(test, rg)
Expand Down Expand Up @@ -442,6 +441,8 @@ def call_scenario(test, rg):
step_kustodataconnectionsupdate(test, rg)
step_kustodataconnectionsdelete(test, rg)
step_kustooperationslist(test, rg)
step_kustoclustersstop(test, rg)
step_kustoclustersstart(test, rg)
step_kustodatabasesdelete(test, rg)
step_kustoclustersdelete(test, rg)
cleanup(test, rg)
Expand All @@ -458,8 +459,8 @@ def test_kusto(self, rg):
})

self.kwargs.update({
'Clusters_2': 'followercluster100',
'Clusters_3': 'leadercluster100',
'Clusters_2': 'testcliclusterfollower',
'Clusters_3': 'testcliclusterleader',
'attachedDatabaseConfigurations_1': 'attachedDatabaseConfigurations2',
'DataConnections8': 'DataConnections8',
})
Expand Down
159 changes: 159 additions & 0 deletions src/kusto/azext_kusto/tests/latest/preparers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
# --------------------------------------------------------------------------
# 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_devtools.scenario_tests import SingleValueReplacer
from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer
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'
KEY_VNET_NIC = 'nic'


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, **_):
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 {} --subnet-name default --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, **_):
# 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_key=KEY_RESOURCE_GROUP,
vnet_key=KEY_VIRTUAL_NETWORK,
address_prefixes="11.0.0.0/24",
dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME',
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, 15)
self.cli_ctx = get_dummy_cli()
self.parameter_name = parameter_name
self.key = key
self.resource_group = [resource_group_key, None]
self.vnet = [vnet_key, None]
self.address_prefixes = address_prefixes
self.dev_setting_name = os.environ.get(dev_setting_name, None)

def create_resource(self, name, **_):
if self.dev_setting_name:
return {self.parameter_name: self.dev_setting_name, }

if not self.resource_group[1]:
self.resource_group[1] = self.test_class_instance.kwargs.get(
self.resource_group[0])
if not self.resource_group[1]:
raise CliTestError("Error: No resource group configured!")
if not self.vnet[1]:
self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0])
if not self.vnet[1]:
raise CliTestError("Error: No vnet configured!")

self.test_class_instance.kwargs[self.key] = 'default'
return {self.parameter_name: name}

def remove_resource(self, name, **_):
pass


class VnetNicPreparer(NoTrafficRecordingPreparer, SingleValueReplacer):
def __init__(self, name_prefix='clitest.nic',
parameter_name='subnet',
resource_group_key=KEY_RESOURCE_GROUP,
vnet_key=KEY_VIRTUAL_NETWORK,
dev_setting_name='AZURE_CLI_TEST_DEV_VNET_NIC_NAME',
key=KEY_VNET_NIC):
if ' ' in name_prefix:
raise CliTestError(
'Error: Space character in name prefix \'%s\'' % name_prefix)
super(VnetNicPreparer, self).__init__(name_prefix, 15)
self.cli_ctx = get_dummy_cli()
self.parameter_name = parameter_name
self.key = key
self.resource_group = [resource_group_key, None]
self.vnet = [vnet_key, None]
self.dev_setting_name = os.environ.get(dev_setting_name, None)

def create_resource(self, name, **_):
if self.dev_setting_name:
return {self.parameter_name: self.dev_setting_name, }

if not self.resource_group[1]:
self.resource_group[1] = self.test_class_instance.kwargs.get(
self.resource_group[0])
if not self.resource_group[1]:
raise CliTestError("Error: No resource group configured!")
if not self.vnet[1]:
self.vnet[1] = self.test_class_instance.kwargs.get(self.vnet[0])
if not self.vnet[1]:
raise CliTestError("Error: No vnet configured!")

template = 'az network nic create --resource-group {} --name {} --vnet-name {} --subnet default '
self.live_only_execute(self.cli_ctx, template.format(
self.resource_group[1], name, self.vnet[1]))

self.test_class_instance.kwargs[self.key] = name
return {self.parameter_name: name}

def remove_resource(self, name, **_):
if not self.dev_setting_name:
self.live_only_execute(
self.cli_ctx,
'az network nic delete --name {} --resource-group {}'.format(name, self.resource_group[1]))
5 changes: 2 additions & 3 deletions src/kusto/azext_kusto/tests/latest/test_kusto_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,13 @@ def step_attacheddatabaseconfigurationsget(test, rg):
'--resource-group "{rg}"',
checks=[])

# EXAMPLE: KustoDataConnectionsGet


# EXAMPLE: KustoDataConnectionsGet
@try_manual
def step_kustodataconnectionsget(test, rg):
test.cmd('az kusto data-connection show '
'--name "{DataConnections8}" '
'--cluster-name "{Clusters_3}" '
'--name "{DataConnections8}" '
'--database-name "KustoDatabase8" '
'--resource-group "{rg}"',
checks=[])
Expand Down
9 changes: 0 additions & 9 deletions src/kusto/azext_kusto/vendored_sdks/kusto/_version.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ def _create_or_update_initial(
location, # type: str
sku, # type: "models.AzureSku"
tags=None, # type: Optional[Dict[str, str]]
trusted_external_tenants=None, # type: Optional[List["models.TrustedExternalTenant"]]
zones=None, # type: Optional[List[str]]
trusted_external_tenants=None, # type: Optional[List["models.TrustedExternalTenant"]]
optimized_autoscale=None, # type: Optional["models.OptimizedAutoscale"]
enable_disk_encryption=None, # type: Optional[bool]
enable_streaming_ingest=False, # type: Optional[bool]
Expand Down
37 changes: 0 additions & 37 deletions src/kusto/azext_kusto/vendored_sdks/kusto/setup.py

This file was deleted.

Loading

0 comments on commit 002b9c9

Please sign in to comment.