mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
feature: add network-status methods to change status of on-premise
network
This commit is contained in:
@@ -445,4 +445,19 @@ func init() {
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type NetworkStatusOptions struct {
|
||||
NETWORK string `help:"id or name of network to sync" json:"-"`
|
||||
STATUS string `help:"status of network" choices:"available|unavailable" json:"status"`
|
||||
Reason string `help:"reason to change status" json:"reason"`
|
||||
}
|
||||
R(&NetworkStatusOptions{}, "network-status", "Set on-premise network status", func(s *mcclient.ClientSession, args *NetworkStatusOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.Networks.PerformAction(s, args.NETWORK, "status", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -44,16 +44,13 @@ func init() {
|
||||
return nil
|
||||
})
|
||||
|
||||
R(&TaskListOptions{}, "region-task-list", "List tasks on region server", func(s *mcclient.ClientSession, suboptions *TaskListOptions) error {
|
||||
var params *jsonutils.JSONDict
|
||||
{
|
||||
var err error
|
||||
params, err = suboptions.BaseListOptions.Params()
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
}
|
||||
}
|
||||
type RegionTaskListOptions struct {
|
||||
ObjName string `help:"object name"`
|
||||
ObjId string `help:"object id"`
|
||||
TaskName string `help:"task name"`
|
||||
}
|
||||
R(&RegionTaskListOptions{}, "region-task-list", "List tasks on region server", func(s *mcclient.ClientSession, args *RegionTaskListOptions) error {
|
||||
params := jsonutils.Marshal(args)
|
||||
result, err := modules.ComputeTasks.List(s, params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user