зеркало из https://github.com/Azure/autorest.az.git
aws shorthand syntax support (#626)
This commit is contained in:
Родитель
56c7edeaf6
Коммит
a45f711ca2
|
@ -13,7 +13,7 @@ debug-output-folder: $(az-output-folder)/_az_debug
|
||||||
|
|
||||||
use-extension:
|
use-extension:
|
||||||
"@autorest/python": "5.4.0"
|
"@autorest/python": "5.4.0"
|
||||||
"@autorest/clicommon": "0.5.6"
|
"@autorest/clicommon": "0.5.7"
|
||||||
#"@autorest/python": "latest"
|
#"@autorest/python": "latest"
|
||||||
|
|
||||||
require:
|
require:
|
||||||
|
|
18
doc/faq.md
18
doc/faq.md
|
@ -432,3 +432,21 @@ cli:
|
||||||
```
|
```
|
||||||
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.
|
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.
|
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).
|
|
@ -184,6 +184,7 @@ export interface CodeModelAz {
|
||||||
MethodParameter_DefaultConfigKey: string | undefined;
|
MethodParameter_DefaultConfigKey: string | undefined;
|
||||||
MethodParameter_Mode: string;
|
MethodParameter_Mode: string;
|
||||||
MethodParameter_IsPositional: boolean;
|
MethodParameter_IsPositional: boolean;
|
||||||
|
MethodParameter_IsShorthandSyntax: boolean;
|
||||||
MethodParameter_PositionalKeys: string[];
|
MethodParameter_PositionalKeys: string[];
|
||||||
Parameter_Type(Parameter): string;
|
Parameter_Type(Parameter): string;
|
||||||
Schema_Type(Schema): string;
|
Schema_Type(Schema): string;
|
||||||
|
@ -207,6 +208,7 @@ export interface CodeModelAz {
|
||||||
Parameter_DefaultValue(Parameter): any | undefined;
|
Parameter_DefaultValue(Parameter): any | undefined;
|
||||||
Parameter_DefaultConfigKey(Parameter): string | undefined;
|
Parameter_DefaultConfigKey(Parameter): string | undefined;
|
||||||
Parameter_IsPositional(Parameter): boolean;
|
Parameter_IsPositional(Parameter): boolean;
|
||||||
|
Parameter_IsShorthandSyntax(Parameter): boolean;
|
||||||
Schema_Description(Schema): string;
|
Schema_Description(Schema): string;
|
||||||
Schema_FlattenedFrom(Schema): Schema;
|
Schema_FlattenedFrom(Schema): Schema;
|
||||||
Schema_IsPositional(Schema): boolean;
|
Schema_IsPositional(Schema): boolean;
|
||||||
|
|
|
@ -1252,6 +1252,10 @@ export class CodeModelCliImpl implements CodeModelAz {
|
||||||
return this.Parameter_IsPositional(this.MethodParameter);
|
return this.Parameter_IsPositional(this.MethodParameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get MethodParameter_IsShorthandSyntax(): boolean {
|
||||||
|
return this.Parameter_IsShorthandSyntax(this.MethodParameter);
|
||||||
|
}
|
||||||
|
|
||||||
private isComplexSchema(type: string): boolean {
|
private isComplexSchema(type: string): boolean {
|
||||||
if (type == SchemaType.Array || type == SchemaType.Object || type == SchemaType.Dictionary || type == SchemaType.Any ||
|
if (type == SchemaType.Array || type == SchemaType.Object || type == SchemaType.Dictionary || type == SchemaType.Any ||
|
||||||
this.MethodParameter.language['cli'].json == true)
|
this.MethodParameter.language['cli'].json == true)
|
||||||
|
@ -1279,6 +1283,10 @@ export class CodeModelCliImpl implements CodeModelAz {
|
||||||
return param['flattened'] ? true : false;
|
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 {
|
public Parameter_IsCliFlattened(param: Parameter = this.MethodParameter): boolean {
|
||||||
if (param?.language?.['cli']?.['cli-flattened'] && !param.language['cli']['cli-m4-flattened']) {
|
if (param?.language?.['cli']?.['cli-flattened'] && !param.language['cli']['cli-m4-flattened']) {
|
||||||
if (param['nameBaseParam']?.language?.['cli']?.['cli-m4-flattened']) {
|
if (param['nameBaseParam']?.language?.['cli']?.['cli-m4-flattened']) {
|
||||||
|
|
|
@ -36,6 +36,8 @@ export function GenerateAzureCliActions(model: CodeModelAz): string[] {
|
||||||
}
|
}
|
||||||
if (model.MethodParameter_IsPositional) {
|
if (model.MethodParameter_IsPositional) {
|
||||||
outputCode = outputCode.concat(GetPositionalAction(model, subActionName, model.MethodParameter));
|
outputCode = outputCode.concat(GetPositionalAction(model, subActionName, model.MethodParameter));
|
||||||
|
} else if(model.MethodParameter_IsShorthandSyntax) {
|
||||||
|
outputCode = outputCode.concat(GetShorthandSyntaxAction(model, subActionName, model.MethodParameter));
|
||||||
} else {
|
} else {
|
||||||
outputCode = outputCode.concat(GetAction(model, subActionName, model.MethodParameter, keyToMatch, valueToMatch));
|
outputCode = outputCode.concat(GetAction(model, subActionName, model.MethodParameter, keyToMatch, valueToMatch));
|
||||||
}
|
}
|
||||||
|
@ -52,10 +54,11 @@ export function GenerateAzureCliActions(model: CodeModelAz): string[] {
|
||||||
}
|
}
|
||||||
if (model.MethodParameter_IsPositional) {
|
if (model.MethodParameter_IsPositional) {
|
||||||
outputCode = outputCode.concat(GetPositionalAction(model, actionName, model.MethodParameter));
|
outputCode = outputCode.concat(GetPositionalAction(model, actionName, model.MethodParameter));
|
||||||
|
} else if(model.MethodParameter_IsShorthandSyntax) {
|
||||||
|
outputCode = outputCode.concat(GetShorthandSyntaxAction(model, actionName, model.MethodParameter));
|
||||||
} else {
|
} else {
|
||||||
outputCode = outputCode.concat(GetAction(model, actionName, model.MethodParameter))
|
outputCode = outputCode.concat(GetAction(model, actionName, model.MethodParameter))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} while (model.SelectNextMethodParameter());
|
} 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[]) {
|
function generateConstructObject(model: CodeModelAz, indent: string, pythonClassName: string, keyToMatch: string, valueToMatch: string, needReturn: boolean, keys: string[]) {
|
||||||
let output: string[] = [];
|
let output: string[] = [];
|
||||||
output.push(indent + (needReturn? "return ": "") + pythonClassName + "(");
|
output.push(indent + (needReturn? "return ": "") + pythonClassName + "(");
|
||||||
|
|
|
@ -163,10 +163,12 @@ function addParameterHelp(output: string[], model: CodeModelAz, debug: boolean)
|
||||||
baseParam = model.MethodParameter;
|
baseParam = model.MethodParameter;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!model.MethodParameter_IsPositional) {
|
if (model.MethodParameter_IsPositional) {
|
||||||
parameter_output = parameter_output.concat(getKeyValueActionHelp(model, parameterAlias, baseParam, debug));
|
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 {
|
} else {
|
||||||
parameter_output = parameter_output.concat(getPositionalActionHelp(model, parameterAlias, baseParam, debug))
|
parameter_output = parameter_output.concat(getKeyValueActionHelp(model, parameterAlias, baseParam, debug));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (model.SelectNextMethodParameter());
|
} 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) {
|
function getPositionalActionHelp(model: CodeModelAz, parameterAlias: string[], baseParam: Parameter, debug: boolean) {
|
||||||
let parameter_output: string[] = [];
|
let parameter_output: string[] = [];
|
||||||
let action_output: string[] = [];
|
let action_output: string[] = [];
|
||||||
|
|
|
@ -77,6 +77,10 @@ cli:
|
||||||
max-api: '2020-05-01'
|
max-api: '2020-05-01'
|
||||||
min-api: '2019-05-01'
|
min-api: '2019-05-01'
|
||||||
resource-type: DATA_NETWORK
|
resource-type: DATA_NETWORK
|
||||||
|
- where:
|
||||||
|
param: subnets
|
||||||
|
set:
|
||||||
|
shorthandSyntax: true
|
||||||
#cli-flatten-directive:
|
#cli-flatten-directive:
|
||||||
# - where:
|
# - where:
|
||||||
# type: ResourceProviderOperation
|
# type: ResourceProviderOperation
|
||||||
|
|
|
@ -179,7 +179,7 @@ helps['managed-network mn group create'] = """
|
||||||
- name: --subnets
|
- name: --subnets
|
||||||
short-summary: "The collection of subnets covered by the Managed Network"
|
short-summary: "The collection of subnets covered by the Managed Network"
|
||||||
long-summary: |
|
long-summary: |
|
||||||
Usage: --subnets id=XX
|
Usage: --subnets id=XX id=XX
|
||||||
|
|
||||||
id: Resource Id
|
id: Resource Id
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ helps['managed-network mn group update'] = """
|
||||||
- name: --subnets
|
- name: --subnets
|
||||||
short-summary: "The collection of subnets covered by the Managed Network"
|
short-summary: "The collection of subnets covered by the Managed Network"
|
||||||
long-summary: |
|
long-summary: |
|
||||||
Usage: --subnets id=XX
|
Usage: --subnets id=XX id=XX
|
||||||
|
|
||||||
id: Resource Id
|
id: Resource Id
|
||||||
|
|
||||||
|
|
|
@ -64,9 +64,11 @@ class AddSubnets(argparse._AppendAction):
|
||||||
super(AddSubnets, self).__call__(parser, namespace, action, option_string)
|
super(AddSubnets, self).__call__(parser, namespace, action, option_string)
|
||||||
|
|
||||||
def get_action(self, values, option_string): # pylint: disable=no-self-use
|
def get_action(self, values, option_string): # pylint: disable=no-self-use
|
||||||
try:
|
ret = []
|
||||||
|
for item in values:
|
||||||
properties = defaultdict(list)
|
properties = defaultdict(list)
|
||||||
for (k, v) in (x.split('=', 1) for x in values):
|
try:
|
||||||
|
for (k, v) in (x.split('=', 1) for x in item.split(',')):
|
||||||
properties[k].append(v)
|
properties[k].append(v)
|
||||||
properties = dict(properties)
|
properties = dict(properties)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -77,7 +79,8 @@ class AddSubnets(argparse._AppendAction):
|
||||||
v = properties[k]
|
v = properties[k]
|
||||||
if kl == 'id':
|
if kl == 'id':
|
||||||
d['id'] = v[0]
|
d['id'] = v[0]
|
||||||
return d
|
ret.append(d)
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
class AddHub(argparse.Action):
|
class AddHub(argparse.Action):
|
||||||
|
|
|
@ -1060,8 +1060,8 @@ helps['synapse workspace-managed-identity-sql-control-setting create'] = """
|
||||||
examples:
|
examples:
|
||||||
- name: Create or update managed identity sql control settings
|
- name: Create or update managed identity sql control settings
|
||||||
text: |-
|
text: |-
|
||||||
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\
|
||||||
--workspace-name "workspace1"
|
-desired-state "Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
helps['synapse workspace-managed-identity-sql-control-setting update'] = """
|
helps['synapse workspace-managed-identity-sql-control-setting update'] = """
|
||||||
|
|
|
@ -1961,8 +1961,8 @@ az synapse workspace-managed-identity-sql-control-setting show --resource-group
|
||||||
|
|
||||||
##### <a name="ExamplesWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Example</a>
|
##### <a name="ExamplesWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Example</a>
|
||||||
```
|
```
|
||||||
az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" --workspace-name \
|
az synapse workspace-managed-identity-sql-control-setting create --grant-sql-control-to-managed-identity-desired-state \
|
||||||
"workspace1"
|
"Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1"
|
||||||
```
|
```
|
||||||
##### <a name="ParametersWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Parameters</a>
|
##### <a name="ParametersWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Parameters</a>
|
||||||
|Option|Type|Description|Path (SDK)|Swagger name|
|
|Option|Type|Description|Path (SDK)|Swagger name|
|
||||||
|
|
|
@ -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:
|
if checks is None:
|
||||||
checks = []
|
checks = []
|
||||||
test.cmd('az synapse workspace-managed-identity-sql-control-setting create '
|
test.cmd('az synapse workspace-managed-identity-sql-control-setting create '
|
||||||
|
'--grant-sql-control-to-managed-identity-desired-state "Enabled" '
|
||||||
'--resource-group "{rg_2}" '
|
'--resource-group "{rg_2}" '
|
||||||
'--workspace-name "{myWorkspace2}"',
|
'--workspace-name "{myWorkspace2}"',
|
||||||
checks=checks)
|
checks=checks)
|
||||||
|
|
|
@ -412,7 +412,8 @@ az synapse workspace-aad-admin delete --resource-group "resourceGroup1" --worksp
|
||||||
#### synapse workspace-managed-identity-sql-control-setting ####
|
#### synapse workspace-managed-identity-sql-control-setting ####
|
||||||
##### Create #####
|
##### 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"
|
--workspace-name "workspace1"
|
||||||
```
|
```
|
||||||
##### Show #####
|
##### Show #####
|
||||||
|
|
|
@ -1060,8 +1060,8 @@ helps['synapse workspace-managed-identity-sql-control-setting create'] = """
|
||||||
examples:
|
examples:
|
||||||
- name: Create or update managed identity sql control settings
|
- name: Create or update managed identity sql control settings
|
||||||
text: |-
|
text: |-
|
||||||
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\
|
||||||
--workspace-name "workspace1"
|
-desired-state "Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
helps['synapse workspace-managed-identity-sql-control-setting update'] = """
|
helps['synapse workspace-managed-identity-sql-control-setting update'] = """
|
||||||
|
|
|
@ -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:
|
if checks is None:
|
||||||
checks = []
|
checks = []
|
||||||
test.cmd('az synapse workspace-managed-identity-sql-control-setting create '
|
test.cmd('az synapse workspace-managed-identity-sql-control-setting create '
|
||||||
|
'--grant-sql-control-to-managed-identity-desired-state "Enabled" '
|
||||||
'--resource-group "{rg_2}" '
|
'--resource-group "{rg_2}" '
|
||||||
'--workspace-name "{myWorkspace2}"',
|
'--workspace-name "{myWorkspace2}"',
|
||||||
checks=checks)
|
checks=checks)
|
||||||
|
|
|
@ -1961,8 +1961,8 @@ az synapse workspace-managed-identity-sql-control-setting show --resource-group
|
||||||
|
|
||||||
##### <a name="ExamplesWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Example</a>
|
##### <a name="ExamplesWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Example</a>
|
||||||
```
|
```
|
||||||
az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" --workspace-name \
|
az synapse workspace-managed-identity-sql-control-setting create --grant-sql-control-to-managed-identity-desired-state \
|
||||||
"workspace1"
|
"Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1"
|
||||||
```
|
```
|
||||||
##### <a name="ParametersWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Parameters</a>
|
##### <a name="ParametersWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Parameters</a>
|
||||||
|Option|Type|Description|Path (SDK)|Swagger name|
|
|Option|Type|Description|Path (SDK)|Swagger name|
|
||||||
|
|
|
@ -412,7 +412,8 @@ az synapse workspace-aad-admin delete --resource-group "resourceGroup1" --worksp
|
||||||
#### synapse workspace-managed-identity-sql-control-setting ####
|
#### synapse workspace-managed-identity-sql-control-setting ####
|
||||||
##### Create #####
|
##### 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"
|
--workspace-name "workspace1"
|
||||||
```
|
```
|
||||||
##### Show #####
|
##### Show #####
|
||||||
|
|
|
@ -1060,8 +1060,8 @@ helps['synapse workspace-managed-identity-sql-control-setting create'] = """
|
||||||
examples:
|
examples:
|
||||||
- name: Create or update managed identity sql control settings
|
- name: Create or update managed identity sql control settings
|
||||||
text: |-
|
text: |-
|
||||||
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\
|
||||||
--workspace-name "workspace1"
|
-desired-state "Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
helps['synapse workspace-managed-identity-sql-control-setting update'] = """
|
helps['synapse workspace-managed-identity-sql-control-setting update'] = """
|
||||||
|
|
|
@ -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:
|
if checks is None:
|
||||||
checks = []
|
checks = []
|
||||||
test.cmd('az synapse workspace-managed-identity-sql-control-setting create '
|
test.cmd('az synapse workspace-managed-identity-sql-control-setting create '
|
||||||
|
'--grant-sql-control-to-managed-identity-desired-state "Enabled" '
|
||||||
'--resource-group "{rg_2}" '
|
'--resource-group "{rg_2}" '
|
||||||
'--workspace-name "{myWorkspace2}"',
|
'--workspace-name "{myWorkspace2}"',
|
||||||
checks=checks)
|
checks=checks)
|
||||||
|
|
|
@ -1961,8 +1961,8 @@ az synapse workspace-managed-identity-sql-control-setting show --resource-group
|
||||||
|
|
||||||
##### <a name="ExamplesWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Example</a>
|
##### <a name="ExamplesWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Example</a>
|
||||||
```
|
```
|
||||||
az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" --workspace-name \
|
az synapse workspace-managed-identity-sql-control-setting create --grant-sql-control-to-managed-identity-desired-state \
|
||||||
"workspace1"
|
"Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1"
|
||||||
```
|
```
|
||||||
##### <a name="ParametersWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Parameters</a>
|
##### <a name="ParametersWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Parameters</a>
|
||||||
|Option|Type|Description|Path (SDK)|Swagger name|
|
|Option|Type|Description|Path (SDK)|Swagger name|
|
||||||
|
|
|
@ -412,7 +412,8 @@ az synapse workspace-aad-admin delete --resource-group "resourceGroup1" --worksp
|
||||||
#### synapse workspace-managed-identity-sql-control-setting ####
|
#### synapse workspace-managed-identity-sql-control-setting ####
|
||||||
##### Create #####
|
##### 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"
|
--workspace-name "workspace1"
|
||||||
```
|
```
|
||||||
##### Show #####
|
##### Show #####
|
||||||
|
|
|
@ -1060,8 +1060,8 @@ helps['synapse workspace-managed-identity-sql-control-setting create'] = """
|
||||||
examples:
|
examples:
|
||||||
- name: Create or update managed identity sql control settings
|
- name: Create or update managed identity sql control settings
|
||||||
text: |-
|
text: |-
|
||||||
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\
|
||||||
--workspace-name "workspace1"
|
-desired-state "Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
helps['synapse workspace-managed-identity-sql-control-setting update'] = """
|
helps['synapse workspace-managed-identity-sql-control-setting update'] = """
|
||||||
|
|
|
@ -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:
|
if checks is None:
|
||||||
checks = []
|
checks = []
|
||||||
test.cmd('az synapse workspace-managed-identity-sql-control-setting create '
|
test.cmd('az synapse workspace-managed-identity-sql-control-setting create '
|
||||||
|
'--grant-sql-control-to-managed-identity-desired-state "Enabled" '
|
||||||
'--resource-group "{rg_2}" '
|
'--resource-group "{rg_2}" '
|
||||||
'--workspace-name "{myWorkspace2}"',
|
'--workspace-name "{myWorkspace2}"',
|
||||||
checks=checks)
|
checks=checks)
|
||||||
|
|
|
@ -1961,8 +1961,8 @@ az synapse workspace-managed-identity-sql-control-setting show --resource-group
|
||||||
|
|
||||||
##### <a name="ExamplesWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Example</a>
|
##### <a name="ExamplesWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Example</a>
|
||||||
```
|
```
|
||||||
az synapse workspace-managed-identity-sql-control-setting create --resource-group "resourceGroup1" --workspace-name \
|
az synapse workspace-managed-identity-sql-control-setting create --grant-sql-control-to-managed-identity-desired-state \
|
||||||
"workspace1"
|
"Enabled" --resource-group "resourceGroup1" --workspace-name "workspace1"
|
||||||
```
|
```
|
||||||
##### <a name="ParametersWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Parameters</a>
|
##### <a name="ParametersWorkspaceManagedIdentitySqlControlSettingsCreateOrUpdate#Create">Parameters</a>
|
||||||
|Option|Type|Description|Path (SDK)|Swagger name|
|
|Option|Type|Description|Path (SDK)|Swagger name|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче