Skip to content

Commit

Permalink
Generated from b31be622b4be1b4544665e45275ecbd040551dda
Browse files Browse the repository at this point in the history
Run npm run multiapi to update all-api-versions blocks
  • Loading branch information
SDK Automation committed Sep 1, 2020
1 parent 1d40cb0 commit 0228420
Show file tree
Hide file tree
Showing 13 changed files with 287 additions and 219 deletions.
102 changes: 70 additions & 32 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
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]))
7 changes: 3 additions & 4 deletions src/kusto/azext_kusto/tests/latest/test_kusto_scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def step_kustodatabasescreateorupdate(test, rg):
test.cmd('az kusto database create '
'--cluster-name "{Clusters_3}" '
'--database-name "KustoDatabase8" '
'--parameters "{{\\"location\\":\\"westus\\",\\"properties\\":{{\\"softDeletePeriod\\":\\"P1D\\"}}}}" '
'--read-write-database location="westus" soft-delete-period="P1D" '
'--resource-group "{rg}"',
checks=[])

Expand Down 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.

34 changes: 0 additions & 34 deletions src/kusto/kusto.egg-info/PKG-INFO

This file was deleted.

57 changes: 0 additions & 57 deletions src/kusto/kusto.egg-info/SOURCES.txt

This file was deleted.

1 change: 0 additions & 1 deletion src/kusto/kusto.egg-info/dependency_links.txt

This file was deleted.

1 change: 0 additions & 1 deletion src/kusto/kusto.egg-info/top_level.txt

This file was deleted.

2 changes: 1 addition & 1 deletion src/kusto/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from setuptools import setup, find_packages

# HISTORY.rst entry.
VERSION = '0.1.1'
VERSION = '0.1.0'
try:
from .manual.version import VERSION
except ImportError:
Expand Down

0 comments on commit 0228420

Please sign in to comment.