Files
cloudpods/pkg/util/aliyun/shell/vpc.go
T
2018-11-16 15:05:05 +08:00

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)
})
}