climc: add server-modify-src-check

This commit is contained in:
Yousong Zhou
2019-12-25 12:09:50 +08:00
parent 2ce3925344
commit e65081c93f
2 changed files with 19 additions and 0 deletions
+13
View File
@@ -460,6 +460,19 @@ func init() {
return nil
})
R(&options.ServerModifySrcCheckOptions{}, "server-modify-src-check", "Modify src ip, mac check settings", func(s *mcclient.ClientSession, opts *options.ServerModifySrcCheckOptions) error {
params, err := options.StructToParams(opts)
if err != nil {
return err
}
srv, err := modules.Servers.PerformAction(s, opts.ID, "modify-src-check", params)
if err != nil {
return err
}
printObject(srv)
return nil
})
R(&options.ServerSecGroupsOptions{}, "server-set-secgroup", "Set security groups to a VM", func(s *mcclient.ClientSession, opts *options.ServerSecGroupsOptions) error {
params, err := options.StructToParams(opts)
if err != nil {
+6
View File
@@ -532,6 +532,12 @@ type ServerSecGroupsOptions struct {
Secgrp []string `help:"Ids of Security Groups" metavar:"Security Groups" positional:"true"`
}
type ServerModifySrcCheckOptions struct {
ID string `help:"ID or Name of server" metavar:"Guest" json:"-"`
SrcIpCheck string `help:"Turn on/off src ip check" choices:"on|off"`
SrcMacCheck string `help:"Turn on/off src mac check" choices:"on|off"`
}
type ServerSendKeyOptions struct {
ID string `help:"ID or Name of server" metavar:"Guest" json:"-"`
KEYS string `help:"Special keys to send, eg. ctrl, alt, f12, shift, etc, separated by \"-\""`