diff --git a/README.md b/README.md index aaabb9d11..d13b3c0ac 100644 --- a/README.md +++ b/README.md @@ -460,7 +460,7 @@ debug-output-folder: $(az-output-folder)/_az_debug use-extension: "@autorest/python": "5.4.0" - "@autorest/clicommon": "0.6.1" + "@autorest/clicommon": "0.6.2" #"@autorest/python": "latest" require: diff --git a/src/aznamer.ts b/src/aznamer.ts index 8d078b64f..7e93b3c5c 100644 --- a/src/aznamer.ts +++ b/src/aznamer.ts @@ -1,4 +1,4 @@ -import { CodeModel, codeModelSchema, Language } from '@azure-tools/codemodel'; +import { AnySchema, CodeModel, codeModelSchema, Language } from '@azure-tools/codemodel'; import { Session, startSession, Host, Channel } from '@autorest/extension-base'; import { serialize } from '@azure-tools/codegen'; import { values } from '@azure-tools/linq'; @@ -20,8 +20,12 @@ export class AzNamer { let ons: Array = []; if (operationNameOri.indexOf('#') > -1) { ons = operationNameOri.split('#'); - if (ons && ons.length === 2) { - subOperationGroupName = changeCamelToDash(ons[1]); + if (ons && ons.length >= 2) { + const subgroups = []; + for (let i = 1; i < ons.length; i++) { + subgroups.push(changeCamelToDash(ons[i])); + } + subOperationGroupName = subgroups.join(' '); operationName = ons[0].toLowerCase(); } } @@ -80,7 +84,7 @@ export class AzNamer { return this.codeModel; } - getAzName(obj) { + getAzName(obj, methodKey?) { if (obj.language['az']) { return; } @@ -90,6 +94,13 @@ export class AzNamer { : obj.language.python.name; obj.language['az'].name = changeCamelToDash(obj.language['az'].name); obj.language['az'].mapsto = obj.language['az'].name.replace(/-/g, '_'); + if ( + !isNullOrUndefined(obj['nameBaseParam']) && + !isNullOrUndefined(methodKey) && + !isNullOrUndefined(obj['nameBaseParam'].subParams?.[methodKey]) + ) { + obj['nameBaseParam'].subParams[methodKey] = obj.language['az'].mapsto; + } obj.language['az'].description = obj.language['cli'] ? obj.language['cli'].description : obj.language.python.description; @@ -272,7 +283,7 @@ export class AzNamer { } operation.parameters.forEach((parameter) => { if (!isNullOrUndefined(parameter.language['cli'])) { - this.getAzName(parameter); + this.getAzName(parameter, operation.language['cli'].name); for (const k of ['alias', 'positionalKeys']) { this.addAttributes(parameter, false, k); this.addAttributes(parameter, true, k); @@ -287,7 +298,7 @@ export class AzNamer { if (request.parameters) { request.parameters.forEach((parameter) => { if (!isNullOrUndefined(parameter.language['cli'])) { - this.getAzName(parameter); + this.getAzName(parameter, operation.language['cli'].name); for (const k of ['alias', 'positionalKeys']) { this.addAttributes(parameter, false, k); this.addAttributes(parameter, true, k); diff --git a/src/generate/codemodel/CodeModelAzImpl.ts b/src/generate/codemodel/CodeModelAzImpl.ts index 8cac5e0b2..0c1cd5770 100644 --- a/src/generate/codemodel/CodeModelAzImpl.ts +++ b/src/generate/codemodel/CodeModelAzImpl.ts @@ -194,11 +194,11 @@ export class CodeModelCliImpl implements CodeModelAz { do { if ( !paramRequired.has( - this.methodParameterHandler.MethodParameter_Name, + this.methodParameterHandler.MethodParameter_MapsTo, ) ) { paramRequired.set( - this.methodParameterHandler.MethodParameter_Name, + this.methodParameterHandler.MethodParameter_MapsTo, this.methodParameterHandler.MethodParameter_IsRequired ? 1 : 0, @@ -207,9 +207,9 @@ export class CodeModelCliImpl implements CodeModelAz { this.methodParameterHandler.MethodParameter_IsRequired ) { paramRequired.set( - this.methodParameterHandler.MethodParameter_Name, + this.methodParameterHandler.MethodParameter_MapsTo, paramRequired.get( - this.methodParameterHandler.MethodParameter_Name, + this.methodParameterHandler.MethodParameter_MapsTo, ) + 1, ); } @@ -221,11 +221,11 @@ export class CodeModelCliImpl implements CodeModelAz { do { if ( !paramRequired.has( - this.methodParameterHandler.MethodParameter_Name, + this.methodParameterHandler.MethodParameter_MapsTo, ) ) { paramRequired.set( - this.methodParameterHandler.MethodParameter_Name, + this.methodParameterHandler.MethodParameter_MapsTo, this.methodParameterHandler .MethodParameter_IsRequired ? 1 @@ -235,10 +235,10 @@ export class CodeModelCliImpl implements CodeModelAz { this.methodParameterHandler.MethodParameter_IsRequired ) { paramRequired.set( - this.methodParameterHandler.MethodParameter_Name, + this.methodParameterHandler.MethodParameter_MapsTo, paramRequired.get( this.methodParameterHandler - .MethodParameter_Name, + .MethodParameter_MapsTo, ) + 1, ); } @@ -276,7 +276,7 @@ export class CodeModelCliImpl implements CodeModelAz { 'RequiredByMethod' ] = paramRequired.get( - this.methodParameterHandler.MethodParameter_Name, + this.methodParameterHandler.MethodParameter_MapsTo, ) === paramTime; } if ( @@ -322,7 +322,7 @@ export class CodeModelCliImpl implements CodeModelAz { ] = paramRequired.get( this.methodParameterHandler - .MethodParameter_Name, + .MethodParameter_MapsTo, ) === paramTime; } if ( @@ -450,6 +450,7 @@ export class CodeModelCliImpl implements CodeModelAz { this.allActions = new Map(); const nameActionReference: Map = new Map(); const pythonReserveWord = ['all', 'id', 'format', 'type', 'filter']; + if (this.SelectFirstCommandGroup()) { do { if (this.SelectFirstCommand()) { @@ -460,6 +461,10 @@ export class CodeModelCliImpl implements CodeModelAz { >(); if (this.SelectFirstMethod()) { do { + const methodParamMaptos: Map = new Map< + string, + Schema + >(); if (this.SelectFirstMethodParameter()) { do { const paramName = this.methodParameterHandler @@ -512,12 +517,13 @@ export class CodeModelCliImpl implements CodeModelAz { paramFlattenedName = paramName; } if (names.length > 1) { - let subgroup: string = names[0]; - subgroup = subgroup.replace(/-/g, '_'); - if (paramFlattenedName.startsWith(subgroup)) { - paramFlattenedName = paramFlattenedName.substr( - subgroup.length + 1, - ); + for (let subgroup of names.slice(0, names.length - 1)) { + subgroup = subgroup.replace(/-/g, '_'); + if (paramFlattenedName.startsWith(subgroup)) { + paramFlattenedName = paramFlattenedName.substr( + subgroup.length + 1, + ); + } } } if ( @@ -576,6 +582,7 @@ export class CodeModelCliImpl implements CodeModelAz { param, ); nameParamReference.set(paramName, param); + methodParamMaptos.set(paramName, param.schema); } else { // if the full flattenedName within one command is the same but has two different reference. there's no way to split them. this.session.message({ @@ -594,6 +601,14 @@ export class CodeModelCliImpl implements CodeModelAz { ) { paramFlattenedName += '_'; } + while ( + methodParamMaptos.has(paramFlattenedName) && + methodParamMaptos.get(paramFlattenedName).type !== + param.schema.type + ) { + paramFlattenedName += '_'; + } + methodParamMaptos.set(paramFlattenedName, param.schema); this.parameterHandler.Parameter_SetAzNameMapsTo( paramFlattenedName, param, diff --git a/src/generate/codemodel/Example.ts b/src/generate/codemodel/Example.ts index 0e0495e49..486e2f698 100644 --- a/src/generate/codemodel/Example.ts +++ b/src/generate/codemodel/Example.ts @@ -292,10 +292,21 @@ export class ExampleModelImpl implements ExampleModel { public GetExampleParameters(exampleObj): ExampleParam[] { const parameters: ExampleParam[] = []; const methodParamList: MethodParam[] = this.GetMethodParametersList(); + let flattenSucceed = true; Object.entries(exampleObj.parameters).forEach(([paramName, paramValue]) => { - this.FlattenExampleParameter(methodParamList, parameters, paramName, paramValue, []); + if ( + !this.FlattenExampleParameter( + methodParamList, + parameters, + paramName, + paramValue, + [], + ) + ) { + flattenSucceed = false; + } }); - return parameters; + return flattenSucceed ? parameters : undefined; } private isDiscriminator(param: any): boolean { @@ -676,7 +687,7 @@ export class ExampleModelImpl implements ExampleModel { name: string, value: any, ancestors: string[], - ) { + ): boolean { for (const methodParam of this.matchMethodParam(methodParamList, name, ancestors)) { let polySubParam: MethodParam = null; let netValue = @@ -691,15 +702,27 @@ export class ExampleModelImpl implements ExampleModel { if (polySubParamObj.schema.extensions) { const valueToMatch = polySubParamObj.schema.extensions['x-ms-discriminator-value']; - if (netValue[keyToMatch] === valueToMatch) { + if ( + isNullOrUndefined(netValue[keyToMatch]) || + netValue[keyToMatch] === valueToMatch + ) { polySubParam = methodParam; delete netValue[keyToMatch]; break; + } else { + return false; } } } } + } else if ( + !isNullOrUndefined(methodParam.value.extensions?.['cli-discriminator-value']) + ) { + if (value !== methodParam.value.extensions?.['cli-discriminator-value']) { + return false; + } } + if (polySubParam) { netValue = this.FlattenProperty(polySubParam.value?.schema, netValue); rawValue = this.FlattenProperty(polySubParam.value?.schema, rawValue); @@ -722,7 +745,7 @@ export class ExampleModelImpl implements ExampleModel { ancestors, rawValue, ); - return; + return true; } } else if ( 'targetProperty' in methodParam.value && @@ -741,7 +764,7 @@ export class ExampleModelImpl implements ExampleModel { ancestors, rawValue, ); - return; + return true; } } else if (ancestors.length === 0) { // exampleParam.set(name, value); @@ -755,21 +778,26 @@ export class ExampleModelImpl implements ExampleModel { rawValue, ) ) - return; + return true; } } if (!isNullOrUndefined(value) && typeof value === 'object') { for (const subName in value) { - this.FlattenExampleParameter( - methodParamList, - exampleParam, - subName, - value[subName], - ancestors.concat(name), - ); + if ( + !this.FlattenExampleParameter( + methodParamList, + exampleParam, + subName, + value[subName], + ancestors.concat(name), + ) + ) { + return false; + } } } + return true; } public ConvertToCliParameters( @@ -831,7 +859,7 @@ export class ExampleModelImpl implements ExampleModel { } // check polymophism here - const originalOperation = this.methodHandler.Method_GetOriginalOperation; + const originalOperation = this.methodHandler.Method_GetOriginalOperation(); if (!isNullOrUndefined(originalOperation)) { if (this.baseHandler.SelectFirstMethodParameter()) { do { @@ -917,6 +945,9 @@ export class ExampleModelImpl implements ExampleModel { example.HttpMethod = this.methodHandler.Method_HttpMethod; example.ResourceClassName = this.commandGroupHandler.CommandGroup_Key; const params = this.GetExampleParameters(exampleObj); + if (isNullOrUndefined(params)) { + return undefined; + } example.Parameters = this.ConvertToCliParameters( params, this.commandGroupHandler.CommandGroup_Key, @@ -932,13 +963,13 @@ export class ExampleModelImpl implements ExampleModel { this.commandHandler.Command_MethodName.toLowerCase() === 'update' && !forUpdate(this.baseHandler, id) ) { - return; + return undefined; } if ( this.commandHandler.Command_MethodName.toLowerCase() !== 'update' && forUpdate(this.baseHandler, id) ) { - return; + return undefined; } } if (this.filterExampleByPoly(exampleObj, example)) { diff --git a/src/generate/codemodel/Method.ts b/src/generate/codemodel/Method.ts index f40c870b7..914f2dfb3 100644 --- a/src/generate/codemodel/Method.ts +++ b/src/generate/codemodel/Method.ts @@ -18,7 +18,7 @@ export interface MethodModel { Method_ResourceType: string | undefined; Method_BodyParameterName: string; Method_IsLongRun: boolean; - Method_GetOriginalOperation: any; + Method_GetOriginalOperation(op?): any; Method_GetSplitOriginalOperation: any; Method_GenericSetterParameter(Operation): Parameter; Method_NeedGeneric: boolean; @@ -139,7 +139,9 @@ export class MethodModelImpl implements MethodModel { if ( this.Method.language['az'].isSplitUpdate && this.commandGroupHandler.CommandGroup_HasShowCommand && - !isNullOrUndefined(this.Method_GenericSetterParameter(this.Method_GetOriginalOperation)) + !isNullOrUndefined( + this.Method_GenericSetterParameter(this.Method_GetOriginalOperation()), + ) ) { return true; } @@ -150,8 +152,11 @@ export class MethodModelImpl implements MethodModel { return this.Method.language[language].name; } - public get Method_GetOriginalOperation(): any { - const polyOriginal = this.Method.extensions?.['cli-poly-as-resource-original-operation']; + public Method_GetOriginalOperation(op: Operation = this.Method): any { + if (isNullOrUndefined(op)) { + return undefined; + } + const polyOriginal = op?.extensions?.['cli-poly-as-resource-original-operation']; if ( !isNullOrUndefined(polyOriginal) && !isNullOrUndefined(polyOriginal.extensions?.['cli-split-operation-original-operation']) @@ -160,10 +165,21 @@ export class MethodModelImpl implements MethodModel { polyOriginal.extensions?.['cli-split-operation-original-operation']; return splitOriginal; } - const splittedOriginal = this.Method.extensions?.['cli-split-operation-original-operation']; + const splittedOriginal = op?.extensions?.['cli-split-operation-original-operation']; if (!isNullOrUndefined(splittedOriginal)) { return splittedOriginal; } + if ( + !isNullOrUndefined( + polyOriginal?.extensions?.['cli-poly-as-resource-original-operation'], + ) + ) { + const polyOriginalDeeper = this.Method_GetOriginalOperation(polyOriginal); + if (!isNullOrUndefined(polyOriginalDeeper)) { + return polyOriginalDeeper; + } + } + return polyOriginal; } diff --git a/src/generate/codemodel/MethodParameter.ts b/src/generate/codemodel/MethodParameter.ts index 74492ab96..4019e9c8c 100644 --- a/src/generate/codemodel/MethodParameter.ts +++ b/src/generate/codemodel/MethodParameter.ts @@ -157,7 +157,7 @@ export class MethodParameterModelImpl implements MethodParameterModel { public get MethodParameter_IsDiscriminator(): boolean { return ( - this.methodHandler.Method_GetOriginalOperation && + this.methodHandler.Method_GetOriginalOperation() && this.MethodParameter['targetProperty'] && this.MethodParameter['targetProperty']['isDiscriminator'] ); diff --git a/src/generate/renders/generated/CliCustom.ts b/src/generate/renders/generated/CliCustom.ts index b1833f475..fcbf9d5f6 100644 --- a/src/generate/renders/generated/CliCustom.ts +++ b/src/generate/renders/generated/CliCustom.ts @@ -67,7 +67,7 @@ class CustomParam { function getCustomParam(model: CodeModelAz, required: any) { const { methodHandler } = model.GetHandler(); - const originalOperation = methodHandler.Method_GetOriginalOperation; + const originalOperation = methodHandler.Method_GetOriginalOperation(); let genericParameter = null; if (!isNullOrUndefined(originalOperation)) { genericParameter = methodHandler.Method_GenericSetterParameter(originalOperation); @@ -266,7 +266,11 @@ function ConstructMethodBodyParameter(model: CodeModelAz, needGeneric = false, r methodParameterHandler.MethodParameter['targetProperty'] ?.isDiscriminator === true ) { - if (!isNullOrUndefined(valueToMatch)) { + valueToMatch = + methodParameterHandler.MethodParameter.extensions?.[ + 'cli-discriminator-value' + ]; + if (!isNullOrUndefined(valueToMatch) && !needGeneric) { access = ConstructValuation( model, required, diff --git a/src/generate/renders/generated/CliHelp.ts b/src/generate/renders/generated/CliHelp.ts index 2c1b3f8db..3c82dd5c5 100644 --- a/src/generate/renders/generated/CliHelp.ts +++ b/src/generate/renders/generated/CliHelp.ts @@ -58,6 +58,7 @@ export function GenerateAzureCliHelp(model: CodeModelAz, debug: boolean): string const allSubGroup: Map = new Map(); let hasWait = false; const allLongRunCommand = []; + let commandGroupName = commandGroupHandler.CommandGroup_Name; if (model.SelectFirstCommand()) { do { const subCommandGroupName = commandHandler.Command_SubGroupName; @@ -66,7 +67,14 @@ export function GenerateAzureCliHelp(model: CodeModelAz, debug: boolean): string output = output.concat( generateCommandGroupHelp(model, subCommandGroupName, debug), ); + commandGroupName = subCommandGroupName; } + output = output.concat( + generateMiddleCommandGroupHelp( + commandGroupName, + commandHandler.Command_Name, + ), + ); if ( commandHandler.Command_IsLongRun && commandGroupHandler.CommandGroup_HasShowCommand @@ -170,13 +178,35 @@ function generateCommandGroupHelp(model: CodeModelAz, subCommandGroupName = '', return output; } +function generateMiddleCommandGroupHelp(lastName: string, nextName: string) { + const lastNames = lastName.split(' '); + const nextNames = nextName.split(' '); + const output = []; + + while (lastNames.length < nextNames.length - 1) { + output.push(''); + const curName = nextNames.slice(0, lastNames.length + 1).join(' '); + output.push("helps['" + curName + '\'] = """'); + output.push(' type: group'); + ToMultiLine( + ` short-summary: Manage ${lastNames.last} with ${nextNames[lastNames.length]}`, + output, + CodeGenConstants.PYLINT_MAX_CODE_LENGTH, + true, + ); + output.push('"""'); + lastNames.push(nextNames[lastNames.length]); + } + return output; +} + function addParameterHelp(output: string[], model: CodeModelAz, debug: boolean) { const { methodHandler, methodParameterHandler, parameterHandler } = model.GetHandler(); let parameterOutput = [' parameters:']; if (model.SelectFirstMethod()) { do { - const originalOperation = methodHandler.Method_GetOriginalOperation; + const originalOperation = methodHandler.Method_GetOriginalOperation(); let baseParam = null; if (model.SelectFirstMethodParameter()) { do { diff --git a/src/generate/renders/generated/CliParams.ts b/src/generate/renders/generated/CliParams.ts index 76670ecc3..579f683f3 100644 --- a/src/generate/renders/generated/CliParams.ts +++ b/src/generate/renders/generated/CliParams.ts @@ -160,7 +160,7 @@ function getCommandBody(model: CodeModelAz, needGeneric = false, debug = false) const allPythonParam: Map = new Map(); if (model.SelectFirstMethod()) { do { - const originalOperation = methodHandler.Method_GetOriginalOperation; + const originalOperation = methodHandler.Method_GetOriginalOperation(); if (!isNullOrUndefined(originalOperation)) { for (const param of originalOperation.parameters) { if (parameterHandler.Parameter_InGlobal(param)) { diff --git a/src/generate/renders/tests/ScenarioTool.ts b/src/generate/renders/tests/ScenarioTool.ts index be78d1a87..d11bb1a6e 100644 --- a/src/generate/renders/tests/ScenarioTool.ts +++ b/src/generate/renders/tests/ScenarioTool.ts @@ -65,7 +65,10 @@ export function GenerateDefaultTestScenario(examples: CommandExample[]): any[] { const example: CommandExample = sorted[i]; testScenario.push({ name: example.Id }); } - return testScenario; + + return testScenario.filter((value, index, self) => { + return index === self.findIndex((t) => t.name === value.name); + }); } export function GenerateDefaultTestScenarioByDependency( diff --git a/src/hider.ts b/src/hider.ts index e482d9a3e..1c638a289 100644 --- a/src/hider.ts +++ b/src/hider.ts @@ -18,7 +18,7 @@ export class Hider { mergeOperation() { this.codeModel.operationGroups.forEach((operationGroup) => { - const operations = operationGroup.operations.filter(function cliSplitOperation( + let operations = operationGroup.operations.filter(function cliSplitOperation( operation, index, array, @@ -44,6 +44,27 @@ export class Hider { } return true; }); + // cli-poly-as-resource-original-operation + operations = operations.filter(function cliPolyOperation(operation, index, array) { + if ( + !isNullOrUndefined(operation.extensions) && + !isNullOrUndefined( + operation.extensions['cli-poly-as-resource-original-operation'], + ) + ) { + const originalOperation = + operation.extensions['cli-poly-as-resource-original-operation']; + if (isNullOrUndefined(originalOperation.extensions)) { + return false; + } + if (isNullOrUndefined(originalOperation.extensions['cli-operations'])) { + originalOperation.extensions['cli-operations'] = []; + } + originalOperation.extensions['cli-operations'].push(operation); + return false; + } + return true; + }); operationGroup.operations = operations; }); } diff --git a/src/merger.ts b/src/merger.ts index c7333677c..46e37f0fc 100644 --- a/src/merger.ts +++ b/src/merger.ts @@ -3,6 +3,8 @@ import { codeModelSchema, getAllProperties, ObjectSchema, + Operation, + Parameter, SchemaType, } from '@azure-tools/codemodel'; import { Session, startSession, Host, Channel } from '@autorest/extension-base'; @@ -22,142 +24,104 @@ export class Merger { return this.codeModel; } + getNameBaseParam(originalOperation: Operation, operation: Operation) { + const nameIndexMap: Map = new Map(); + let index = 0; + originalOperation.parameters.forEach((param) => { + nameIndexMap.set(param.language['cli'].name, index); + index++; + }); + const nameIndexMapRequest: Map = new Map(); + let indexRequest = 0; + if (!isNullOrUndefined(originalOperation.requests?.[0]?.parameters)) { + originalOperation.requests[0].parameters.forEach((rparam) => { + nameIndexMapRequest.set(rparam.language['cli'].name, indexRequest); + indexRequest++; + }); + } + operation.parameters.forEach((subParam) => { + const idx = nameIndexMap.get(subParam.language['cli'].name); + if (idx > -1) { + if (isNullOrUndefined(originalOperation.parameters[idx]['subParams'])) { + originalOperation.parameters[idx]['subParams'] = {}; + } + originalOperation.parameters[idx]['subParams'][operation.language['cli'].name] = + subParam.language['cli'].name; + const tmpParam = originalOperation.parameters[idx]; + if (isNullOrUndefined(subParam['nameBaseParam'])) { + subParam['nameBaseParam'] = tmpParam; + } + if (!isNullOrUndefined(subParam['originalParameter'])) { + const originalIdx = nameIndexMap.get( + subParam['originalParameter'].language['cli'].name, + ); + subParam['originalParameter'] = operation.parameters[originalIdx]; + } + } + }); + if (!isNullOrUndefined(operation?.requests?.[0]?.parameters)) { + operation.requests[0].parameters.forEach((subParam) => { + const idx = nameIndexMapRequest.get(subParam.language['cli'].name); + if (idx > -1) { + if ( + isNullOrUndefined( + originalOperation?.requests?.[0]?.parameters[idx]['subParams'], + ) + ) { + originalOperation.requests[0].parameters[idx]['subParams'] = {}; + } + originalOperation.requests[0].parameters[idx]['subParams'][ + operation.language['cli'].name + ] = subParam.language['cli'].name; + const tmpParam = originalOperation.requests[0].parameters[idx]; + // while (!isNullOrUndefined(tmpParam['nameBaseParam'])) { + // tmpParam = tmpParam['nameBaseParam']; + // } + if (isNullOrUndefined(subParam['nameBaseParam'])) { + subParam['nameBaseParam'] = tmpParam; + } + if (!isNullOrUndefined(subParam['originalParameter'])) { + const originalIdx = nameIndexMapRequest.get( + subParam['originalParameter'].language['cli'].name, + ); + subParam['originalParameter'] = + operation.requests[0].parameters[originalIdx]; + } + } + }); + } + } + mergeOperation() { this.codeModel.operationGroups.forEach((operationGroup) => { - let operations = operationGroup.operations; + const operations = operationGroup.operations; operationGroup.operations.forEach((operation) => { if ( !isNullOrUndefined(operation.extensions) && !isNullOrUndefined( - operation.extensions['cli-split-operation-original-operation'], + operation.extensions['cli-poly-as-resource-original-operation'], ) ) { - const nameIndexMap: Map = new Map(); - let index = 0; - operation.extensions[ - 'cli-split-operation-original-operation' - ].parameters.forEach((param) => { - nameIndexMap.set(param.language['cli'].name, index); - index++; - }); - const nameIndexMapRequest: Map = new Map(); - let indexRequest = 0; + let originalOperation = + operation.extensions['cli-poly-as-resource-original-operation']; if ( !isNullOrUndefined( - operation.extensions['cli-split-operation-original-operation'] - .requests?.[0]?.parameters, + originalOperation.extensions['cli-split-operation-original-operation'], ) ) { - operation.extensions[ - 'cli-split-operation-original-operation' - ].requests[0].parameters.forEach((rparam) => { - nameIndexMapRequest.set(rparam.language.cli.name, indexRequest); - indexRequest++; - }); + originalOperation = + originalOperation.extensions['cli-split-operation-original-operation']; } - operation.parameters.forEach((subParam) => { - const idx = nameIndexMap.get(subParam.language['cli'].name); - if (idx > -1) { - if ( - isNullOrUndefined( - operation.extensions['cli-split-operation-original-operation'] - .parameters[idx].subParams, - ) - ) { - operation.extensions[ - 'cli-split-operation-original-operation' - ].parameters[idx].subParams = {}; - } - operation.extensions[ - 'cli-split-operation-original-operation' - ].parameters[idx].subParams[operation.language['cli'].name] = - subParam.language['cli'].name; - subParam['nameBaseParam'] = - operation.extensions[ - 'cli-split-operation-original-operation' - ].parameters[idx]; - } - }); - if (!isNullOrUndefined(operation?.requests?.[0]?.parameters)) { - operation.requests[0].parameters.forEach((subParam) => { - const idx = nameIndexMapRequest.get(subParam.language['cli'].name); - if (idx > -1) { - if ( - isNullOrUndefined( - operation.extensions[ - 'cli-split-operation-original-operation' - ]?.requests?.[0]?.parameters[idx].subParams, - ) - ) { - operation.extensions[ - 'cli-split-operation-original-operation' - ].requests[0].parameters[idx].subParams = {}; - } - operation.extensions[ - 'cli-split-operation-original-operation' - ].requests[0].parameters[idx].subParams[ - operation.language['cli'].name - ] = subParam.language['cli'].name; - subParam['nameBaseParam'] = - operation.extensions[ - 'cli-split-operation-original-operation' - ].requests[0].parameters[idx]; - } - }); - } - } - if ( + this.getNameBaseParam(originalOperation, operation); + } else if ( !isNullOrUndefined(operation.extensions) && - !isNullOrUndefined(operation.extensions['cli-operations']) && - !operation.language['cli']['cli-operation-splitted'] + !isNullOrUndefined( + operation.extensions['cli-split-operation-original-operation'], + ) ) { - const nameIndexMap: Map = new Map(); - let index = 0; - operation.parameters.forEach((param) => { - nameIndexMap.set(param.language['cli'].name, index); - index++; - }); - const nameIndexMapRequest: Map = new Map(); - let indexRequest = 0; - if (!isNullOrUndefined(operation.requests?.[0]?.parameters)) { - operation.requests[0].parameters.forEach((rparam) => { - nameIndexMapRequest.set(rparam.language['cli'].name, indexRequest); - indexRequest++; - }); - } - operation.extensions['cli-operations'].forEach((subOperation) => { - subOperation.parameters.forEach((subParam) => { - const idx = nameIndexMap.get(subParam.language['cli'].name); - if (idx > -1) { - if (isNullOrUndefined(operation.parameters[idx]['subParams'])) { - operation.parameters[idx]['subParams'] = {}; - } - operation.parameters[idx]['subParams'][ - subOperation.language['cli'].name - ] = subParam.language['cli'].name; - subParam.nameBaseParam = operation.parameters[idx]; - } - }); - if (!isNullOrUndefined(subOperation?.requests?.[0]?.parameters)) { - subOperation.requests[0].parameters.forEach((subParam) => { - const idx = nameIndexMapRequest.get(subParam.language['cli'].name); - if (idx > -1) { - if ( - isNullOrUndefined( - operation?.requests?.[0]?.parameters[idx]['subParams'], - ) - ) { - operation.requests[0].parameters[idx]['subParams'] = {}; - } - operation.requests[0].parameters[idx]['subParams'][ - subOperation.language['cli'].name - ] = subParam.language['cli'].name; - subParam.nameBaseParam = operation.requests[0].parameters[idx]; - } - }); - } - }); - operations = operations.concat(operation.extensions['cli-operations']); + const originalOperation = + operation.extensions['cli-split-operation-original-operation']; + this.getNameBaseParam(originalOperation, operation); } }); operationGroup.operations = operations; diff --git a/src/templates/generated/action.py.njk b/src/templates/generated/action.py.njk index eddc0f93e..e44e4afe7 100644 --- a/src/templates/generated/action.py.njk +++ b/src/templates/generated/action.py.njk @@ -54,7 +54,7 @@ class {{action.actionName}}(argparse.{{action.baseClass}}): {% endfor %} {% if action.subProperties.length > 0 %} else: - raise CLIError('Unsupported Key {} is provided for parameter {{action.nameAz}}. All possible keys are: {{ action.subPropertiesNameAz | join(', ') }}'. + raise CLIError('Unsupported Key {} is provided for parameter {{action.mapsTo | replace("_", "-")}}. All possible keys are: {{ action.subPropertiesNameAz | join(', ') }}'. format(k)) {% endif %} {% else %} diff --git a/test/scenarios/datafactory/input/examples/Triggers_Update.json b/test/scenarios/datafactory/input/examples/Triggers_Update.json index be49edc3d..62d27002f 100644 --- a/test/scenarios/datafactory/input/examples/Triggers_Update.json +++ b/test/scenarios/datafactory/input/examples/Triggers_Update.json @@ -7,7 +7,7 @@ "ifMatch": null, "trigger": { "properties": { - "type": "ScheduleTrigger", + "type": "Trigger", "typeProperties": { "recurrence": { "frequency": "Minute", diff --git a/test/scenarios/kusto/output/coredefault/src/azure-cli/azure/cli/command_modules/kusto/generated/_help.py b/test/scenarios/kusto/output/coredefault/src/azure-cli/azure/cli/command_modules/kusto/generated/_help.py index 62f6221e1..9c9269770 100644 --- a/test/scenarios/kusto/output/coredefault/src/azure-cli/azure/cli/command_modules/kusto/generated/_help.py +++ b/test/scenarios/kusto/output/coredefault/src/azure-cli/azure/cli/command_modules/kusto/generated/_help.py @@ -434,7 +434,7 @@ - name: KustoDatabasesUpdate text: |- az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" \ ---parameters "{\\"properties\\":{\\"softDeletePeriod\\":\\"P1D\\"}}" --resource-group "kustorptest" +--read-write-database soft-delete-period="P1D" --resource-group "kustorptest" """ helps['kusto database delete'] = """ diff --git a/test/scenarios/kusto/output/coredefault/src/azure-cli/azure/cli/command_modules/kusto/report.md b/test/scenarios/kusto/output/coredefault/src/azure-cli/azure/cli/command_modules/kusto/report.md index 2e9c43e4d..58c39130a 100644 --- a/test/scenarios/kusto/output/coredefault/src/azure-cli/azure/cli/command_modules/kusto/report.md +++ b/test/scenarios/kusto/output/coredefault/src/azure-cli/azure/cli/command_modules/kusto/report.md @@ -616,8 +616,8 @@ location="westus" soft-delete-period="P1D" --resource-group "kustorptest" ##### Example ``` -az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" --parameters \ -"{\\"properties\\":{\\"softDeletePeriod\\":\\"P1D\\"}}" --resource-group "kustorptest" +az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" --read-write-database \ +soft-delete-period="P1D" --resource-group "kustorptest" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| diff --git a/test/scenarios/kusto/output/coredefault/src/azure-cli/azure/cli/command_modules/kusto/tests/latest/example_steps.py b/test/scenarios/kusto/output/coredefault/src/azure-cli/azure/cli/command_modules/kusto/tests/latest/example_steps.py index c533047cd..110b4754c 100644 --- a/test/scenarios/kusto/output/coredefault/src/azure-cli/azure/cli/command_modules/kusto/tests/latest/example_steps.py +++ b/test/scenarios/kusto/output/coredefault/src/azure-cli/azure/cli/command_modules/kusto/tests/latest/example_steps.py @@ -380,7 +380,7 @@ def step_database_update(test, checks=None): test.cmd('az kusto database update ' '--cluster-name "{myCluster}" ' '--database-name "KustoDatabase8" ' - '--parameters "{{\\"properties\\":{{\\"softDeletePeriod\\":\\"P1D\\"}}}}" ' + '--read-write-database soft-delete-period="P1D" ' '--resource-group "{rg}"', checks=checks) diff --git a/test/scenarios/kusto/output/coretrack2/src/azure-cli/azure/cli/command_modules/kusto/generated/_help.py b/test/scenarios/kusto/output/coretrack2/src/azure-cli/azure/cli/command_modules/kusto/generated/_help.py index 62f6221e1..9c9269770 100644 --- a/test/scenarios/kusto/output/coretrack2/src/azure-cli/azure/cli/command_modules/kusto/generated/_help.py +++ b/test/scenarios/kusto/output/coretrack2/src/azure-cli/azure/cli/command_modules/kusto/generated/_help.py @@ -434,7 +434,7 @@ - name: KustoDatabasesUpdate text: |- az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" \ ---parameters "{\\"properties\\":{\\"softDeletePeriod\\":\\"P1D\\"}}" --resource-group "kustorptest" +--read-write-database soft-delete-period="P1D" --resource-group "kustorptest" """ helps['kusto database delete'] = """ diff --git a/test/scenarios/kusto/output/coretrack2/src/azure-cli/azure/cli/command_modules/kusto/report.md b/test/scenarios/kusto/output/coretrack2/src/azure-cli/azure/cli/command_modules/kusto/report.md index 2e9c43e4d..58c39130a 100644 --- a/test/scenarios/kusto/output/coretrack2/src/azure-cli/azure/cli/command_modules/kusto/report.md +++ b/test/scenarios/kusto/output/coretrack2/src/azure-cli/azure/cli/command_modules/kusto/report.md @@ -616,8 +616,8 @@ location="westus" soft-delete-period="P1D" --resource-group "kustorptest" ##### Example ``` -az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" --parameters \ -"{\\"properties\\":{\\"softDeletePeriod\\":\\"P1D\\"}}" --resource-group "kustorptest" +az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" --read-write-database \ +soft-delete-period="P1D" --resource-group "kustorptest" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| diff --git a/test/scenarios/kusto/output/coretrack2/src/azure-cli/azure/cli/command_modules/kusto/tests/latest/example_steps.py b/test/scenarios/kusto/output/coretrack2/src/azure-cli/azure/cli/command_modules/kusto/tests/latest/example_steps.py index c533047cd..110b4754c 100644 --- a/test/scenarios/kusto/output/coretrack2/src/azure-cli/azure/cli/command_modules/kusto/tests/latest/example_steps.py +++ b/test/scenarios/kusto/output/coretrack2/src/azure-cli/azure/cli/command_modules/kusto/tests/latest/example_steps.py @@ -380,7 +380,7 @@ def step_database_update(test, checks=None): test.cmd('az kusto database update ' '--cluster-name "{myCluster}" ' '--database-name "KustoDatabase8" ' - '--parameters "{{\\"properties\\":{{\\"softDeletePeriod\\":\\"P1D\\"}}}}" ' + '--read-write-database soft-delete-period="P1D" ' '--resource-group "{rg}"', checks=checks) 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 361172606..a07959472 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 @@ -117,7 +117,7 @@ az kusto database list --cluster-name "kustoclusterrptest4" --resource-group "ku ##### Update ##### ``` az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" \ - --parameters "{\\"properties\\":{\\"softDeletePeriod\\":\\"P1D\\"}}" --resource-group "kustorptest" + --read-write-database soft-delete-period="P1D" --resource-group "kustorptest" ``` ##### Add-principal ##### ``` 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 f48e6114f..418dc4635 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 @@ -418,7 +418,7 @@ - name: KustoDatabasesUpdate text: |- az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" \ ---parameters "{\\"properties\\":{\\"softDeletePeriod\\":\\"P1D\\"}}" --resource-group "kustorptest" +--read-write-database soft-delete-period="P1D" --resource-group "kustorptest" """ helps['kusto database delete'] = """ 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 cdd3138cf..acde1f071 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 @@ -382,7 +382,7 @@ def step_database_update(test, checks=None): test.cmd('az kusto database update ' '--cluster-name "{myCluster}" ' '--database-name "KustoDatabase8" ' - '--parameters "{{\\"properties\\":{{\\"softDeletePeriod\\":\\"P1D\\"}}}}" ' + '--read-write-database soft-delete-period="P1D" ' '--resource-group "{rg}"', checks=checks) 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 11060a105..fe3d7d5d5 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 @@ -758,8 +758,8 @@ location="westus" soft-delete-period="P1D" --resource-group "kustorptest" ##### Example ``` -az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" --parameters \ -"{\\"properties\\":{\\"softDeletePeriod\\":\\"P1D\\"}}" --resource-group "kustorptest" +az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" --read-write-database \ +soft-delete-period="P1D" --resource-group "kustorptest" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| diff --git a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/README.md b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/README.md index 361172606..a07959472 100644 --- a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/README.md +++ b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/README.md @@ -117,7 +117,7 @@ az kusto database list --cluster-name "kustoclusterrptest4" --resource-group "ku ##### Update ##### ``` az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" \ - --parameters "{\\"properties\\":{\\"softDeletePeriod\\":\\"P1D\\"}}" --resource-group "kustorptest" + --read-write-database soft-delete-period="P1D" --resource-group "kustorptest" ``` ##### Add-principal ##### ``` 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 f48e6114f..418dc4635 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 @@ -418,7 +418,7 @@ - name: KustoDatabasesUpdate text: |- az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" \ ---parameters "{\\"properties\\":{\\"softDeletePeriod\\":\\"P1D\\"}}" --resource-group "kustorptest" +--read-write-database soft-delete-period="P1D" --resource-group "kustorptest" """ helps['kusto database delete'] = """ 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 cdd3138cf..acde1f071 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 @@ -382,7 +382,7 @@ def step_database_update(test, checks=None): test.cmd('az kusto database update ' '--cluster-name "{myCluster}" ' '--database-name "KustoDatabase8" ' - '--parameters "{{\\"properties\\":{{\\"softDeletePeriod\\":\\"P1D\\"}}}}" ' + '--read-write-database soft-delete-period="P1D" ' '--resource-group "{rg}"', checks=checks) diff --git a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/report.md b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/report.md index 11060a105..fe3d7d5d5 100644 --- a/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/report.md +++ b/test/scenarios/kusto/output/extnosdknoflattentrack1/src/kusto/report.md @@ -758,8 +758,8 @@ location="westus" soft-delete-period="P1D" --resource-group "kustorptest" ##### Example ``` -az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" --parameters \ -"{\\"properties\\":{\\"softDeletePeriod\\":\\"P1D\\"}}" --resource-group "kustorptest" +az kusto database update --cluster-name "kustoclusterrptest4" --database-name "KustoDatabase8" --read-write-database \ +soft-delete-period="P1D" --resource-group "kustorptest" ``` ##### Parameters |Option|Type|Description|Path (SDK)|Swagger name| diff --git a/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/_params.py b/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/_params.py index 2ae5b8e29..5c621b738 100644 --- a/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/_params.py +++ b/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/_params.py @@ -177,7 +177,8 @@ def load_arguments(self, _): c.argument('hub', action=AddHub, nargs='+', help='Gets or sets the hub virtual network ID') c.argument('spokes', action=AddSpokes, nargs='+', help='Gets or sets the spokes group IDs') c.argument('mesh', action=AddMesh, nargs='+', help='Gets or sets the mesh group IDs') - c.argument('managed_network_policy', type=str, help='inside managedNetworkPolicy') + c.argument('managed_network_policy_', options_list=['--managed-network-policy'], type=str, help='inside ' + 'managedNetworkPolicy') with self.argument_context('managed-network managed-network-peering-policy mesh-topology create') as c: c.argument('resource_group_name', resource_group_name_type) @@ -188,7 +189,8 @@ def load_arguments(self, _): c.argument('hub', action=AddHub, nargs='+', help='Gets or sets the hub virtual network ID') c.argument('spokes', action=AddSpokes, nargs='+', help='Gets or sets the spokes group IDs') c.argument('mesh', action=AddMesh, nargs='+', help='Gets or sets the mesh group IDs') - c.argument('managed_network_policy', type=str, help='inside managedNetworkPolicy') + c.argument('managed_network_policy_', options_list=['--managed-network-policy'], type=str, help='inside ' + 'managedNetworkPolicy') with self.argument_context('managed-network managed-network-peering-policy hub-and-spoke-topology update') as c: c.argument('resource_group_name', resource_group_name_type) @@ -200,8 +202,9 @@ def load_arguments(self, _): c.argument('hub', action=AddHub, nargs='+', help='Gets or sets the hub virtual network ID') c.argument('spokes', action=AddSpokes, nargs='+', help='Gets or sets the spokes group IDs') c.argument('mesh', action=AddMesh, nargs='+', help='Gets or sets the mesh group IDs') - c.argument('managed_network_policy', type=str, help='inside managedNetworkPolicy') - c.ignore('managed_network_peering_policy_name') + c.argument('managed_network_policy_', options_list=['--managed-network-policy'], type=str, help='inside ' + 'managedNetworkPolicy') + c.ignore('managed_network_peering_policy_name', 'managed_network_policy') with self.argument_context('managed-network managed-network-peering-policy mesh-topology update') as c: c.argument('resource_group_name', resource_group_name_type) @@ -213,8 +216,9 @@ def load_arguments(self, _): c.argument('hub', action=AddHub, nargs='+', help='Gets or sets the hub virtual network ID') c.argument('spokes', action=AddSpokes, nargs='+', help='Gets or sets the spokes group IDs') c.argument('mesh', action=AddMesh, nargs='+', help='Gets or sets the mesh group IDs') - c.argument('managed_network_policy', type=str, help='inside managedNetworkPolicy') - c.ignore('managed_network_peering_policy_name') + c.argument('managed_network_policy_', options_list=['--managed-network-policy'], type=str, help='inside ' + 'managedNetworkPolicy') + c.ignore('managed_network_peering_policy_name', 'managed_network_policy') with self.argument_context('managed-network managed-network-peering-policy delete') as c: c.argument('resource_group_name', resource_group_name_type) diff --git a/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/action.py b/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/action.py index c151d10f0..4958c1f7d 100644 --- a/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/action.py +++ b/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/action.py @@ -145,10 +145,7 @@ def get_action(self, values, option_string): d['id'] = v[0] else: - raise CLIError( - 'Unsupported Key {} is provided for parameter hub-and-spoke-topology_hub. All possible keys are: id' - .format(k) - ) + raise CLIError('Unsupported Key {} is provided for parameter hub. All possible keys are: id'.format(k)) return d @@ -179,8 +176,7 @@ def get_action(self, values, option_string): else: raise CLIError( - 'Unsupported Key {} is provided for parameter hub-and-spoke-topology_spokes. All possible keys' - ' are: id'.format(k) + 'Unsupported Key {} is provided for parameter spokes. All possible keys are: id'.format(k) ) return d @@ -211,9 +207,6 @@ def get_action(self, values, option_string): d['id'] = v[0] else: - raise CLIError( - 'Unsupported Key {} is provided for parameter hub-and-spoke-topology_mesh. All possible keys' - ' are: id'.format(k) - ) + raise CLIError('Unsupported Key {} is provided for parameter mesh. All possible keys are: id'.format(k)) return d diff --git a/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/custom.py b/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/custom.py index bc9416907..17b0308e8 100644 --- a/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/custom.py +++ b/test/scenarios/managed-network/output/src/managed-network/azext_managed_network/generated/custom.py @@ -218,10 +218,10 @@ def managed_network_managed_network_peering_policy_hub_and_spoke_topology_create managed_network_name, policy_name, location, - managed_network_policy, hub=None, spokes=None, mesh=None, + managed_network_policy_=None, no_wait=False): managed_network_policy = {} managed_network_policy['location'] = location @@ -230,6 +230,7 @@ def managed_network_managed_network_peering_policy_hub_and_spoke_topology_create managed_network_policy['properties']['hub'] = hub managed_network_policy['properties']['spokes'] = spokes managed_network_policy['properties']['mesh'] = mesh + managed_network_policy['managed_network_policy'] = managed_network_policy_ return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name=resource_group_name, @@ -243,10 +244,10 @@ def managed_network_managed_network_peering_policy_mesh_topology_create(client, managed_network_name, policy_name, location, - managed_network_policy, hub=None, spokes=None, mesh=None, + managed_network_policy_=None, no_wait=False): managed_network_policy = {} managed_network_policy['location'] = location @@ -255,6 +256,7 @@ def managed_network_managed_network_peering_policy_mesh_topology_create(client, managed_network_policy['properties']['hub'] = hub managed_network_policy['properties']['spokes'] = spokes managed_network_policy['properties']['mesh'] = mesh + managed_network_policy['managed_network_policy'] = managed_network_policy_ return sdk_no_wait(no_wait, client.begin_create_or_update, resource_group_name=resource_group_name, @@ -271,16 +273,18 @@ def managed_network_managed_network_peering_policy_hub_and_spoke_topology_update hub=None, spokes=None, mesh=None, + managed_network_policy_=None, no_wait=False): if location is not None: instance.location = location - instance.properties.type = 'HubAndSpokeTopology' if hub is not None: instance.properties.hub = hub if spokes is not None: instance.properties.spokes = spokes if mesh is not None: instance.properties.mesh = mesh + if managed_network_policy_ is not None: + instance.managed_network_policy = managed_network_policy_ return instance @@ -292,16 +296,18 @@ def managed_network_managed_network_peering_policy_mesh_topology_update(instance hub=None, spokes=None, mesh=None, + managed_network_policy_=None, no_wait=False): if location is not None: instance.location = location - instance.properties.type = 'MeshTopology' if hub is not None: instance.properties.hub = hub if spokes is not None: instance.properties.spokes = spokes if mesh is not None: instance.properties.mesh = mesh + if managed_network_policy_ is not None: + instance.managed_network_policy = managed_network_policy_ return instance