From a0b39cc7b2a2a09fa3df74ab1ceb4e7aab0cdff5 Mon Sep 17 00:00:00 2001 From: Yousong Zhou Date: Fri, 15 May 2020 15:11:28 +0800 Subject: [PATCH] climc: vpcs: add --external-access-mode argument --- cmd/climc/shell/compute/vpcs.go | 35 +++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/cmd/climc/shell/compute/vpcs.go b/cmd/climc/shell/compute/vpcs.go index 88ae862539..3e16447a0d 100644 --- a/cmd/climc/shell/compute/vpcs.go +++ b/cmd/climc/shell/compute/vpcs.go @@ -29,9 +29,10 @@ func init() { type VpcListOptions struct { options.BaseListOptions - Usable *bool `help:"Filter usable vpcs"` - Region string `help:"ID or Name of region" json:"-"` - Globalvpc string `help:"Filter by globalvpc"` + Usable *bool `help:"Filter usable vpcs"` + Region string `help:"ID or Name of region" json:"-"` + Globalvpc string `help:"Filter by globalvpc"` + ExternalAccessMode string `help:"Filter by external access mode" choices:"distgw|eip|eip-distgw"` } R(&VpcListOptions{}, "vpc-list", "List VPCs", func(s *mcclient.ClientSession, opts *VpcListOptions) error { params, err := options.ListStructToParams(opts) @@ -58,13 +59,14 @@ func init() { }) type VpcCreateOptions struct { - REGION string `help:"ID or name of the region where the VPC is created"` - Id string `help:"ID of the new VPC"` - NAME string `help:"Name of the VPC"` - CIDR string `help:"CIDR block"` - Default bool `help:"default VPC for the region" default:"false"` - Desc string `help:"Description of the VPC"` - Manager string `help:"ID or Name of Cloud provider"` + REGION string `help:"ID or name of the region where the VPC is created"` + Id string `help:"ID of the new VPC"` + NAME string `help:"Name of the VPC"` + CIDR string `help:"CIDR block"` + Default bool `help:"default VPC for the region" default:"false"` + Desc string `help:"Description of the VPC"` + Manager string `help:"ID or Name of Cloud provider"` + ExternalAccessMode string `help:"Filter by external access mode" choices:"distgw|eip|eip-distgw" default:"eip-distgw"` } R(&VpcCreateOptions{}, "vpc-create", "Create a VPC", func(s *mcclient.ClientSession, args *VpcCreateOptions) error { params := jsonutils.NewDict() @@ -73,6 +75,9 @@ func init() { if len(args.Id) > 0 { params.Add(jsonutils.NewString(args.Id), "id") } + if len(args.ExternalAccessMode) > 0 { + params.Add(jsonutils.NewString(args.ExternalAccessMode), "external_access_mode") + } if len(args.Desc) > 0 { params.Add(jsonutils.NewString(args.Desc), "description") } @@ -112,15 +117,19 @@ func init() { }) type VpcUpdateOptions struct { - ID string `help:"ID or name of the VPC"` - Name string `help:"New name of the VPC"` - Desc string `help:"Description of the VPC"` + ID string `help:"ID or name of the VPC"` + Name string `help:"New name of the VPC"` + Desc string `help:"Description of the VPC"` + ExternalAccessMode string `help:"Filter by external access mode" choices:"distgw|eip|eip-distgw"` } R(&VpcUpdateOptions{}, "vpc-update", "Update a VPC", func(s *mcclient.ClientSession, args *VpcUpdateOptions) error { params := jsonutils.NewDict() if len(args.Name) > 0 { params.Add(jsonutils.NewString(args.Name), "name") } + if len(args.ExternalAccessMode) > 0 { + params.Add(jsonutils.NewString(args.ExternalAccessMode), "external_access_mode") + } if len(args.Desc) > 0 { params.Add(jsonutils.NewString(args.Desc), "description") }