diff --git a/README.md b/README.md index 6d924a92..ade67f52 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ debug-output-folder: $(az-output-folder)/_az_debug use-extension: "@autorest/python": "5.4.0" - "@autorest/clicommon": "0.5.6" + "@autorest/clicommon": "0.5.7" #"@autorest/python": "latest" require: diff --git a/doc/faq.md b/doc/faq.md index 4a00953f..2c461b3d 100644 --- a/doc/faq.md +++ b/doc/faq.md @@ -431,4 +431,22 @@ cli: - key3 ``` In this way. we can use `--param-name value1 value2 value3` instead of `--param-name key1=value1 key2=value2 key3=value3` to input the argument. -Here if the positionalOrder hasn't been set then we will use default order. and please specify key1, key2, key3 in python underscore case. \ No newline at end of file +Here if the positionalOrder hasn't been set then we will use default order. and please specify key1, key2, key3 in python underscore case. + +## How to set an action argument as aws shorthand syntax +Shorthand syntax argument use space ' ' to split between objects in an array and comma ',' to split between properties + +In code generation. we allow user to add configuration to declare the argument is positional like below + +``` yaml +cli: + cli-directive: + - where: + group: GroupName + op: OperationName + param: paramName + set: + shorthandSyntax: true +``` +In this way. we can use `--param-name key1=value1,key2=value2 key1=valuea,key2=valueb` instead of `--param-name key1=value1 key2=value2 key1=valuea key2=valueb` to suggest that we want to input +two items (value1, value2) and (valuea, valueb). \ No newline at end of file diff --git a/src/plugins/azgenerator/CodeModelAz.ts b/src/plugins/azgenerator/CodeModelAz.ts index 3353fe31..040e34f9 100644 --- a/src/plugins/azgenerator/CodeModelAz.ts +++ b/src/plugins/azgenerator/CodeModelAz.ts @@ -184,6 +184,7 @@ export interface CodeModelAz { MethodParameter_DefaultConfigKey: string | undefined; MethodParameter_Mode: string; MethodParameter_IsPositional: boolean; + MethodParameter_IsShorthandSyntax: boolean; MethodParameter_PositionalKeys: string[]; Parameter_Type(Parameter): string; Schema_Type(Schema): string; @@ -207,6 +208,7 @@ export interface CodeModelAz { Parameter_DefaultValue(Parameter): any | undefined; Parameter_DefaultConfigKey(Parameter): string | undefined; Parameter_IsPositional(Parameter): boolean; + Parameter_IsShorthandSyntax(Parameter): boolean; Schema_Description(Schema): string; Schema_FlattenedFrom(Schema): Schema; Schema_IsPositional(Schema): boolean; diff --git a/src/plugins/azgenerator/CodeModelAzImpl.ts b/src/plugins/azgenerator/CodeModelAzImpl.ts index de00eac7..7c501884 100644 --- a/src/plugins/azgenerator/CodeModelAzImpl.ts +++ b/src/plugins/azgenerator/CodeModelAzImpl.ts @@ -1251,6 +1251,10 @@ export class CodeModelCliImpl implements CodeModelAz { public get MethodParameter_IsPositional(): boolean { return this.Parameter_IsPositional(this.MethodParameter); } + + public get MethodParameter_IsShorthandSyntax(): boolean { + return this.Parameter_IsShorthandSyntax(this.MethodParameter); + } private isComplexSchema(type: string): boolean { if (type == SchemaType.Array || type == SchemaType.Object || type == SchemaType.Dictionary || type == SchemaType.Any || @@ -1279,6 +1283,10 @@ export class CodeModelCliImpl implements CodeModelAz { return param['flattened'] ? true : false; } + public Parameter_IsShorthandSyntax(param: Parameter = this.MethodParameter): boolean { + return param.language['cli']?.['shorthandSyntax'] ? true: false; + } + public Parameter_IsCliFlattened(param: Parameter = this.MethodParameter): boolean { if (param?.language?.['cli']?.['cli-flattened'] && !param.language['cli']['cli-m4-flattened']) { if (param['nameBaseParam']?.language?.['cli']?.['cli-m4-flattened']) { diff --git a/src/plugins/azgenerator/templates/generated/CliActions.ts b/src/plugins/azgenerator/templates/generated/CliActions.ts index 9c09f871..b4a9b194 100644 --- a/src/plugins/azgenerator/templates/generated/CliActions.ts +++ b/src/plugins/azgenerator/templates/generated/CliActions.ts @@ -36,6 +36,8 @@ export function GenerateAzureCliActions(model: CodeModelAz): string[] { } if (model.MethodParameter_IsPositional) { outputCode = outputCode.concat(GetPositionalAction(model, subActionName, model.MethodParameter)); + } else if(model.MethodParameter_IsShorthandSyntax) { + outputCode = outputCode.concat(GetShorthandSyntaxAction(model, subActionName, model.MethodParameter)); } else { outputCode = outputCode.concat(GetAction(model, subActionName, model.MethodParameter, keyToMatch, valueToMatch)); } @@ -52,10 +54,11 @@ export function GenerateAzureCliActions(model: CodeModelAz): string[] { } if (model.MethodParameter_IsPositional) { outputCode = outputCode.concat(GetPositionalAction(model, actionName, model.MethodParameter)); + } else if(model.MethodParameter_IsShorthandSyntax) { + outputCode = outputCode.concat(GetShorthandSyntaxAction(model, actionName, model.MethodParameter)); } else { outputCode = outputCode.concat(GetAction(model, actionName, model.MethodParameter)) } - } } while (model.SelectNextMethodParameter()); } @@ -212,6 +215,104 @@ function GetPositionalAction(model: CodeModelAz, actionName: string, param: Para } +function GetShorthandSyntaxAction(model: CodeModelAz, actionName: string, param: Parameter, keyToMatch: string = null, valueToMatch: string = null) { + let output: string[] = []; + allActions.set(actionName, true); + + output.push(""); + output.push(""); + let baseAction = "Action"; + let paramType = param?.schema?.type; + if (paramType == SchemaType.Array) baseAction = "_Append" + baseAction; + output.push("class " + actionName + "(argparse." + baseAction + "):"); + output.push(" def __call__(self, parser, namespace, values, option_string=None):"); + output.push(" action = self.get_action(values, option_string)"); + if (paramType == SchemaType.Array) { + output.push(" super(" + actionName + ", self).__call__(parser, namespace, action, option_string)"); + } else { + output.push(" namespace." + model.Parameter_MapsTo(param) + " = action"); + } + output.push(""); + output.push(" def get_action(self, values, option_string): # pylint: disable=no-self-use"); + output.push(" ret = []"); + output.push(" for item in values:") + output.push(" properties = defaultdict(list)"); + output.push(" try:"); + output.push(" for (k, v) in (x.split('=', 1) for x in item.split(',')):"); + output.push(" properties[k].append(v)"); + output.push(" properties = dict(properties)"); + output.push(" except ValueError:"); + output.push(" raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string))"); + output.push(" d = {}"); + + if (model.EnterSubMethodParameters()) { + if (model.SelectFirstMethodParameter(true)) { + do { + if (model.Parameter_DefaultValue(model.SubMethodParameter) !== undefined) { + output.push(" d['" + model.Parameter_NamePython(model.SubMethodParameter) + "'] = " + ToPythonString(model.Parameter_DefaultValue(model.SubMethodParameter), model.Parameter_Type(model.SubMethodParameter))); + } + } while (model.SelectNextMethodParameter(true)); + } + model.ExitSubMethodParameters(); + } + + output.push(" for k in properties:"); + output.push(" kl = k.lower()"); + output.push(" v = properties[k]"); + let foundProperties = false; + let preParamType = paramType; + if (model.EnterSubMethodParameters()) { + if (model.SelectFirstMethodParameter()) { + foundProperties = true; + let ifkv = "if"; + do { + if (model.SubMethodParameter['readOnly']) { + continue; + } + if (model.SubMethodParameter['schema']?.type == SchemaType.Constant) { + continue; + } + if (!isNullOrUndefined(keyToMatch) && !isNullOrUndefined(valueToMatch) && model.Parameter_NamePython(model.SubMethodParameter) == keyToMatch) { + continue; + } + output.push(" " + ifkv + " kl == '" + model.Parameter_NameAz(model.SubMethodParameter) + "':"); + if (model.MethodParameter_IsArray) { + output.push(" d['" + model.Parameter_NamePython(model.SubMethodParameter) + "'] = v"); + } + else { + output.push(" d['" + model.Parameter_NamePython(model.SubMethodParameter) + "'] = v[0]"); + } + ifkv = "elif"; + } while (model.SelectNextMethodParameter()); + } + model.ExitSubMethodParameters(); + } + + if (!foundProperties && preParamType == SchemaType.Dictionary) { + output.pop(); + output.pop(); + output.push(" v = properties[k]"); + output.push(" d[k] = v[0]"); + } + else if (!foundProperties && model.MethodParameter_IsArray) { + output.pop(); + output.pop(); + output.push(" v = properties[k]"); + output.push(" d[k] = v"); + } + else if (!isNullOrUndefined(keyToMatch) && !isNullOrUndefined(valueToMatch)) { + output.push(" d['" + keyToMatch + "'] = '" + valueToMatch + "'"); + } + output.push(" ret.append(d)"); + if (model.MethodParameter_Type == SchemaType.Array) { + output.push(" return ret"); + } else { + output.push(" return ret[0]"); + } + return output; +} + + function generateConstructObject(model: CodeModelAz, indent: string, pythonClassName: string, keyToMatch: string, valueToMatch: string, needReturn: boolean, keys: string[]) { let output: string[] = []; output.push(indent + (needReturn? "return ": "") + pythonClassName + "("); diff --git a/src/plugins/azgenerator/templates/generated/CliHelp.ts b/src/plugins/azgenerator/templates/generated/CliHelp.ts index ad79bd97..a790417f 100644 --- a/src/plugins/azgenerator/templates/generated/CliHelp.ts +++ b/src/plugins/azgenerator/templates/generated/CliHelp.ts @@ -163,10 +163,12 @@ function addParameterHelp(output: string[], model: CodeModelAz, debug: boolean) baseParam = model.MethodParameter; continue; } - if (!model.MethodParameter_IsPositional) { - parameter_output = parameter_output.concat(getKeyValueActionHelp(model, parameterAlias, baseParam, debug)); + if (model.MethodParameter_IsPositional) { + parameter_output = parameter_output.concat(getPositionalActionHelp(model, parameterAlias, baseParam, debug)); + } else if (model.MethodParameter_IsShorthandSyntax){ + parameter_output = parameter_output.concat(getShorthandSyntaxAction(model, parameterAlias, baseParam, debug)); } else { - parameter_output = parameter_output.concat(getPositionalActionHelp(model, parameterAlias, baseParam, debug)) + parameter_output = parameter_output.concat(getKeyValueActionHelp(model, parameterAlias, baseParam, debug)); } } } while (model.SelectNextMethodParameter()); @@ -183,6 +185,65 @@ function addParameterHelp(output: string[], model: CodeModelAz, debug: boolean) } +function getShorthandSyntaxAction(model: CodeModelAz, parameterAlias: string[], baseParam: Parameter, debug: boolean) { + let parameter_output: string[] = []; + let action_output: string[] = []; + ToMultiLine(` - name: ${parameterAlias.join(' ')}`, action_output, 119, true); + + if (debug) { + let shortSummary = '"'; + if (model.MethodParameter_Description && model.MethodParameter_Description.trim().length > 0) { + shortSummary += model.MethodParameter_Description.trim().replace(/"/g, '\\\\"'); + } + if (!shortSummary.endsWith(".")) { + shortSummary += "."; + } + shortSummary += " Swagger name=" + model.MethodParameter_CliKey + '"'; + ToMultiLine(` short-summary: ${shortSummary}`.replace(/\r?\n|\r/g, ''), action_output, 119, true); + } else { + if (model.MethodParameter_Description && model.MethodParameter_Description.trim().length > 0) { + const shortSummary = model.MethodParameter_Description.trim().replace(/"/g, '\\\\"'); + ToMultiLine(` short-summary: "${shortSummary}"`.replace(/\r?\n|\r/g, ''), action_output, 119, true); + } + } + + let options: Parameter[] = []; + if (!isNullOrUndefined(model.Schema_ActionName(model.MethodParameter.schema))) { + if (baseParam && model.MethodParameter['polyBaseParam'] == baseParam) { + let keyToMatch = baseParam.schema?.['discriminator']?.property?.language['python']?.name; + let valueToMatch = model.MethodParameter.schema?.['discriminatorValue']; + options = GetKeyValueActionOptions(model, null, keyToMatch, valueToMatch); + } + else { + options = GetKeyValueActionOptions(model, null); + } + } + if (options.length > 0) { + action_output.push(` long-summary: |`); + let optionUsage = " " + options.map(p => `${model.Parameter_NameAz(p)}=XX`).join(","); + if (model.MethodParameter_Type == SchemaType.Array) { + ToMultiLine(" Usage: " + parameterAlias[0] + optionUsage.repeat(2), action_output, 119, true); + } else { + ToMultiLine(" Usage: " + parameterAlias[0] + optionUsage, action_output, 119, true); + } + action_output.push(""); + for (let p of options) { + let pDesc = model.Parameter_Description(p); + if (!pDesc || pDesc.trim().length <= 0) continue; + let line = ` ${model.Parameter_NameAz(p)}: `; + if (p.required) line += "Required. "; + line += model.Parameter_Description(p).trim().replace(/\r?\n|\r/g, ''); + ToMultiLine(line, action_output, 119, true); + } + if (model.Schema_Type(model.MethodParameter.schema) == SchemaType.Array) { + action_output.push(""); + ToMultiLine(` Multiple actions can be specified by using more than one ${parameterAlias[0]} argument.`, action_output, 119, true); + } + parameter_output = parameter_output.concat(action_output); + } + return parameter_output; +} + function getPositionalActionHelp(model: CodeModelAz, parameterAlias: string[], baseParam: Parameter, debug: boolean) { let parameter_output: string[] = []; let action_output: string[] = []; diff --git a/src/test/scenarios/managed-network/configuration/readme.az.md b/src/test/scenarios/managed-network/configuration/readme.az.md index 3ee814ab..fe73ba9c 100644 --- a/src/test/scenarios/managed-network/configuration/readme.az.md +++ b/src/test/scenarios/managed-network/configuration/readme.az.md @@ -77,6 +77,10 @@ cli: max-api: '2020-05-01' min-api: '2019-05-01' resource-type: DATA_NETWORK + - where: + param: subnets + set: + shorthandSyntax: true #cli-flatten-directive: # - where: # type: ResourceProviderOperation diff --git a/src/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/_help.py b/src/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/_help.py index c632a328..b9b456aa 100644 --- a/src/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/_help.py +++ b/src/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/_help.py @@ -179,7 +179,7 @@ helps['managed-network mn group create'] = """ - name: --subnets short-summary: "The collection of subnets covered by the Managed Network" long-summary: | - Usage: --subnets id=XX + Usage: --subnets id=XX id=XX id: Resource Id @@ -217,7 +217,7 @@ helps['managed-network mn group update'] = """ - name: --subnets short-summary: "The collection of subnets covered by the Managed Network" long-summary: | - Usage: --subnets id=XX + Usage: --subnets id=XX id=XX id: Resource Id diff --git a/src/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/action.py b/src/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/action.py index 1d33ab61..8811ef2e 100644 --- a/src/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/action.py +++ b/src/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/action.py @@ -64,20 +64,23 @@ class AddSubnets(argparse._AppendAction): super(AddSubnets, self).__call__(parser, namespace, action, option_string) def get_action(self, values, option_string): # pylint: disable=no-self-use - try: + ret = [] + for item in values: 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 == 'id': - d['id'] = v[0] - return d + try: + for (k, v) in (x.split('=', 1) for x in item.split(',')): + 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 == 'id': + d['id'] = v[0] + ret.append(d) + return ret class AddHub(argparse.Action): diff --git a/src/test/scenarios/synapse/output/coredefault/src/azure-cli/azure/cli/command_modules/synapse/generated/_help.py b/src/test/scenarios/synapse/output/coredefault/src/azure-cli/azure/cli/command_modules/synapse/generated/_help.py index 3ac5f785..d084ef5f 100644 --- a/src/test/scenarios/synapse/output/coredefault/src/azure-cli/azure/cli/command_modules/synapse/generated/_help.py +++ b/src/test/scenarios/synapse/output/coredefault/src/azure-cli/azure/cli/command_modules/synapse/generated/_help.py @@ -1060,8 +1060,8 @@ helps['synapse workspace-managed-identity-sql-control-setting create'] = """ examples: - name: Create or update managed identity sql control settings text: |- - az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" \ ---workspace-name "workspace1" + az synapse workspace-managed-identity-sql-control-setting create --grant-sql-control-to-managed-identity\ +-desired-state "Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1" """ helps['synapse workspace-managed-identity-sql-control-setting update'] = """ diff --git a/src/test/scenarios/synapse/output/coredefault/src/azure-cli/azure/cli/command_modules/synapse/report.md b/src/test/scenarios/synapse/output/coredefault/src/azure-cli/azure/cli/command_modules/synapse/report.md index 3ae7e359..84855fb7 100644 --- a/src/test/scenarios/synapse/output/coredefault/src/azure-cli/azure/cli/command_modules/synapse/report.md +++ b/src/test/scenarios/synapse/output/coredefault/src/azure-cli/azure/cli/command_modules/synapse/report.md @@ -1961,8 +1961,8 @@ az synapse workspace-managed-identity-sql-control-setting show --resource-group ##### Example ``` -az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" --workspace-name \ -"workspace1" +az synapse workspace-managed-identity-sql-control-setting create --grant-sql-control-to-managed-identity-desired-state \ +"Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| diff --git a/src/test/scenarios/synapse/output/coredefault/src/azure-cli/azure/cli/command_modules/synapse/tests/latest/example_steps.py b/src/test/scenarios/synapse/output/coredefault/src/azure-cli/azure/cli/command_modules/synapse/tests/latest/example_steps.py index 54b38833..4482ab9a 100644 --- a/src/test/scenarios/synapse/output/coredefault/src/azure-cli/azure/cli/command_modules/synapse/tests/latest/example_steps.py +++ b/src/test/scenarios/synapse/output/coredefault/src/azure-cli/azure/cli/command_modules/synapse/tests/latest/example_steps.py @@ -1441,6 +1441,7 @@ def step_workspace_managed_identity(test, rg_5, rg, rg_2, rg_3, rg_4, rg_6, rg_7 if checks is None: checks = [] test.cmd('az synapse workspace-managed-identity-sql-control-setting create ' + '--grant-sql-control-to-managed-identity-desired-state "Enabled" ' '--resource-group "{rg_2}" ' '--workspace-name "{myWorkspace2}"', checks=checks) diff --git a/src/test/scenarios/synapse/output/extnoflatten/src/synapse/README.md b/src/test/scenarios/synapse/output/extnoflatten/src/synapse/README.md index 34117da0..c4bde40d 100644 --- a/src/test/scenarios/synapse/output/extnoflatten/src/synapse/README.md +++ b/src/test/scenarios/synapse/output/extnoflatten/src/synapse/README.md @@ -412,7 +412,8 @@ az synapse workspace-aad-admin delete --resource-group "resourceGroup1" --worksp #### synapse workspace-managed-identity-sql-control-setting #### ##### Create ##### ``` -az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" \ +az synapse workspace-managed-identity-sql-control-setting create \ + --grant-sql-control-to-managed-identity-desired-state "Enabled" --resource-group "resourceGroup1" \ --workspace-name "workspace1" ``` ##### Show ##### diff --git a/src/test/scenarios/synapse/output/extnoflatten/src/synapse/azext_synapse/generated/_help.py b/src/test/scenarios/synapse/output/extnoflatten/src/synapse/azext_synapse/generated/_help.py index 3ac5f785..d084ef5f 100644 --- a/src/test/scenarios/synapse/output/extnoflatten/src/synapse/azext_synapse/generated/_help.py +++ b/src/test/scenarios/synapse/output/extnoflatten/src/synapse/azext_synapse/generated/_help.py @@ -1060,8 +1060,8 @@ helps['synapse workspace-managed-identity-sql-control-setting create'] = """ examples: - name: Create or update managed identity sql control settings text: |- - az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" \ ---workspace-name "workspace1" + az synapse workspace-managed-identity-sql-control-setting create --grant-sql-control-to-managed-identity\ +-desired-state "Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1" """ helps['synapse workspace-managed-identity-sql-control-setting update'] = """ diff --git a/src/test/scenarios/synapse/output/extnoflatten/src/synapse/azext_synapse/tests/latest/example_steps.py b/src/test/scenarios/synapse/output/extnoflatten/src/synapse/azext_synapse/tests/latest/example_steps.py index 54b38833..4482ab9a 100644 --- a/src/test/scenarios/synapse/output/extnoflatten/src/synapse/azext_synapse/tests/latest/example_steps.py +++ b/src/test/scenarios/synapse/output/extnoflatten/src/synapse/azext_synapse/tests/latest/example_steps.py @@ -1441,6 +1441,7 @@ def step_workspace_managed_identity(test, rg_5, rg, rg_2, rg_3, rg_4, rg_6, rg_7 if checks is None: checks = [] test.cmd('az synapse workspace-managed-identity-sql-control-setting create ' + '--grant-sql-control-to-managed-identity-desired-state "Enabled" ' '--resource-group "{rg_2}" ' '--workspace-name "{myWorkspace2}"', checks=checks) diff --git a/src/test/scenarios/synapse/output/extnoflatten/src/synapse/report.md b/src/test/scenarios/synapse/output/extnoflatten/src/synapse/report.md index 3ae7e359..84855fb7 100644 --- a/src/test/scenarios/synapse/output/extnoflatten/src/synapse/report.md +++ b/src/test/scenarios/synapse/output/extnoflatten/src/synapse/report.md @@ -1961,8 +1961,8 @@ az synapse workspace-managed-identity-sql-control-setting show --resource-group ##### Example ``` -az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" --workspace-name \ -"workspace1" +az synapse workspace-managed-identity-sql-control-setting create --grant-sql-control-to-managed-identity-desired-state \ +"Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| diff --git a/src/test/scenarios/synapse/output/extnosdk/src/synapse/README.md b/src/test/scenarios/synapse/output/extnosdk/src/synapse/README.md index 34117da0..c4bde40d 100644 --- a/src/test/scenarios/synapse/output/extnosdk/src/synapse/README.md +++ b/src/test/scenarios/synapse/output/extnosdk/src/synapse/README.md @@ -412,7 +412,8 @@ az synapse workspace-aad-admin delete --resource-group "resourceGroup1" --worksp #### synapse workspace-managed-identity-sql-control-setting #### ##### Create ##### ``` -az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" \ +az synapse workspace-managed-identity-sql-control-setting create \ + --grant-sql-control-to-managed-identity-desired-state "Enabled" --resource-group "resourceGroup1" \ --workspace-name "workspace1" ``` ##### Show ##### diff --git a/src/test/scenarios/synapse/output/extnosdk/src/synapse/azext_synapse/generated/_help.py b/src/test/scenarios/synapse/output/extnosdk/src/synapse/azext_synapse/generated/_help.py index 3ac5f785..d084ef5f 100644 --- a/src/test/scenarios/synapse/output/extnosdk/src/synapse/azext_synapse/generated/_help.py +++ b/src/test/scenarios/synapse/output/extnosdk/src/synapse/azext_synapse/generated/_help.py @@ -1060,8 +1060,8 @@ helps['synapse workspace-managed-identity-sql-control-setting create'] = """ examples: - name: Create or update managed identity sql control settings text: |- - az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" \ ---workspace-name "workspace1" + az synapse workspace-managed-identity-sql-control-setting create --grant-sql-control-to-managed-identity\ +-desired-state "Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1" """ helps['synapse workspace-managed-identity-sql-control-setting update'] = """ diff --git a/src/test/scenarios/synapse/output/extnosdk/src/synapse/azext_synapse/tests/latest/example_steps.py b/src/test/scenarios/synapse/output/extnosdk/src/synapse/azext_synapse/tests/latest/example_steps.py index 54b38833..4482ab9a 100644 --- a/src/test/scenarios/synapse/output/extnosdk/src/synapse/azext_synapse/tests/latest/example_steps.py +++ b/src/test/scenarios/synapse/output/extnosdk/src/synapse/azext_synapse/tests/latest/example_steps.py @@ -1441,6 +1441,7 @@ def step_workspace_managed_identity(test, rg_5, rg, rg_2, rg_3, rg_4, rg_6, rg_7 if checks is None: checks = [] test.cmd('az synapse workspace-managed-identity-sql-control-setting create ' + '--grant-sql-control-to-managed-identity-desired-state "Enabled" ' '--resource-group "{rg_2}" ' '--workspace-name "{myWorkspace2}"', checks=checks) diff --git a/src/test/scenarios/synapse/output/extnosdk/src/synapse/report.md b/src/test/scenarios/synapse/output/extnosdk/src/synapse/report.md index 3ae7e359..84855fb7 100644 --- a/src/test/scenarios/synapse/output/extnosdk/src/synapse/report.md +++ b/src/test/scenarios/synapse/output/extnosdk/src/synapse/report.md @@ -1961,8 +1961,8 @@ az synapse workspace-managed-identity-sql-control-setting show --resource-group ##### Example ``` -az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" --workspace-name \ -"workspace1" +az synapse workspace-managed-identity-sql-control-setting create --grant-sql-control-to-managed-identity-desired-state \ +"Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| diff --git a/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/README.md b/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/README.md index 34117da0..c4bde40d 100644 --- a/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/README.md +++ b/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/README.md @@ -412,7 +412,8 @@ az synapse workspace-aad-admin delete --resource-group "resourceGroup1" --worksp #### synapse workspace-managed-identity-sql-control-setting #### ##### Create ##### ``` -az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" \ +az synapse workspace-managed-identity-sql-control-setting create \ + --grant-sql-control-to-managed-identity-desired-state "Enabled" --resource-group "resourceGroup1" \ --workspace-name "workspace1" ``` ##### Show ##### diff --git a/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/azext_synapse/generated/_help.py b/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/azext_synapse/generated/_help.py index 3ac5f785..d084ef5f 100644 --- a/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/azext_synapse/generated/_help.py +++ b/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/azext_synapse/generated/_help.py @@ -1060,8 +1060,8 @@ helps['synapse workspace-managed-identity-sql-control-setting create'] = """ examples: - name: Create or update managed identity sql control settings text: |- - az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" \ ---workspace-name "workspace1" + az synapse workspace-managed-identity-sql-control-setting create --grant-sql-control-to-managed-identity\ +-desired-state "Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1" """ helps['synapse workspace-managed-identity-sql-control-setting update'] = """ diff --git a/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/azext_synapse/tests/latest/example_steps.py b/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/azext_synapse/tests/latest/example_steps.py index 54b38833..4482ab9a 100644 --- a/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/azext_synapse/tests/latest/example_steps.py +++ b/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/azext_synapse/tests/latest/example_steps.py @@ -1441,6 +1441,7 @@ def step_workspace_managed_identity(test, rg_5, rg, rg_2, rg_3, rg_4, rg_6, rg_7 if checks is None: checks = [] test.cmd('az synapse workspace-managed-identity-sql-control-setting create ' + '--grant-sql-control-to-managed-identity-desired-state "Enabled" ' '--resource-group "{rg_2}" ' '--workspace-name "{myWorkspace2}"', checks=checks) diff --git a/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/report.md b/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/report.md index 3ae7e359..84855fb7 100644 --- a/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/report.md +++ b/src/test/scenarios/synapse/output/extnosdknoflattentrack1/src/synapse/report.md @@ -1961,8 +1961,8 @@ az synapse workspace-managed-identity-sql-control-setting show --resource-group ##### Example ``` -az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" --workspace-name \ -"workspace1" +az synapse workspace-managed-identity-sql-control-setting create --grant-sql-control-to-managed-identity-desired-state \ +"Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name|