diff --git a/src/generate/renders/generated/CliCustom.ts b/src/generate/renders/generated/CliCustom.ts index 4aeab3fa5..5345cf89e 100644 --- a/src/generate/renders/generated/CliCustom.ts +++ b/src/generate/renders/generated/CliCustom.ts @@ -312,6 +312,14 @@ function ConstructMethodBodyParameter(model: CodeModelAz, needGeneric = false, r } else { originalParameterStack.pop(); originalParameterNameStack.pop(); + // if this parameter was popped out because of last flattened parameter has just finished construction, + // then we need to run construction logic for this parameter one more time. + if ( + originalParameterStack.length > 0 && + model.MethodParameter['originalParameter'] === originalParameterStack.last + ) { + skip = true; + } } } } while (skip || model.SelectNextMethodParameter(true)); diff --git a/test/scenarios/kusto/configuration/readme.az.md b/test/scenarios/kusto/configuration/readme.az.md index 4515326bc..b28c4ddb4 100644 --- a/test/scenarios/kusto/configuration/readme.az.md +++ b/test/scenarios/kusto/configuration/readme.az.md @@ -38,6 +38,11 @@ cli: param: 'clusterName' set: extensionMode: 'experimental' + - where: + group: '*' + op: '*' + param: 'sku' + cli-flatten: true ``` diff --git a/test/scenarios/kusto/output/ext_default_folder/src/kusto/README.md b/test/scenarios/kusto/output/ext_default_folder/src/kusto/README.md index 5130dc2c7..5b97b8a50 100644 --- a/test/scenarios/kusto/output/ext_default_folder/src/kusto/README.md +++ b/test/scenarios/kusto/output/ext_default_folder/src/kusto/README.md @@ -11,11 +11,11 @@ az extension add --name kusto #### kusto cluster #### ##### Create ##### ``` -az kusto cluster create --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ - --enable-double-encryption false --enable-purge true --enable-streaming-ingest true \ - --sku name="Standard_L8s" capacity=2 tier="Standard" --resource-group "kustorptest" +az kusto cluster create --cluster-name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ + --enable-double-encryption false --enable-purge true --enable-streaming-ingest true --name "Standard_L8s" \ + --capacity 2 --tier "Standard" --resource-group "kustorptest" -az kusto cluster wait --created --name "{myCluster}" --resource-group "{rg}" +az kusto cluster wait --created --cluster-name "{myCluster}" --resource-group "{rg}" ``` ##### Show ##### ``` @@ -27,8 +27,8 @@ az kusto cluster list --resource-group "kustorptest" ``` ##### Update ##### ``` -az kusto cluster update --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" --enable-purge true \ - --enable-streaming-ingest true \ +az kusto cluster update --cluster-name "kustoclusterrptest4" --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="keyVersion" \ --resource-group "kustorptest" ``` diff --git a/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/_help.py b/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/_help.py index 001e63cf7..7fb695cd8 100644 --- a/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/_help.py +++ b/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/_help.py @@ -43,14 +43,6 @@ type: command short-summary: "Create a Kusto cluster." parameters: - - name: --sku - short-summary: "The SKU of the cluster." - long-summary: | - Usage: --sku name=XX capacity=XX tier=XX - - name: Required. SKU name. - capacity: The number of instances of the cluster. - tier: Required. SKU tier. - name: --trusted-external-tenants short-summary: "The cluster's external tenants." long-summary: | @@ -87,23 +79,15 @@ examples: - name: KustoClustersCreateOrUpdate text: |- - az kusto cluster create --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ ---enable-double-encryption false --enable-purge true --enable-streaming-ingest true --sku name="Standard_L8s" \ -capacity=2 tier="Standard" --resource-group "kustorptest" + az kusto cluster create --cluster-name "kustoclusterrptest4" --type "SystemAssigned" --location \ +"westus" --enable-double-encryption false --enable-purge true --enable-streaming-ingest true --name "Standard_L8s" \ +--capacity 2 --tier "Standard" --resource-group "kustorptest" """ helps['kusto cluster update'] = """ type: command short-summary: "Update a Kusto cluster." parameters: - - name: --sku - short-summary: "The SKU of the cluster." - long-summary: | - Usage: --sku name=XX capacity=XX tier=XX - - name: Required. SKU name. - capacity: The number of instances of the cluster. - tier: Required. SKU tier. - name: --trusted-external-tenants short-summary: "The cluster's external tenants." long-summary: | @@ -140,8 +124,8 @@ examples: - name: KustoClustersUpdate text: |- - az kusto cluster update --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ ---enable-purge true --enable-streaming-ingest true --key-vault-properties key-name="keyName" \ + az kusto cluster update --cluster-name "kustoclusterrptest4" --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="keyVersion" --resource-group "kustorptest" """ diff --git a/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/_params.py b/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/_params.py index 89bc3f29a..e6a7a172d 100644 --- a/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/_params.py +++ b/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/_params.py @@ -22,7 +22,6 @@ validate_file_or_dict ) from azext_kusto.action import ( - AddSku, AddTrustedExternalTenants, AddOptimizedAutoscale, AddVirtualNetworkConfiguration, @@ -46,12 +45,21 @@ def load_arguments(self, _): with self.argument_context('kusto cluster create') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('cluster_name', options_list=['--name', '-n', '--cluster-name'], type=str, help='The name of the ' - 'Kusto cluster.') + c.argument('cluster_name', type=str, help='The name of the Kusto cluster.') c.argument('tags', tags_type) c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, validator=get_default_location_from_resource_group) - c.argument('sku', action=AddSku, nargs='+', help='The SKU of the cluster.') + c.argument('name', arg_type=get_enum_type(['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']), help='SKU name.') + c.argument('capacity', type=int, help='The number of instances of the cluster.') + c.argument('tier', arg_type=get_enum_type(['Basic', 'Standard']), help='SKU tier.') c.argument('zones', nargs='+', help='The availability zones of the cluster.') c.argument('trusted_external_tenants', action=AddTrustedExternalTenants, nargs='+', help='The cluster\'s ' 'external tenants.') @@ -79,12 +87,21 @@ def load_arguments(self, _): with self.argument_context('kusto cluster update') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('cluster_name', options_list=['--name', '-n', '--cluster-name'], type=str, help='The name of the ' - 'Kusto cluster.', id_part='name') + c.argument('cluster_name', type=str, help='The name of the Kusto cluster.', id_part='name') c.argument('tags', tags_type) c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, validator=get_default_location_from_resource_group) - c.argument('sku', action=AddSku, nargs='+', help='The SKU of the cluster.') + c.argument('name', arg_type=get_enum_type(['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']), help='SKU name.') + c.argument('capacity', type=int, help='The number of instances of the cluster.') + c.argument('tier', arg_type=get_enum_type(['Basic', 'Standard']), help='SKU tier.') c.argument('trusted_external_tenants', action=AddTrustedExternalTenants, nargs='+', help='The cluster\'s ' 'external tenants.') c.argument('optimized_autoscale', action=AddOptimizedAutoscale, nargs='+', help='Optimized auto scale ' diff --git a/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/action.py b/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/action.py index 3762c102a..8ab7f9898 100644 --- a/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/action.py +++ b/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/action.py @@ -14,35 +14,6 @@ from knack.util import CLIError -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] - else: - raise CLIError('Unsupported Key {} is provided for parameter sku. All possible keys are: name, ' - 'capacity, tier'.format(k)) - return d - - class AddTrustedExternalTenants(argparse._AppendAction): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) diff --git a/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/custom.py b/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/custom.py index 77babe882..b307294f0 100644 --- a/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/custom.py +++ b/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/generated/custom.py @@ -32,8 +32,10 @@ def kusto_cluster_create(client, resource_group_name, cluster_name, location, - sku, + name, + tier, tags=None, + capacity=None, zones=None, trusted_external_tenants=None, optimized_autoscale=None, @@ -55,7 +57,10 @@ def kusto_cluster_create(client, parameters = {} parameters['tags'] = tags parameters['location'] = location - parameters['sku'] = sku + parameters['sku'] = {} + parameters['sku']['name'] = name + parameters['sku']['capacity'] = capacity + parameters['sku']['tier'] = tier parameters['zones'] = zones parameters['trusted_external_tenants'] = trusted_external_tenants parameters['optimized_autoscale'] = optimized_autoscale @@ -80,7 +85,9 @@ def kusto_cluster_update(client, cluster_name, tags=None, location=None, - sku=None, + name=None, + capacity=None, + tier=None, trusted_external_tenants=None, optimized_autoscale=None, enable_disk_encryption=None, @@ -101,7 +108,10 @@ def kusto_cluster_update(client, parameters = {} parameters['tags'] = tags parameters['location'] = location - parameters['sku'] = sku + parameters['sku'] = {} + parameters['sku']['name'] = name + parameters['sku']['capacity'] = capacity + parameters['sku']['tier'] = tier parameters['trusted_external_tenants'] = trusted_external_tenants parameters['optimized_autoscale'] = optimized_autoscale parameters['enable_disk_encryption'] = enable_disk_encryption diff --git a/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/tests/latest/example_steps.py b/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/tests/latest/example_steps.py index 3f445360a..0fb47fab2 100644 --- a/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/tests/latest/example_steps.py +++ b/test/scenarios/kusto/output/ext_default_folder/src/kusto/azext_kusto/tests/latest/example_steps.py @@ -62,17 +62,19 @@ def step_cluster_create(test, rg, checks=None): if checks is None: checks = [] test.cmd('az kusto cluster create ' - '--name "{myCluster}" ' + '--cluster-name "{myCluster}" ' '--type "SystemAssigned" ' '--location "westus" ' '--enable-double-encryption false ' '--enable-purge true ' '--enable-streaming-ingest true ' - '--sku name="Standard_L8s" capacity=2 tier="Standard" ' + '--name "Standard_L8s" ' + '--capacity 2 ' + '--tier "Standard" ' '--resource-group "{rg}"', checks=[]) test.cmd('az kusto cluster wait --created ' - '--name "{myCluster}" ' + '--cluster-name "{myCluster}" ' '--resource-group "{rg}"', checks=checks) @@ -135,7 +137,7 @@ def step_cluster_update(test, rg, checks=None): if checks is None: checks = [] test.cmd('az kusto cluster update ' - '--name "{myCluster}" ' + '--cluster-name "{myCluster}" ' '--type "SystemAssigned" ' '--location "westus" ' '--enable-purge true ' diff --git a/test/scenarios/kusto/output/ext_default_folder/src/kusto/report.md b/test/scenarios/kusto/output/ext_default_folder/src/kusto/report.md index 1ba88aa61..dc8e6569d 100644 --- a/test/scenarios/kusto/output/ext_default_folder/src/kusto/report.md +++ b/test/scenarios/kusto/output/ext_default_folder/src/kusto/report.md @@ -206,9 +206,9 @@ az kusto cluster show --name "kustoclusterrptest4" --resource-group "kustorptest ##### Example ``` -az kusto cluster create --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ ---enable-double-encryption false --enable-purge true --enable-streaming-ingest true --sku name="Standard_L8s" \ -capacity=2 tier="Standard" --resource-group "kustorptest" +az kusto cluster create --cluster-name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ +--enable-double-encryption false --enable-purge true --enable-streaming-ingest true --name "Standard_L8s" --capacity 2 \ +--tier "Standard" --resource-group "kustorptest" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| @@ -216,8 +216,10 @@ capacity=2 tier="Standard" --resource-group "kustorptest" |**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name|resourceGroupName| |**--cluster-name**|string|The name of the Kusto cluster.|cluster_name|clusterName| |**--location**|string|The geo-location where the resource lives|location|location| -|**--sku**|object|The SKU of the cluster.|sku|sku| +|**--name**|choice|SKU name.|name|name| +|**--tier**|choice|SKU tier.|tier|tier| |**--tags**|dictionary|Resource tags.|tags|tags| +|**--capacity**|integer|The number of instances of the cluster.|capacity|capacity| |**--zones**|array|The availability zones of the cluster.|zones|zones| |**--trusted-external-tenants**|array|The cluster's external tenants.|trusted_external_tenants|trustedExternalTenants| |**--optimized-autoscale**|object|Optimized auto scale definition.|optimized_autoscale|optimizedAutoscale| @@ -234,9 +236,9 @@ capacity=2 tier="Standard" --resource-group "kustorptest" ##### Example ``` -az kusto cluster update --name "kustoclusterrptest4" --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="keyVersion" --resource-group "kustorptest" +az kusto cluster update --cluster-name "kustoclusterrptest4" --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="keyVersion" --resource-group "kustorptest" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| @@ -245,7 +247,9 @@ key-version="keyVersion" --resource-group "kustorptest" |**--cluster-name**|string|The name of the Kusto cluster.|cluster_name|clusterName| |**--tags**|dictionary|Resource tags.|tags|tags| |**--location**|string|Resource location.|location|location| -|**--sku**|object|The SKU of the cluster.|sku|sku| +|**--name**|choice|SKU name.|name|name| +|**--capacity**|integer|The number of instances of the cluster.|capacity|capacity| +|**--tier**|choice|SKU tier.|tier|tier| |**--trusted-external-tenants**|array|The cluster's external tenants.|trusted_external_tenants|trustedExternalTenants| |**--optimized-autoscale**|object|Optimized auto scale definition.|optimized_autoscale|optimizedAutoscale| |**--enable-disk-encryption**|boolean|A boolean value that indicates if the cluster's disks are encrypted.|enable_disk_encryption|enableDiskEncryption| diff --git a/test/scenarios/kusto/output/extflatten/src/kusto/README.md b/test/scenarios/kusto/output/extflatten/src/kusto/README.md index 5130dc2c7..5b97b8a50 100644 --- a/test/scenarios/kusto/output/extflatten/src/kusto/README.md +++ b/test/scenarios/kusto/output/extflatten/src/kusto/README.md @@ -11,11 +11,11 @@ az extension add --name kusto #### kusto cluster #### ##### Create ##### ``` -az kusto cluster create --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ - --enable-double-encryption false --enable-purge true --enable-streaming-ingest true \ - --sku name="Standard_L8s" capacity=2 tier="Standard" --resource-group "kustorptest" +az kusto cluster create --cluster-name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ + --enable-double-encryption false --enable-purge true --enable-streaming-ingest true --name "Standard_L8s" \ + --capacity 2 --tier "Standard" --resource-group "kustorptest" -az kusto cluster wait --created --name "{myCluster}" --resource-group "{rg}" +az kusto cluster wait --created --cluster-name "{myCluster}" --resource-group "{rg}" ``` ##### Show ##### ``` @@ -27,8 +27,8 @@ az kusto cluster list --resource-group "kustorptest" ``` ##### Update ##### ``` -az kusto cluster update --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" --enable-purge true \ - --enable-streaming-ingest true \ +az kusto cluster update --cluster-name "kustoclusterrptest4" --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="keyVersion" \ --resource-group "kustorptest" ``` diff --git a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/_help.py b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/_help.py index 001e63cf7..7fb695cd8 100644 --- a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/_help.py +++ b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/_help.py @@ -43,14 +43,6 @@ type: command short-summary: "Create a Kusto cluster." parameters: - - name: --sku - short-summary: "The SKU of the cluster." - long-summary: | - Usage: --sku name=XX capacity=XX tier=XX - - name: Required. SKU name. - capacity: The number of instances of the cluster. - tier: Required. SKU tier. - name: --trusted-external-tenants short-summary: "The cluster's external tenants." long-summary: | @@ -87,23 +79,15 @@ examples: - name: KustoClustersCreateOrUpdate text: |- - az kusto cluster create --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ ---enable-double-encryption false --enable-purge true --enable-streaming-ingest true --sku name="Standard_L8s" \ -capacity=2 tier="Standard" --resource-group "kustorptest" + az kusto cluster create --cluster-name "kustoclusterrptest4" --type "SystemAssigned" --location \ +"westus" --enable-double-encryption false --enable-purge true --enable-streaming-ingest true --name "Standard_L8s" \ +--capacity 2 --tier "Standard" --resource-group "kustorptest" """ helps['kusto cluster update'] = """ type: command short-summary: "Update a Kusto cluster." parameters: - - name: --sku - short-summary: "The SKU of the cluster." - long-summary: | - Usage: --sku name=XX capacity=XX tier=XX - - name: Required. SKU name. - capacity: The number of instances of the cluster. - tier: Required. SKU tier. - name: --trusted-external-tenants short-summary: "The cluster's external tenants." long-summary: | @@ -140,8 +124,8 @@ examples: - name: KustoClustersUpdate text: |- - az kusto cluster update --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ ---enable-purge true --enable-streaming-ingest true --key-vault-properties key-name="keyName" \ + az kusto cluster update --cluster-name "kustoclusterrptest4" --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="keyVersion" --resource-group "kustorptest" """ diff --git a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/_params.py b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/_params.py index d11217a70..a09b76417 100644 --- a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/_params.py +++ b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/_params.py @@ -22,7 +22,6 @@ validate_file_or_dict ) from azext_kusto.action import ( - AddSku, AddTrustedExternalTenants, AddOptimizedAutoscale, AddVirtualNetworkConfiguration, @@ -46,12 +45,21 @@ def load_arguments(self, _): with self.argument_context('kusto cluster create') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('cluster_name', options_list=['--name', '-n', '--cluster-name'], type=str, help='The name of the ' - 'Kusto cluster.') + c.argument('cluster_name', type=str, help='The name of the Kusto cluster.') c.argument('tags', tags_type) c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, validator=get_default_location_from_resource_group) - c.argument('sku', action=AddSku, nargs='+', help='The SKU of the cluster.') + c.argument('name', arg_type=get_enum_type(['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']), help='SKU name.') + c.argument('capacity', type=int, help='The number of instances of the cluster.') + c.argument('tier', arg_type=get_enum_type(['Basic', 'Standard']), help='SKU tier.') c.argument('zones', nargs='+', help='The availability zones of the cluster.') c.argument('trusted_external_tenants', action=AddTrustedExternalTenants, nargs='+', help='The cluster\'s ' 'external tenants.') @@ -79,12 +87,21 @@ def load_arguments(self, _): with self.argument_context('kusto cluster update') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('cluster_name', options_list=['--name', '-n', '--cluster-name'], type=str, help='The name of the ' - 'Kusto cluster.', id_part='name') + c.argument('cluster_name', type=str, help='The name of the Kusto cluster.', id_part='name') c.argument('tags', tags_type) c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, validator=get_default_location_from_resource_group) - c.argument('sku', action=AddSku, nargs='+', help='The SKU of the cluster.') + c.argument('name', arg_type=get_enum_type(['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']), help='SKU name.') + c.argument('capacity', type=int, help='The number of instances of the cluster.') + c.argument('tier', arg_type=get_enum_type(['Basic', 'Standard']), help='SKU tier.') c.argument('trusted_external_tenants', action=AddTrustedExternalTenants, nargs='+', help='The cluster\'s ' 'external tenants.') c.argument('optimized_autoscale', action=AddOptimizedAutoscale, nargs='+', help='Optimized auto scale ' diff --git a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/action.py b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/action.py index 3762c102a..8ab7f9898 100644 --- a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/action.py +++ b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/action.py @@ -14,35 +14,6 @@ from knack.util import CLIError -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] - else: - raise CLIError('Unsupported Key {} is provided for parameter sku. All possible keys are: name, ' - 'capacity, tier'.format(k)) - return d - - class AddTrustedExternalTenants(argparse._AppendAction): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) diff --git a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/custom.py b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/custom.py index 4a0c019a1..63bb0e5a3 100644 --- a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/custom.py +++ b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/generated/custom.py @@ -31,8 +31,10 @@ def kusto_cluster_create(client, resource_group_name, cluster_name, location, - sku, + name, + tier, tags=None, + capacity=None, zones=None, trusted_external_tenants=None, optimized_autoscale=None, @@ -51,13 +53,19 @@ def kusto_cluster_create(client, enable_purge = False if enable_double_encryption is None: enable_double_encryption = False + sku = {} + sku['name'] = name + sku['capacity'] = capacity + sku['tier'] = tier return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name=resource_group_name, cluster_name=cluster_name, tags=tags, location=location, - sku=sku, + name=name, + capacity=capacity, + tier=tier, zones=zones, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, @@ -76,7 +84,9 @@ def kusto_cluster_update(client, cluster_name, tags=None, location=None, - sku=None, + name=None, + capacity=None, + tier=None, trusted_external_tenants=None, optimized_autoscale=None, enable_disk_encryption=None, @@ -94,13 +104,19 @@ def kusto_cluster_update(client, enable_purge = False if enable_double_encryption is None: enable_double_encryption = False + sku = {} + sku['name'] = name + sku['capacity'] = capacity + sku['tier'] = tier return sdk_no_wait(no_wait, client.begin_update, resource_group_name=resource_group_name, cluster_name=cluster_name, tags=tags, location=location, - sku=sku, + name=name, + capacity=capacity, + tier=tier, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, diff --git a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/tests/latest/example_steps.py b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/tests/latest/example_steps.py index 3f445360a..0fb47fab2 100644 --- a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/tests/latest/example_steps.py +++ b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/tests/latest/example_steps.py @@ -62,17 +62,19 @@ def step_cluster_create(test, rg, checks=None): if checks is None: checks = [] test.cmd('az kusto cluster create ' - '--name "{myCluster}" ' + '--cluster-name "{myCluster}" ' '--type "SystemAssigned" ' '--location "westus" ' '--enable-double-encryption false ' '--enable-purge true ' '--enable-streaming-ingest true ' - '--sku name="Standard_L8s" capacity=2 tier="Standard" ' + '--name "Standard_L8s" ' + '--capacity 2 ' + '--tier "Standard" ' '--resource-group "{rg}"', checks=[]) test.cmd('az kusto cluster wait --created ' - '--name "{myCluster}" ' + '--cluster-name "{myCluster}" ' '--resource-group "{rg}"', checks=checks) @@ -135,7 +137,7 @@ def step_cluster_update(test, rg, checks=None): if checks is None: checks = [] test.cmd('az kusto cluster update ' - '--name "{myCluster}" ' + '--cluster-name "{myCluster}" ' '--type "SystemAssigned" ' '--location "westus" ' '--enable-purge true ' diff --git a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations/_cluster_operations.py b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations/_cluster_operations.py index 1137adf5d..59784900f 100644 --- a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations/_cluster_operations.py +++ b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/vendored_sdks/kusto/aio/operations/_cluster_operations.py @@ -106,8 +106,10 @@ async def _create_or_update_initial( resource_group_name: str, cluster_name: str, location: str, - sku: "models.AzureSku", + name: Union[str, "models.AzureSkuName"], + tier: Union[str, "models.AzureSkuTier"], tags: Optional[Dict[str, str]] = None, + capacity: Optional[int] = None, zones: Optional[List[str]] = None, trusted_external_tenants: Optional[List["models.TrustedExternalTenant"]] = None, optimized_autoscale: Optional["models.OptimizedAutoscale"] = None, @@ -127,7 +129,7 @@ async def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - parameters = models.Cluster(tags=tags, location=location, sku=sku, zones=zones, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, enable_streaming_ingest=enable_streaming_ingest, virtual_network_configuration=virtual_network_configuration, key_vault_properties=key_vault_properties, enable_purge=enable_purge, enable_double_encryption=enable_double_encryption, type_identity_type=type, user_assigned_identities=user_assigned_identities) + parameters = models.Cluster(tags=tags, location=location, sku=sku, name=name, capacity=capacity, tier=tier, zones=zones, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, enable_streaming_ingest=enable_streaming_ingest, virtual_network_configuration=virtual_network_configuration, key_vault_properties=key_vault_properties, enable_purge=enable_purge, enable_double_encryption=enable_double_encryption, type_identity_type=type, user_assigned_identities=user_assigned_identities) api_version = "2020-06-14" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -178,8 +180,10 @@ async def begin_create_or_update( resource_group_name: str, cluster_name: str, location: str, - sku: "models.AzureSku", + name: Union[str, "models.AzureSkuName"], + tier: Union[str, "models.AzureSkuTier"], tags: Optional[Dict[str, str]] = None, + capacity: Optional[int] = None, zones: Optional[List[str]] = None, trusted_external_tenants: Optional[List["models.TrustedExternalTenant"]] = None, optimized_autoscale: Optional["models.OptimizedAutoscale"] = None, @@ -201,10 +205,14 @@ async def begin_create_or_update( :type cluster_name: str :param location: The geo-location where the resource lives. :type location: str - :param sku: The SKU of the cluster. - :type sku: ~kusto_management_client.models.AzureSku + :param name: SKU name. + :type name: str or ~kusto_management_client.models.AzureSkuName + :param tier: SKU tier. + :type tier: str or ~kusto_management_client.models.AzureSkuTier :param tags: Resource tags. :type tags: dict[str, str] + :param capacity: The number of instances of the cluster. + :type capacity: int :param zones: The availability zones of the cluster. :type zones: list[str] :param trusted_external_tenants: The cluster's external tenants. @@ -254,8 +262,10 @@ async def begin_create_or_update( resource_group_name=resource_group_name, cluster_name=cluster_name, location=location, - sku=sku, + name=name, + tier=tier, tags=tags, + capacity=capacity, zones=zones, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, @@ -307,7 +317,9 @@ async def _update_initial( cluster_name: str, tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, - sku: Optional["models.AzureSku"] = None, + name: Optional[Union[str, "models.AzureSkuName"]] = None, + capacity: Optional[int] = None, + tier: Optional[Union[str, "models.AzureSkuTier"]] = None, trusted_external_tenants: Optional[List["models.TrustedExternalTenant"]] = None, optimized_autoscale: Optional["models.OptimizedAutoscale"] = None, enable_disk_encryption: Optional[bool] = None, @@ -326,7 +338,7 @@ async def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - parameters = models.ClusterUpdate(tags=tags, location=location, sku=sku, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, enable_streaming_ingest=enable_streaming_ingest, virtual_network_configuration=virtual_network_configuration, key_vault_properties=key_vault_properties, enable_purge=enable_purge, enable_double_encryption=enable_double_encryption, type_identity_type=type, user_assigned_identities=user_assigned_identities) + parameters = models.ClusterUpdate(tags=tags, location=location, sku=sku, name=name, capacity=capacity, tier=tier, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, enable_streaming_ingest=enable_streaming_ingest, virtual_network_configuration=virtual_network_configuration, key_vault_properties=key_vault_properties, enable_purge=enable_purge, enable_double_encryption=enable_double_encryption, type_identity_type=type, user_assigned_identities=user_assigned_identities) api_version = "2020-06-14" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -381,7 +393,9 @@ async def begin_update( cluster_name: str, tags: Optional[Dict[str, str]] = None, location: Optional[str] = None, - sku: Optional["models.AzureSku"] = None, + name: Optional[Union[str, "models.AzureSkuName"]] = None, + capacity: Optional[int] = None, + tier: Optional[Union[str, "models.AzureSkuTier"]] = None, trusted_external_tenants: Optional[List["models.TrustedExternalTenant"]] = None, optimized_autoscale: Optional["models.OptimizedAutoscale"] = None, enable_disk_encryption: Optional[bool] = None, @@ -404,8 +418,12 @@ async def begin_update( :type tags: dict[str, str] :param location: Resource location. :type location: str - :param sku: The SKU of the cluster. - :type sku: ~kusto_management_client.models.AzureSku + :param name: SKU name. + :type name: str or ~kusto_management_client.models.AzureSkuName + :param capacity: The number of instances of the cluster. + :type capacity: int + :param tier: SKU tier. + :type tier: str or ~kusto_management_client.models.AzureSkuTier :param trusted_external_tenants: The cluster's external tenants. :type trusted_external_tenants: list[~kusto_management_client.models.TrustedExternalTenant] :param optimized_autoscale: Optimized auto scale definition. @@ -454,7 +472,9 @@ async def begin_update( cluster_name=cluster_name, tags=tags, location=location, - sku=sku, + name=name, + capacity=capacity, + tier=tier, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, diff --git a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_operations.py b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_operations.py index d2a05bda4..3b934acfb 100644 --- a/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_operations.py +++ b/test/scenarios/kusto/output/extflatten/src/kusto/azext_kusto/vendored_sdks/kusto/operations/_cluster_operations.py @@ -111,8 +111,10 @@ def _create_or_update_initial( resource_group_name, # type: str cluster_name, # type: str location, # type: str - sku, # type: "models.AzureSku" + name, # type: Union[str, "models.AzureSkuName"] + tier, # type: Union[str, "models.AzureSkuTier"] tags=None, # type: Optional[Dict[str, str]] + capacity=None, # type: Optional[int] zones=None, # type: Optional[List[str]] trusted_external_tenants=None, # type: Optional[List["models.TrustedExternalTenant"]] optimized_autoscale=None, # type: Optional["models.OptimizedAutoscale"] @@ -133,7 +135,7 @@ def _create_or_update_initial( } error_map.update(kwargs.pop('error_map', {})) - parameters = models.Cluster(tags=tags, location=location, sku=sku, zones=zones, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, enable_streaming_ingest=enable_streaming_ingest, virtual_network_configuration=virtual_network_configuration, key_vault_properties=key_vault_properties, enable_purge=enable_purge, enable_double_encryption=enable_double_encryption, type_identity_type=type, user_assigned_identities=user_assigned_identities) + parameters = models.Cluster(tags=tags, location=location, sku=sku, name=name, capacity=capacity, tier=tier, zones=zones, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, enable_streaming_ingest=enable_streaming_ingest, virtual_network_configuration=virtual_network_configuration, key_vault_properties=key_vault_properties, enable_purge=enable_purge, enable_double_encryption=enable_double_encryption, type_identity_type=type, user_assigned_identities=user_assigned_identities) api_version = "2020-06-14" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -184,8 +186,10 @@ def begin_create_or_update( resource_group_name, # type: str cluster_name, # type: str location, # type: str - sku, # type: "models.AzureSku" + name, # type: Union[str, "models.AzureSkuName"] + tier, # type: Union[str, "models.AzureSkuTier"] tags=None, # type: Optional[Dict[str, str]] + capacity=None, # type: Optional[int] zones=None, # type: Optional[List[str]] trusted_external_tenants=None, # type: Optional[List["models.TrustedExternalTenant"]] optimized_autoscale=None, # type: Optional["models.OptimizedAutoscale"] @@ -208,10 +212,14 @@ def begin_create_or_update( :type cluster_name: str :param location: The geo-location where the resource lives. :type location: str - :param sku: The SKU of the cluster. - :type sku: ~kusto_management_client.models.AzureSku + :param name: SKU name. + :type name: str or ~kusto_management_client.models.AzureSkuName + :param tier: SKU tier. + :type tier: str or ~kusto_management_client.models.AzureSkuTier :param tags: Resource tags. :type tags: dict[str, str] + :param capacity: The number of instances of the cluster. + :type capacity: int :param zones: The availability zones of the cluster. :type zones: list[str] :param trusted_external_tenants: The cluster's external tenants. @@ -261,8 +269,10 @@ def begin_create_or_update( resource_group_name=resource_group_name, cluster_name=cluster_name, location=location, - sku=sku, + name=name, + tier=tier, tags=tags, + capacity=capacity, zones=zones, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, @@ -314,7 +324,9 @@ def _update_initial( cluster_name, # type: str tags=None, # type: Optional[Dict[str, str]] location=None, # type: Optional[str] - sku=None, # type: Optional["models.AzureSku"] + name=None, # type: Optional[Union[str, "models.AzureSkuName"]] + capacity=None, # type: Optional[int] + tier=None, # type: Optional[Union[str, "models.AzureSkuTier"]] trusted_external_tenants=None, # type: Optional[List["models.TrustedExternalTenant"]] optimized_autoscale=None, # type: Optional["models.OptimizedAutoscale"] enable_disk_encryption=None, # type: Optional[bool] @@ -334,7 +346,7 @@ def _update_initial( } error_map.update(kwargs.pop('error_map', {})) - parameters = models.ClusterUpdate(tags=tags, location=location, sku=sku, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, enable_streaming_ingest=enable_streaming_ingest, virtual_network_configuration=virtual_network_configuration, key_vault_properties=key_vault_properties, enable_purge=enable_purge, enable_double_encryption=enable_double_encryption, type_identity_type=type, user_assigned_identities=user_assigned_identities) + parameters = models.ClusterUpdate(tags=tags, location=location, sku=sku, name=name, capacity=capacity, tier=tier, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, enable_streaming_ingest=enable_streaming_ingest, virtual_network_configuration=virtual_network_configuration, key_vault_properties=key_vault_properties, enable_purge=enable_purge, enable_double_encryption=enable_double_encryption, type_identity_type=type, user_assigned_identities=user_assigned_identities) api_version = "2020-06-14" content_type = kwargs.pop("content_type", "application/json") accept = "application/json" @@ -389,7 +401,9 @@ def begin_update( cluster_name, # type: str tags=None, # type: Optional[Dict[str, str]] location=None, # type: Optional[str] - sku=None, # type: Optional["models.AzureSku"] + name=None, # type: Optional[Union[str, "models.AzureSkuName"]] + capacity=None, # type: Optional[int] + tier=None, # type: Optional[Union[str, "models.AzureSkuTier"]] trusted_external_tenants=None, # type: Optional[List["models.TrustedExternalTenant"]] optimized_autoscale=None, # type: Optional["models.OptimizedAutoscale"] enable_disk_encryption=None, # type: Optional[bool] @@ -413,8 +427,12 @@ def begin_update( :type tags: dict[str, str] :param location: Resource location. :type location: str - :param sku: The SKU of the cluster. - :type sku: ~kusto_management_client.models.AzureSku + :param name: SKU name. + :type name: str or ~kusto_management_client.models.AzureSkuName + :param capacity: The number of instances of the cluster. + :type capacity: int + :param tier: SKU tier. + :type tier: str or ~kusto_management_client.models.AzureSkuTier :param trusted_external_tenants: The cluster's external tenants. :type trusted_external_tenants: list[~kusto_management_client.models.TrustedExternalTenant] :param optimized_autoscale: Optimized auto scale definition. @@ -463,7 +481,9 @@ def begin_update( cluster_name=cluster_name, tags=tags, location=location, - sku=sku, + name=name, + capacity=capacity, + tier=tier, trusted_external_tenants=trusted_external_tenants, optimized_autoscale=optimized_autoscale, enable_disk_encryption=enable_disk_encryption, diff --git a/test/scenarios/kusto/output/extflatten/src/kusto/report.md b/test/scenarios/kusto/output/extflatten/src/kusto/report.md index 1ba88aa61..dc8e6569d 100644 --- a/test/scenarios/kusto/output/extflatten/src/kusto/report.md +++ b/test/scenarios/kusto/output/extflatten/src/kusto/report.md @@ -206,9 +206,9 @@ az kusto cluster show --name "kustoclusterrptest4" --resource-group "kustorptest ##### Example ``` -az kusto cluster create --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ ---enable-double-encryption false --enable-purge true --enable-streaming-ingest true --sku name="Standard_L8s" \ -capacity=2 tier="Standard" --resource-group "kustorptest" +az kusto cluster create --cluster-name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ +--enable-double-encryption false --enable-purge true --enable-streaming-ingest true --name "Standard_L8s" --capacity 2 \ +--tier "Standard" --resource-group "kustorptest" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| @@ -216,8 +216,10 @@ capacity=2 tier="Standard" --resource-group "kustorptest" |**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name|resourceGroupName| |**--cluster-name**|string|The name of the Kusto cluster.|cluster_name|clusterName| |**--location**|string|The geo-location where the resource lives|location|location| -|**--sku**|object|The SKU of the cluster.|sku|sku| +|**--name**|choice|SKU name.|name|name| +|**--tier**|choice|SKU tier.|tier|tier| |**--tags**|dictionary|Resource tags.|tags|tags| +|**--capacity**|integer|The number of instances of the cluster.|capacity|capacity| |**--zones**|array|The availability zones of the cluster.|zones|zones| |**--trusted-external-tenants**|array|The cluster's external tenants.|trusted_external_tenants|trustedExternalTenants| |**--optimized-autoscale**|object|Optimized auto scale definition.|optimized_autoscale|optimizedAutoscale| @@ -234,9 +236,9 @@ capacity=2 tier="Standard" --resource-group "kustorptest" ##### Example ``` -az kusto cluster update --name "kustoclusterrptest4" --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="keyVersion" --resource-group "kustorptest" +az kusto cluster update --cluster-name "kustoclusterrptest4" --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="keyVersion" --resource-group "kustorptest" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| @@ -245,7 +247,9 @@ key-version="keyVersion" --resource-group "kustorptest" |**--cluster-name**|string|The name of the Kusto cluster.|cluster_name|clusterName| |**--tags**|dictionary|Resource tags.|tags|tags| |**--location**|string|Resource location.|location|location| -|**--sku**|object|The SKU of the cluster.|sku|sku| +|**--name**|choice|SKU name.|name|name| +|**--capacity**|integer|The number of instances of the cluster.|capacity|capacity| +|**--tier**|choice|SKU tier.|tier|tier| |**--trusted-external-tenants**|array|The cluster's external tenants.|trusted_external_tenants|trustedExternalTenants| |**--optimized-autoscale**|object|Optimized auto scale definition.|optimized_autoscale|optimizedAutoscale| |**--enable-disk-encryption**|boolean|A boolean value that indicates if the cluster's disks are encrypted.|enable_disk_encryption|enableDiskEncryption| diff --git a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/README.md b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/README.md index 5130dc2c7..5b97b8a50 100644 --- a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/README.md +++ b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/README.md @@ -11,11 +11,11 @@ az extension add --name kusto #### kusto cluster #### ##### Create ##### ``` -az kusto cluster create --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ - --enable-double-encryption false --enable-purge true --enable-streaming-ingest true \ - --sku name="Standard_L8s" capacity=2 tier="Standard" --resource-group "kustorptest" +az kusto cluster create --cluster-name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ + --enable-double-encryption false --enable-purge true --enable-streaming-ingest true --name "Standard_L8s" \ + --capacity 2 --tier "Standard" --resource-group "kustorptest" -az kusto cluster wait --created --name "{myCluster}" --resource-group "{rg}" +az kusto cluster wait --created --cluster-name "{myCluster}" --resource-group "{rg}" ``` ##### Show ##### ``` @@ -27,8 +27,8 @@ az kusto cluster list --resource-group "kustorptest" ``` ##### Update ##### ``` -az kusto cluster update --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" --enable-purge true \ - --enable-streaming-ingest true \ +az kusto cluster update --cluster-name "kustoclusterrptest4" --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="keyVersion" \ --resource-group "kustorptest" ``` diff --git a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/_help.py b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/_help.py index 001e63cf7..7fb695cd8 100644 --- a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/_help.py +++ b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/_help.py @@ -43,14 +43,6 @@ type: command short-summary: "Create a Kusto cluster." parameters: - - name: --sku - short-summary: "The SKU of the cluster." - long-summary: | - Usage: --sku name=XX capacity=XX tier=XX - - name: Required. SKU name. - capacity: The number of instances of the cluster. - tier: Required. SKU tier. - name: --trusted-external-tenants short-summary: "The cluster's external tenants." long-summary: | @@ -87,23 +79,15 @@ examples: - name: KustoClustersCreateOrUpdate text: |- - az kusto cluster create --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ ---enable-double-encryption false --enable-purge true --enable-streaming-ingest true --sku name="Standard_L8s" \ -capacity=2 tier="Standard" --resource-group "kustorptest" + az kusto cluster create --cluster-name "kustoclusterrptest4" --type "SystemAssigned" --location \ +"westus" --enable-double-encryption false --enable-purge true --enable-streaming-ingest true --name "Standard_L8s" \ +--capacity 2 --tier "Standard" --resource-group "kustorptest" """ helps['kusto cluster update'] = """ type: command short-summary: "Update a Kusto cluster." parameters: - - name: --sku - short-summary: "The SKU of the cluster." - long-summary: | - Usage: --sku name=XX capacity=XX tier=XX - - name: Required. SKU name. - capacity: The number of instances of the cluster. - tier: Required. SKU tier. - name: --trusted-external-tenants short-summary: "The cluster's external tenants." long-summary: | @@ -140,8 +124,8 @@ examples: - name: KustoClustersUpdate text: |- - az kusto cluster update --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ ---enable-purge true --enable-streaming-ingest true --key-vault-properties key-name="keyName" \ + az kusto cluster update --cluster-name "kustoclusterrptest4" --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="keyVersion" --resource-group "kustorptest" """ diff --git a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/_params.py b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/_params.py index 89bc3f29a..e6a7a172d 100644 --- a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/_params.py +++ b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/_params.py @@ -22,7 +22,6 @@ validate_file_or_dict ) from azext_kusto.action import ( - AddSku, AddTrustedExternalTenants, AddOptimizedAutoscale, AddVirtualNetworkConfiguration, @@ -46,12 +45,21 @@ def load_arguments(self, _): with self.argument_context('kusto cluster create') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('cluster_name', options_list=['--name', '-n', '--cluster-name'], type=str, help='The name of the ' - 'Kusto cluster.') + c.argument('cluster_name', type=str, help='The name of the Kusto cluster.') c.argument('tags', tags_type) c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, validator=get_default_location_from_resource_group) - c.argument('sku', action=AddSku, nargs='+', help='The SKU of the cluster.') + c.argument('name', arg_type=get_enum_type(['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']), help='SKU name.') + c.argument('capacity', type=int, help='The number of instances of the cluster.') + c.argument('tier', arg_type=get_enum_type(['Basic', 'Standard']), help='SKU tier.') c.argument('zones', nargs='+', help='The availability zones of the cluster.') c.argument('trusted_external_tenants', action=AddTrustedExternalTenants, nargs='+', help='The cluster\'s ' 'external tenants.') @@ -79,12 +87,21 @@ def load_arguments(self, _): with self.argument_context('kusto cluster update') as c: c.argument('resource_group_name', resource_group_name_type) - c.argument('cluster_name', options_list=['--name', '-n', '--cluster-name'], type=str, help='The name of the ' - 'Kusto cluster.', id_part='name') + c.argument('cluster_name', type=str, help='The name of the Kusto cluster.', id_part='name') c.argument('tags', tags_type) c.argument('location', arg_type=get_location_type(self.cli_ctx), required=False, validator=get_default_location_from_resource_group) - c.argument('sku', action=AddSku, nargs='+', help='The SKU of the cluster.') + c.argument('name', arg_type=get_enum_type(['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']), help='SKU name.') + c.argument('capacity', type=int, help='The number of instances of the cluster.') + c.argument('tier', arg_type=get_enum_type(['Basic', 'Standard']), help='SKU tier.') c.argument('trusted_external_tenants', action=AddTrustedExternalTenants, nargs='+', help='The cluster\'s ' 'external tenants.') c.argument('optimized_autoscale', action=AddOptimizedAutoscale, nargs='+', help='Optimized auto scale ' diff --git a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/action.py b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/action.py index 3762c102a..8ab7f9898 100644 --- a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/action.py +++ b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/action.py @@ -14,35 +14,6 @@ from knack.util import CLIError -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] - else: - raise CLIError('Unsupported Key {} is provided for parameter sku. All possible keys are: name, ' - 'capacity, tier'.format(k)) - return d - - class AddTrustedExternalTenants(argparse._AppendAction): def __call__(self, parser, namespace, values, option_string=None): action = self.get_action(values, option_string) diff --git a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/custom.py b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/custom.py index 0e1e1e776..88fa7c755 100644 --- a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/custom.py +++ b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/generated/custom.py @@ -32,8 +32,10 @@ def kusto_cluster_create(client, resource_group_name, cluster_name, location, - sku, + name, + tier, tags=None, + capacity=None, zones=None, trusted_external_tenants=None, optimized_autoscale=None, @@ -55,7 +57,10 @@ def kusto_cluster_create(client, parameters = {} parameters['tags'] = tags parameters['location'] = location - parameters['sku'] = sku + parameters['sku'] = {} + parameters['sku']['name'] = name + parameters['sku']['capacity'] = capacity + parameters['sku']['tier'] = tier parameters['zones'] = zones parameters['trusted_external_tenants'] = trusted_external_tenants parameters['optimized_autoscale'] = optimized_autoscale @@ -80,7 +85,9 @@ def kusto_cluster_update(client, cluster_name, tags=None, location=None, - sku=None, + name=None, + capacity=None, + tier=None, trusted_external_tenants=None, optimized_autoscale=None, enable_disk_encryption=None, @@ -101,7 +108,10 @@ def kusto_cluster_update(client, parameters = {} parameters['tags'] = tags parameters['location'] = location - parameters['sku'] = sku + parameters['sku'] = {} + parameters['sku']['name'] = name + parameters['sku']['capacity'] = capacity + parameters['sku']['tier'] = tier parameters['trusted_external_tenants'] = trusted_external_tenants parameters['optimized_autoscale'] = optimized_autoscale parameters['enable_disk_encryption'] = enable_disk_encryption diff --git a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/tests/latest/example_steps.py b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/tests/latest/example_steps.py index 3f445360a..0fb47fab2 100644 --- a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/tests/latest/example_steps.py +++ b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/azext_kusto/tests/latest/example_steps.py @@ -62,17 +62,19 @@ def step_cluster_create(test, rg, checks=None): if checks is None: checks = [] test.cmd('az kusto cluster create ' - '--name "{myCluster}" ' + '--cluster-name "{myCluster}" ' '--type "SystemAssigned" ' '--location "westus" ' '--enable-double-encryption false ' '--enable-purge true ' '--enable-streaming-ingest true ' - '--sku name="Standard_L8s" capacity=2 tier="Standard" ' + '--name "Standard_L8s" ' + '--capacity 2 ' + '--tier "Standard" ' '--resource-group "{rg}"', checks=[]) test.cmd('az kusto cluster wait --created ' - '--name "{myCluster}" ' + '--cluster-name "{myCluster}" ' '--resource-group "{rg}"', checks=checks) @@ -135,7 +137,7 @@ def step_cluster_update(test, rg, checks=None): if checks is None: checks = [] test.cmd('az kusto cluster update ' - '--name "{myCluster}" ' + '--cluster-name "{myCluster}" ' '--type "SystemAssigned" ' '--location "westus" ' '--enable-purge true ' diff --git a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/report.md b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/report.md index 1ba88aa61..dc8e6569d 100644 --- a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/report.md +++ b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/report.md @@ -206,9 +206,9 @@ az kusto cluster show --name "kustoclusterrptest4" --resource-group "kustorptest ##### Example ``` -az kusto cluster create --name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ ---enable-double-encryption false --enable-purge true --enable-streaming-ingest true --sku name="Standard_L8s" \ -capacity=2 tier="Standard" --resource-group "kustorptest" +az kusto cluster create --cluster-name "kustoclusterrptest4" --type "SystemAssigned" --location "westus" \ +--enable-double-encryption false --enable-purge true --enable-streaming-ingest true --name "Standard_L8s" --capacity 2 \ +--tier "Standard" --resource-group "kustorptest" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| @@ -216,8 +216,10 @@ capacity=2 tier="Standard" --resource-group "kustorptest" |**--resource-group-name**|string|The name of the resource group containing the Kusto cluster.|resource_group_name|resourceGroupName| |**--cluster-name**|string|The name of the Kusto cluster.|cluster_name|clusterName| |**--location**|string|The geo-location where the resource lives|location|location| -|**--sku**|object|The SKU of the cluster.|sku|sku| +|**--name**|choice|SKU name.|name|name| +|**--tier**|choice|SKU tier.|tier|tier| |**--tags**|dictionary|Resource tags.|tags|tags| +|**--capacity**|integer|The number of instances of the cluster.|capacity|capacity| |**--zones**|array|The availability zones of the cluster.|zones|zones| |**--trusted-external-tenants**|array|The cluster's external tenants.|trusted_external_tenants|trustedExternalTenants| |**--optimized-autoscale**|object|Optimized auto scale definition.|optimized_autoscale|optimizedAutoscale| @@ -234,9 +236,9 @@ capacity=2 tier="Standard" --resource-group "kustorptest" ##### Example ``` -az kusto cluster update --name "kustoclusterrptest4" --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="keyVersion" --resource-group "kustorptest" +az kusto cluster update --cluster-name "kustoclusterrptest4" --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="keyVersion" --resource-group "kustorptest" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| @@ -245,7 +247,9 @@ key-version="keyVersion" --resource-group "kustorptest" |**--cluster-name**|string|The name of the Kusto cluster.|cluster_name|clusterName| |**--tags**|dictionary|Resource tags.|tags|tags| |**--location**|string|Resource location.|location|location| -|**--sku**|object|The SKU of the cluster.|sku|sku| +|**--name**|choice|SKU name.|name|name| +|**--capacity**|integer|The number of instances of the cluster.|capacity|capacity| +|**--tier**|choice|SKU tier.|tier|tier| |**--trusted-external-tenants**|array|The cluster's external tenants.|trusted_external_tenants|trustedExternalTenants| |**--optimized-autoscale**|object|Optimized auto scale definition.|optimized_autoscale|optimizedAutoscale| |**--enable-disk-encryption**|boolean|A boolean value that indicates if the cluster's disks are encrypted.|enable_disk_encryption|enableDiskEncryption|