mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-13 07:46:56 +08:00
31 lines
718 B
Go
31 lines
718 B
Go
package shell
|
|
|
|
import (
|
|
"yunion.io/x/onecloud/pkg/util/aliyun"
|
|
"yunion.io/x/onecloud/pkg/util/shellutils"
|
|
)
|
|
|
|
func init() {
|
|
type VpcListOptions struct {
|
|
Limit int `help:"page size"`
|
|
Offset int `help:"page offset"`
|
|
}
|
|
shellutils.R(&VpcListOptions{}, "vpc-list", "List vpcs", func(cli *aliyun.SRegion, args *VpcListOptions) error {
|
|
vpcs, total, e := cli.GetVpcs(nil, args.Offset, args.Limit)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
printList(vpcs, total, args.Offset, args.Limit, []string{})
|
|
return nil
|
|
})
|
|
|
|
type VpcOptions struct {
|
|
ID string `help:"VPC id"`
|
|
}
|
|
|
|
shellutils.R(&VpcOptions{}, "vpc-delete", "Delete vpc", func(cli *aliyun.SRegion, args *VpcOptions) error {
|
|
return cli.DeleteVpc(args.ID)
|
|
})
|
|
|
|
}
|