This commit is contained in:
qiaozha 2020-02-18 19:19:51 +08:00
Родитель d94d64c6ec
Коммит 10ceacdbeb
8 изменённых файлов: 277 добавлений и 170 удалений

Просмотреть файл

@ -51,8 +51,8 @@ export interface CodeModelAz
Option_PathSwagger: string;
Option_EnumValues: string[];
Option_IsHidden: boolean;
Option_IsFlattened: boolean
Option_IsFlattened: boolean;
SelectFirstMethod(): boolean;
SelectNextMethod(): boolean;
@ -65,14 +65,19 @@ export interface CodeModelAz
SelectNextMethodParameter(): boolean;
MethodParameter_Name: string;
MethodParameter_NamePython: string
MethodParameter_MapsTo: string;
MethodParameter_Description: string;
MethodParameter_Type: string;
MethodParameter_IsList: boolean;
MethodParameter: any;
MethodParameter_In: string;
MethodParameter_IsHidden: boolean;
MethodParameter_IsRequired: boolean;
MethodParameter_IsFlattened: boolean
MethodParameter_IsFlattened: boolean;
MethodParameter_RequiredByMethod: boolean;
MethodParameter_EnumValues: string[];
GetModuleOperationName(): string;

Просмотреть файл

@ -37,7 +37,7 @@ export class CodeModelCliImpl implements CodeModelAz
async init() {
this.options = await this.session.getValue('az');
this.extensionName = await this.options['extensions'];
this.extensionName = this.options['extensions'];
this.currentOperationGroupIndex = -1;
this.currentOperationIndex = -1;
this.currentParameterIndex = -1;
@ -53,6 +53,7 @@ export class CodeModelCliImpl implements CodeModelAz
this.codeModel = session.model;
this._testScenario = testScenario;
this.sortOperationByAzCommand();
this.calcOptionRequiredByMethod();
}
private getOrder(op: string) {
@ -63,6 +64,7 @@ export class CodeModelCliImpl implements CodeModelAz
}
return order.toLocaleString();
}
private sortOperationByAzCommand() {
for(let [idx, operationGroup] of this.codeModel.operationGroups.entries()) {
operationGroup.operations.sort((a, b) => {
@ -74,6 +76,60 @@ export class CodeModelCliImpl implements CodeModelAz
}
}
private calcOptionRequiredByMethod() {
if(this.SelectFirstCommandGroup()) {
do {
if(this.SelectFirstCommand()) {
do {
var paramTime = 0;
if(this.SelectFirstMethod()) {
let paramRequired: Map<string, number> = new Map<string, number>();
paramTime++;
this.session.message({Channel:Channel.Warning, Text: " paramTime:" + paramTime + " CommandGroupName: " + this.CommandGroup_Name + " MethodName:" + this.Method_Name});
if(this.SelectFirstMethodParameter()) {
do {
paramRequired.set(this.MethodParameter_Name, this.MethodParameter_IsRequired? 1: 0);
} while(this.SelectNextMethodParameter());
}
while(this.SelectNextMethod()) {
paramTime++;
this.session.message({Channel:Channel.Warning, Text: " paramTime:" + paramTime + " CommandGroupName: " + this.CommandGroup_Name + " MethodName:" + this.Method_Name});
if(this.SelectFirstMethodParameter()) {
do {
if(!paramRequired.has(this.MethodParameter_Name)) {
paramRequired.set(this.MethodParameter_Name, this.MethodParameter_IsRequired? 1: 0);
} else if(this.MethodParameter_IsRequired){
paramRequired.set(this.MethodParameter_Name, paramRequired.get(this.MethodParameter_Name) + 1);
}
} while(this.SelectNextMethodParameter());
}
}
for(let [k,v] of paramRequired.entries()) {
this.session.message({Channel:Channel.Warning, Text: "param: " + k + " requiredTimes:" + v});
}
if(this.SelectFirstMethod()) {
if(this.SelectFirstMethodParameter()) {
do {
this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex]['RequiredByMethod'] = paramRequired.get(this.MethodParameter_Name) == paramTime? true: false;
} while(this.SelectNextMethodParameter());
}
while(this.SelectNextMethod()) {
if(this.SelectFirstMethodParameter()) {
do {
this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex]['RequiredByMethod'] = paramRequired.get(this.MethodParameter_Name) == paramTime? true: false;
} while(this.SelectNextMethodParameter());
}
}
}
}
} while(this.SelectNextCommand());
}
} while (this.SelectNextCommandGroup());
}
//this.session.message({Channel:Channel.Warning, Text:serialize(this.codeModel)});
}
//=================================================================================================================
// Extension level information
// autorest.az will have support for multiple extensions from single swagger file.
@ -231,6 +287,13 @@ export class CodeModelCliImpl implements CodeModelAz
if(this.codeModel.operationGroups[this.currentOperationGroupIndex].operations.length > 0) {
this.currentOperationIndex = 0;
this.preMethodIndex = this.currentOperationIndex;
while(this.currentOperationIndex + 1 < this.codeModel.operationGroups[this.currentOperationGroupIndex].operations.length) {
if(this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentOperationIndex + 1].language['az'].command == this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentOperationIndex].language['az'].command) {
this.currentOperationIndex++;
} else {
break;
}
}
this.SelectFirstOption();
this.SelectFirstMethod();
this.SelectFirstMethodParameter();
@ -265,7 +328,7 @@ export class CodeModelCliImpl implements CodeModelAz
public get Command_FunctionName()
{
return this.Command_Name.replace(/ /g, "_");
return this.Command_Name.replace(/ /g, "_").replace(/-/g, "_");;
}
public get Command_Name(): string
@ -298,7 +361,7 @@ export class CodeModelCliImpl implements CodeModelAz
this.currentParameterIndex = 0;
let parameter = this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentOperationIndex].request.parameters[this.currentParameterIndex]
const currentParameterName = parameter.language['az'].name;
if(parameter.hidden || currentParameterName == "subscription_id" || currentParameterName == "api_version" || currentParameterName == "$host") {
if(parameter.hidden || parameter.protocol?.http?.in == ParameterLocation.Header || currentParameterName == "subscription_id" || currentParameterName == "api_version" || currentParameterName == "$host") {
if(this.SelectNextOption()) {
return true;
} else {
@ -347,7 +410,7 @@ export class CodeModelCliImpl implements CodeModelAz
this.currentParameterIndex++;
let parameter = this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentOperationIndex].request.parameters[this.currentParameterIndex];
const currentParameterName = parameter.language['az'].name;
if(parameter.hidden || currentParameterName == "subscription_id" || currentParameterName == "api_version" || currentParameterName == "$host") {
if(parameter.hidden || parameter.protocol?.http?.in == ParameterLocation.Header || currentParameterName == "subscription_id" || currentParameterName == "api_version" || currentParameterName == "$host") {
if(this.SelectNextOption()) {
return true;
} else {
@ -507,6 +570,7 @@ export class CodeModelCliImpl implements CodeModelAz
{
if(this.currentOperationIndex >= this.preMethodIndex) {
this.currentMethodIndex = this.preMethodIndex;
this.SelectFirstMethodParameter();
return true;
} else {
this.currentMethodIndex = -1;
@ -518,6 +582,7 @@ export class CodeModelCliImpl implements CodeModelAz
{
if(this.currentMethodIndex < this.currentOperationIndex) {
this.currentMethodIndex++;
this.SelectFirstMethodParameter();
return true;
} else {
this.currentMethodIndex = -1;
@ -565,7 +630,7 @@ export class CodeModelCliImpl implements CodeModelAz
this.currentParameterIndex = 0;
let parameter = this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex];
const currentParameterName = parameter.language['python'].name;
if(parameter.hidden || currentParameterName == "subscription_id" || currentParameterName == "api_version" || currentParameterName == "host") {
if(parameter.hidden || parameter.protocol?.http?.in == ParameterLocation.Header || currentParameterName == "subscription_id" || currentParameterName == "api_version" || currentParameterName == "host") {
if(this.SelectNextMethodParameter()) {
return true;
} else {
@ -584,7 +649,7 @@ export class CodeModelCliImpl implements CodeModelAz
this.currentParameterIndex++;
let parameter = this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex];
const currentParameterName = parameter.language['python'].name;
if(parameter.hidden || currentParameterName == "subscription_id" || currentParameterName == "api_version" || currentParameterName == "host") {
if(parameter.hidden || parameter.protocol?.http?.in == ParameterLocation.Header || currentParameterName == "subscription_id" || currentParameterName == "api_version" || currentParameterName == "host") {
if(this.SelectNextMethodParameter()) {
return true;
} else {
@ -602,6 +667,17 @@ export class CodeModelCliImpl implements CodeModelAz
return this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex].language['python'].name;
}
public get MethodParameter_NamePython(): string
{
let parameter = this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex];
if(parameter['pathToProperty']?.length == 1) {
return (parameter['pathToProperty'][0]).language['python'].name + "_" + parameter.language['python'].name;
} else {
return parameter.language['python'].name;
}
}
public get MethodParameter_MapsTo(): string
{
let parameter = this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex];
@ -611,6 +687,12 @@ export class CodeModelCliImpl implements CodeModelAz
return parameter.language['python'].name;
}
}
public get MethodParameter_Description(): string
{
return this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex].language['az'].description;
}
public get MethodParameter_Type(): string
{
return this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex].schema.type;
@ -626,7 +708,20 @@ export class CodeModelCliImpl implements CodeModelAz
return this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex];
}
public get MethodParameter_EnumValues(): string[]
{
let mtype = this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex].schema.type;
if(mtype == SchemaType.Choice || mtype == SchemaType.SealedChoice) {
var enumArray = [];
let schema = this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex].schema;
for(var item of schema['choices']) {
enumArray.push(item['value']);
}
return enumArray;
} else {
return [];
}
}
public get MethodParameter_In(): string
{
@ -648,6 +743,11 @@ export class CodeModelCliImpl implements CodeModelAz
{
return this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex]['flattened']? true: false;
}
public get MethodParameter_RequiredByMethod(): boolean
{
return this.codeModel.operationGroups[this.currentOperationGroupIndex].operations[this.currentMethodIndex].request.parameters[this.currentParameterIndex]['RequiredByMethod'];
}
//=================================================================================================================
// Top Level Python Related Information
//

Просмотреть файл

@ -69,17 +69,19 @@ export function GenerateAzureCliCommands(model: CodeModelAz) : string[] {
function getCommandBody(model: CodeModelAz, needUpdate: boolean = false) {
let output: string [] = [];
if (model.Command_MethodName != "show")
let functionName = model.Command_FunctionName;
let methodName = model.Command_MethodName;
if (methodName != "show")
{
if(needUpdate) {
output.push(" g.custom_command('" + model.Command_MethodName.replace(/create/g, "update") + "', '" + model.Command_FunctionName.replace(/_create/g, "_update") + "')");
output.push(" g.custom_command('" + methodName.replace(/create/g, "update") + "', '" + functionName.replace(/_create/g, "_update") + "')");
} else {
output.push(" g.custom_command('" + model.Command_MethodName + "', '" + model.Command_FunctionName + "')");
output.push(" g.custom_command('" + methodName + "', '" + functionName + "')");
}
}
else
{
output.push(" g.custom_show_command('" + model.Command_MethodName + "', '" + model.Command_FunctionName + "')");
output.push(" g.custom_show_command('" + methodName + "', '" + functionName + "')");
}
return output;
}

Просмотреть файл

@ -68,7 +68,7 @@ function GetCommandBody(model: CodeModelAz, required: boolean, needUpdate: boole
//let updatedMethodName = ((methodName != "show") ? methodName : "get").replace(/-/g, '_');
let updatedMethodName: string = model.Command_FunctionName;
if (needUpdate) {
updatedMethodName = model.Command_FunctionName.replace(/_create/g, "_update");
updatedMethodName = updatedMethodName.replace(/_create/g, "_update");
}
let call = "def " + updatedMethodName + "(";
let indent = " ".repeat(call.length);
@ -76,55 +76,47 @@ function GetCommandBody(model: CodeModelAz, required: boolean, needUpdate: boole
output.push(call + "cmd, client");
if (model.SelectFirstOption()) {
let allParam: Map<string, boolean> = new Map<string, boolean>();
if (model.SelectFirstMethod()) {
do {
if (model.Option_IsFlattened) {
continue;
}
let required: boolean = model.Option_IsRequired;
// XXX - handle this in model
//if (element.Type == "placeholder")
// continue;
// XXX - handle this in model
//if (isUpdate && element.PathSwagger.startsWith("/"))
// required = false;
if (isUpdate && model.Option_PathSwagger.startsWith("/"))
required = false;
if (required) {
let name = model.Option_NamePython; // PythonParameterName(element.Name);
output[output.length - 1] += ",";
output.push(indent + name);
}
} while (model.SelectNextOption());
if(model.SelectFirstMethodParameter()) {
do {
if (model.MethodParameter_IsFlattened) {
continue;
}
let required: boolean = model.MethodParameter_RequiredByMethod;
let name = model.MethodParameter_NamePython; // PythonParameterName(element.Name);
if (required && !allParam.has(name)) {
allParam.set(name, true);
output[output.length - 1] += ",";
output.push(indent + name);
}
} while(model.SelectNextMethodParameter());
}
} while (model.SelectNextMethod());
}
if (model.SelectFirstOption()) {
if (model.SelectFirstMethod()) {
do {
if (model.Option_IsFlattened) {
continue;
}
let required = model.Option_IsRequired;
if(model.SelectFirstMethodParameter()) {
do {
if (model.MethodParameter_IsFlattened) {
continue;
}
let required = model.MethodParameter_RequiredByMethod;
if (model.Option_In == ParameterLocation.Path) {
continue;
}
if (isUpdate && model.Option_PathSwagger.startsWith("/"))
required = false;
if (!required) {
output[output.length - 1] += ",";
output.push(indent + model.Option_NamePython + "=None");
let name = model.MethodParameter_NamePython;
if (!required && !allParam.has(name)) {
allParam.set(name, true);
output[output.length - 1] += ",";
output.push(indent + name + "=None");
}
} while(model.SelectNextMethodParameter());
}
}
while (model.SelectNextOption());
while (model.SelectNextMethod());
}
output[output.length - 1] += "):";
@ -136,7 +128,7 @@ function GetCommandBody(model: CodeModelAz, required: boolean, needUpdate: boole
// create body transformation for methods that support it
let methodName: string = model.Command_MethodName;
if (methodName != "show" && methodName != "list" && methodName != "delete") {
//if (methodName != "show" && methodName != "list" && methodName != "delete") {
// body transformation
if (model.SelectFirstMethodParameter()) {
@ -195,7 +187,7 @@ function GetCommandBody(model: CodeModelAz, required: boolean, needUpdate: boole
}
}
//}
let needIfStatement = !model.Method_IsLast;

Просмотреть файл

@ -88,75 +88,83 @@ function getCommandBody(model: CodeModelAz, needUpdate: boolean = false) {
} else {
output_args.push(" with self.argument_context('" + model.Command_Name + "') as c:");
}
if (!model.SelectFirstOption()) {
let hasParam = false;
let allParam: Map<string, boolean> = new Map<string, boolean>();
if(model.SelectFirstMethod()) {
do {
if(model.SelectFirstMethodParameter()) {
do {
if(model.MethodParameter_IsFlattened) {
continue;
}
hasParam = true;
let parameterName = model.MethodParameter_NamePython;
if(allParam.has(parameterName)) {
continue;
}
allParam.set(parameterName, true);
let argument = " c.argument('" + parameterName + "'";
// this is to handle names like "format", "type", etc
if (parameterName == "type" || parameterName == "format") {
argument = " c.argument('_" + parameterName + "'";
argument += ", options_list=['--" + parameterName + "']";
}
if (model.MethodParameter_Type == SchemaType.Boolean) {
hasBoolean = true;
argument += ", arg_type=get_three_state_flag()";
}
else if (model.MethodParameter_Type == SchemaType.Choice || model.MethodParameter_Type == SchemaType.SealedChoice) {
hasEnum = true;
argument += ", arg_type=get_enum_type([";
model.MethodParameter_EnumValues.forEach(element => {
if (!argument.endsWith("[")) argument += ", ";
argument += "'" + element + "'";
});
argument += "])";
}
if (parameterName == "resource_group_name") {
argument += ", resource_group_name_type";
}
else if (parameterName == "tags") {
argument += ", tags_type";
}
else if (parameterName == "location") {
argument += ", arg_type=get_location_type(self.cli_ctx)";
}
else {
argument += ", id_part=None, help='" + EscapeString(model.MethodParameter_Description) + "'";
}
if (model.MethodParameter_IsList) {
if (model.MethodParameter_Type == SchemaType.Object || model.MethodParameter_Type == SchemaType.Array) {
let actionName: string = "Add" + Capitalize(ToCamelCase(model.MethodParameter_Name));
argument += ", action=" + actionName;
hasActions = true;
if (actions.indexOf(actionName) < 0) {
actions.push(actionName);
}
}
argument += ", nargs='+'";
}
argument += ")";
output_args.push(argument);
} while(model.SelectNextMethodParameter());
}
} while(model.SelectNextMethod());
}
if (!hasParam) {
output_args.push(" pass");
}
else {
let hasParam = false;
do {
if(model.Option_IsFlattened) {
continue;
}
hasParam = true;
let parameterName = model.Option_NamePython;
let argument = " c.argument('" + parameterName + "'";
// this is to handle names like "format", "type", etc
if (parameterName == "type" || parameterName == "format") {
argument = " c.argument('_" + parameterName + "'";
argument += ", options_list=['--" + parameterName + "']";
}
if (model.Option_Type == SchemaType.Boolean) {
hasBoolean = true;
argument += ", arg_type=get_three_state_flag()";
}
else if (model.Option_Type == SchemaType.Choice || model.Option_Type == SchemaType.SealedChoice) {
hasEnum = true;
argument += ", arg_type=get_enum_type([";
model.Option_EnumValues.forEach(element => {
if (!argument.endsWith("[")) argument += ", ";
argument += "'" + element + "'";
});
argument += "])";
}
if (parameterName == "resource_group_name") {
argument += ", resource_group_name_type";
}
else if (parameterName == "tags") {
argument += ", tags_type";
}
else if (parameterName == "location") {
argument += ", arg_type=get_location_type(self.cli_ctx)";
}
else {
argument += ", id_part=None, help='" + EscapeString(model.Option_Description) + "'";
}
if (model.Option_IsList) {
if (model.Option_Type == SchemaType.Object || model.Option_Type == SchemaType.Array) {
let actionName: string = "Add" + Capitalize(ToCamelCase(model.Option_Name));
argument += ", action=" + actionName;
hasActions = true;
if (actions.indexOf(actionName) < 0) {
actions.push(actionName);
}
}
argument += ", nargs='+'";
}
argument += ")";
output_args.push(argument);
} while (model.SelectNextOption());
if (!hasParam) {
output_args.push(" pass");
}
}
return output_args;
}

Просмотреть файл

@ -16,7 +16,7 @@ helps['managed-network managed_networks'] = """
helps['managed-network managed_networks list'] = """
type: command
short-summary: The ListByResourceGroup ManagedNetwork operation retrieves all the Managed Network resources in a resource group in a paginated format.
short-summary: The ListBySubscription ManagedNetwork operation retrieves all the Managed Network Resources in the current subscription in a paginated format.
"""
helps['managed-network managed_networks show'] = """

Просмотреть файл

@ -17,48 +17,48 @@ def load_command_table(self, _):
operations_tmpl='azext_managed_network.vendored_sdks.managednetwork.operations._managed_networks_operations#ManagedNetworksOperations.{}',
client_factory=cf_managed_networks)
with self.command_group('managed-network managed_networks', managed_network_managed_networks, client_factory=cf_managed_networks) as g:
g.custom_command('list', 'managed-network_managed_networks_list')
g.custom_show_command('show', 'managed-network_managed_networks_show')
g.custom_command('create', 'managed-network_managed_networks_create')
g.custom_command('update', 'managed-network_managed_networks_update')
g.custom_command('delete', 'managed-network_managed_networks_delete')
g.custom_command('list', 'managed_network_managed_networks_list')
g.custom_show_command('show', 'managed_network_managed_networks_show')
g.custom_command('create', 'managed_network_managed_networks_create')
g.custom_command('update', 'managed_network_managed_networks_update')
g.custom_command('delete', 'managed_network_managed_networks_delete')
from ._client_factory import cf_scope_assignments
managed_network_scope_assignments = CliCommandType(
operations_tmpl='azext_managed_network.vendored_sdks.managednetwork.operations._scope_assignments_operations#ScopeAssignmentsOperations.{}',
client_factory=cf_scope_assignments)
with self.command_group('managed-network scope_assignments', managed_network_scope_assignments, client_factory=cf_scope_assignments) as g:
g.custom_command('list', 'managed-network_scope_assignments_list')
g.custom_show_command('show', 'managed-network_scope_assignments_show')
g.custom_command('create', 'managed-network_scope_assignments_create')
g.custom_command('update', 'managed-network_scope_assignments_update')
g.custom_command('delete', 'managed-network_scope_assignments_delete')
g.custom_command('list', 'managed_network_scope_assignments_list')
g.custom_show_command('show', 'managed_network_scope_assignments_show')
g.custom_command('create', 'managed_network_scope_assignments_create')
g.custom_command('update', 'managed_network_scope_assignments_update')
g.custom_command('delete', 'managed_network_scope_assignments_delete')
from ._client_factory import cf_managed_network_groups
managed_network_managed_network_groups = CliCommandType(
operations_tmpl='azext_managed_network.vendored_sdks.managednetwork.operations._managed_network_groups_operations#ManagedNetworkGroupsOperations.{}',
client_factory=cf_managed_network_groups)
with self.command_group('managed-network managed_network_groups', managed_network_managed_network_groups, client_factory=cf_managed_network_groups) as g:
g.custom_command('list', 'managed-network_managed_network_groups_list')
g.custom_show_command('show', 'managed-network_managed_network_groups_show')
g.custom_command('create', 'managed-network_managed_network_groups_create')
g.custom_command('update', 'managed-network_managed_network_groups_update')
g.custom_command('delete', 'managed-network_managed_network_groups_delete')
g.custom_command('list', 'managed_network_managed_network_groups_list')
g.custom_show_command('show', 'managed_network_managed_network_groups_show')
g.custom_command('create', 'managed_network_managed_network_groups_create')
g.custom_command('update', 'managed_network_managed_network_groups_update')
g.custom_command('delete', 'managed_network_managed_network_groups_delete')
from ._client_factory import cf_managed_network_peering_policies
managed_network_managed_network_peering_policies = CliCommandType(
operations_tmpl='azext_managed_network.vendored_sdks.managednetwork.operations._managed_network_peering_policies_operations#ManagedNetworkPeeringPoliciesOperations.{}',
client_factory=cf_managed_network_peering_policies)
with self.command_group('managed-network managed_network_peering_policies', managed_network_managed_network_peering_policies, client_factory=cf_managed_network_peering_policies) as g:
g.custom_command('list', 'managed-network_managed_network_peering_policies_list')
g.custom_show_command('show', 'managed-network_managed_network_peering_policies_show')
g.custom_command('create', 'managed-network_managed_network_peering_policies_create')
g.custom_command('update', 'managed-network_managed_network_peering_policies_update')
g.custom_command('delete', 'managed-network_managed_network_peering_policies_delete')
g.custom_command('list', 'managed_network_managed_network_peering_policies_list')
g.custom_show_command('show', 'managed_network_managed_network_peering_policies_show')
g.custom_command('create', 'managed_network_managed_network_peering_policies_create')
g.custom_command('update', 'managed_network_managed_network_peering_policies_update')
g.custom_command('delete', 'managed_network_managed_network_peering_policies_delete')
from ._client_factory import cf_operations
managed_network_operations = CliCommandType(
operations_tmpl='azext_managed_network.vendored_sdks.managednetwork.operations._operations_operations#OperationsOperations.{}',
client_factory=cf_operations)
with self.command_group('managed-network operations', managed_network_operations, client_factory=cf_operations) as g:
g.custom_command('list', 'managed-network_operations_list')
g.custom_command('list', 'managed_network_operations_list')

Просмотреть файл

@ -9,8 +9,8 @@
# pylint: disable=unused-argument
def managed-network_managed_networks_list(cmd, client,
resource_group_name,
def managed_network_managed_networks_list(cmd, client,
resource_group_name=None,
top=None,
skiptoken=None):
if resource_group_name is not None:
@ -18,13 +18,13 @@ def managed-network_managed_networks_list(cmd, client,
return client.list_by_subscription(top=top, skiptoken=skiptoken)
def managed-network_managed_networks_show(cmd, client,
def managed_network_managed_networks_show(cmd, client,
resource_group_name,
managed_network_name):
return client.get(resource_group_name=resource_group_name, managed_network_name=managed_network_name)
def managed-network_managed_networks_create(cmd, client,
def managed_network_managed_networks_create(cmd, client,
resource_group_name,
managed_network_name,
location=None,
@ -43,7 +43,7 @@ def managed-network_managed_networks_create(cmd, client,
return client.create_or_update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network=managed_network)
def managed-network_managed_networks_update(cmd, client,
def managed_network_managed_networks_update(cmd, client,
resource_group_name,
managed_network_name,
tags=None):
@ -52,24 +52,24 @@ def managed-network_managed_networks_update(cmd, client,
return client.update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, parameters=parameters)
def managed-network_managed_networks_delete(cmd, client,
def managed_network_managed_networks_delete(cmd, client,
resource_group_name,
managed_network_name):
return client.delete(resource_group_name=resource_group_name, managed_network_name=managed_network_name)
def managed-network_scope_assignments_list(cmd, client,
def managed_network_scope_assignments_list(cmd, client,
scope):
return client.list(scope=scope)
def managed-network_scope_assignments_show(cmd, client,
def managed_network_scope_assignments_show(cmd, client,
scope,
scope_assignment_name):
return client.get(scope=scope, scope_assignment_name=scope_assignment_name)
def managed-network_scope_assignments_create(cmd, client,
def managed_network_scope_assignments_create(cmd, client,
scope,
scope_assignment_name,
location=None,
@ -80,7 +80,7 @@ def managed-network_scope_assignments_create(cmd, client,
return client.create_or_update(scope=scope, scope_assignment_name=scope_assignment_name, parameters=parameters)
def managed-network_scope_assignments_update(cmd, client,
def managed_network_scope_assignments_update(cmd, client,
scope,
scope_assignment_name,
location=None,
@ -91,13 +91,13 @@ def managed-network_scope_assignments_update(cmd, client,
return client.create_or_update(scope=scope, scope_assignment_name=scope_assignment_name, parameters=parameters)
def managed-network_scope_assignments_delete(cmd, client,
def managed_network_scope_assignments_delete(cmd, client,
scope,
scope_assignment_name):
return client.delete(scope=scope, scope_assignment_name=scope_assignment_name)
def managed-network_managed_network_groups_list(cmd, client,
def managed_network_managed_network_groups_list(cmd, client,
resource_group_name,
managed_network_name,
top=None,
@ -105,14 +105,14 @@ def managed-network_managed_network_groups_list(cmd, client,
return client.list_by_managed_network(resource_group_name=resource_group_name, managed_network_name=managed_network_name, top=top, skiptoken=skiptoken)
def managed-network_managed_network_groups_show(cmd, client,
def managed_network_managed_network_groups_show(cmd, client,
resource_group_name,
managed_network_name,
managed_network_group_name):
return client.get(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_group_name=managed_network_group_name)
def managed-network_managed_network_groups_create(cmd, client,
def managed_network_managed_network_groups_create(cmd, client,
resource_group_name,
managed_network_name,
managed_network_group_name,
@ -120,7 +120,7 @@ def managed-network_managed_network_groups_create(cmd, client,
return client.create_or_update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_group_name=managed_network_group_name, managed_network_group=managed_network_group)
def managed-network_managed_network_groups_update(cmd, client,
def managed_network_managed_network_groups_update(cmd, client,
resource_group_name,
managed_network_name,
managed_network_group_name,
@ -128,14 +128,14 @@ def managed-network_managed_network_groups_update(cmd, client,
return client.create_or_update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_group_name=managed_network_group_name, managed_network_group=managed_network_group)
def managed-network_managed_network_groups_delete(cmd, client,
def managed_network_managed_network_groups_delete(cmd, client,
resource_group_name,
managed_network_name,
managed_network_group_name):
return client.delete(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_group_name=managed_network_group_name)
def managed-network_managed_network_peering_policies_list(cmd, client,
def managed_network_managed_network_peering_policies_list(cmd, client,
resource_group_name,
managed_network_name,
top=None,
@ -143,14 +143,14 @@ def managed-network_managed_network_peering_policies_list(cmd, client,
return client.list_by_managed_network(resource_group_name=resource_group_name, managed_network_name=managed_network_name, top=top, skiptoken=skiptoken)
def managed-network_managed_network_peering_policies_show(cmd, client,
def managed_network_managed_network_peering_policies_show(cmd, client,
resource_group_name,
managed_network_name,
managed_network_peering_policy_name):
return client.get(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_peering_policy_name=managed_network_peering_policy_name)
def managed-network_managed_network_peering_policies_create(cmd, client,
def managed_network_managed_network_peering_policies_create(cmd, client,
resource_group_name,
managed_network_name,
managed_network_peering_policy_name,
@ -168,7 +168,7 @@ def managed-network_managed_network_peering_policies_create(cmd, client,
return client.create_or_update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_peering_policy_name=managed_network_peering_policy_name, managed_network_policy=managed_network_policy)
def managed-network_managed_network_peering_policies_update(cmd, client,
def managed_network_managed_network_peering_policies_update(cmd, client,
resource_group_name,
managed_network_name,
managed_network_peering_policy_name,
@ -186,12 +186,12 @@ def managed-network_managed_network_peering_policies_update(cmd, client,
return client.create_or_update(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_peering_policy_name=managed_network_peering_policy_name, managed_network_policy=managed_network_policy)
def managed-network_managed_network_peering_policies_delete(cmd, client,
def managed_network_managed_network_peering_policies_delete(cmd, client,
resource_group_name,
managed_network_name,
managed_network_peering_policy_name):
return client.delete(resource_group_name=resource_group_name, managed_network_name=managed_network_name, managed_network_peering_policy_name=managed_network_peering_policy_name)
def managed-network_operations_list(cmd, client):
def managed_network_operations_list(cmd, client):
return client.list()