mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-05-23 13:00:18 +08:00
33 lines
682 B
Go
33 lines
682 B
Go
package shell
|
|
|
|
import (
|
|
"yunion.io/x/onecloud/pkg/util/openstack"
|
|
"yunion.io/x/onecloud/pkg/util/shellutils"
|
|
)
|
|
|
|
func init() {
|
|
type VpcListOptions struct {
|
|
}
|
|
shellutils.R(&VpcListOptions{}, "vpc-list", "List vpcs", func(cli *openstack.SRegion, args *VpcListOptions) error {
|
|
vpcs, err := cli.GetVpcs()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
printList(vpcs, 0, 0, 0, nil)
|
|
return nil
|
|
})
|
|
|
|
type VpcShowOptions struct {
|
|
ID string `help:"ID of vpc"`
|
|
}
|
|
shellutils.R(&VpcShowOptions{}, "vpc-show", "Show vpc", func(cli *openstack.SRegion, args *VpcShowOptions) error {
|
|
vpc, err := cli.GetVpc(args.ID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
printObject(vpc)
|
|
return nil
|
|
})
|
|
|
|
}
|