mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-21 14:19:49 +08:00
35 lines
1007 B
Go
35 lines
1007 B
Go
package shell
|
|
|
|
import (
|
|
"yunion.io/x/onecloud/pkg/util/aws"
|
|
"yunion.io/x/onecloud/pkg/util/shellutils"
|
|
)
|
|
|
|
func init() {
|
|
type SecurityGroupListOptions struct {
|
|
VpcId string `help:"VPC ID"`
|
|
Limit int `help:"page size"`
|
|
Offset int `help:"page offset"`
|
|
}
|
|
shellutils.R(&SecurityGroupListOptions{}, "security-group-list", "List security group", func(cli *aws.SRegion, args *SecurityGroupListOptions) error {
|
|
secgrps, total, e := cli.GetSecurityGroups(args.VpcId, args.Offset, args.Limit)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
printList(secgrps, total, args.Offset, args.Limit, []string{})
|
|
return nil
|
|
})
|
|
|
|
type SecurityGroupShowOptions struct {
|
|
ID string `help:"ID or name of security group"`
|
|
}
|
|
shellutils.R(&SecurityGroupShowOptions{}, "security-group-show", "Show details of a security group", func(cli *aws.SRegion, args *SecurityGroupShowOptions) error {
|
|
secgrp, err := cli.GetSecurityGroupDetails(args.ID)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
printObject(secgrp)
|
|
return nil
|
|
})
|
|
}
|