Skip to content

Commit

Permalink
climc: vpcs: add --external-access-mode argument
Browse files Browse the repository at this point in the history
  • Loading branch information
yousong committed May 28, 2020
1 parent eebd15e commit a0b39cc
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions cmd/climc/shell/compute/vpcs.go
Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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")
}
Expand Down Expand Up @@ -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")
}
Expand Down

0 comments on commit a0b39cc

Please sign in to comment.