fix: more event show subcmd

This commit is contained in:
Qiu Jian
2023-06-30 12:15:32 +08:00
parent 164738fb2c
commit 795a983fe0
+11
View File
@@ -21,6 +21,7 @@ import (
"yunion.io/x/onecloud/pkg/mcclient/modulebase"
"yunion.io/x/onecloud/pkg/mcclient/modules"
"yunion.io/x/onecloud/pkg/mcclient/modules/compute"
"yunion.io/x/onecloud/pkg/mcclient/modules/k8s"
)
type BaseEventListOptions struct {
@@ -78,6 +79,10 @@ func doNotifyEventList(s *mcclient.ClientSession, args *EventListOptions) error
return DoEventList(modules.NotifyLogs, s, args)
}
func doK8sEventList(s *mcclient.ClientSession, args *EventListOptions) error {
return DoEventList(*k8s.Logs.ResourceManager, s, args)
}
func DoEventList(man modulebase.ResourceManager, s *mcclient.ClientSession, args *EventListOptions) error {
params := jsonutils.NewDict()
if len(args.Type) > 0 {
@@ -146,6 +151,12 @@ func DoEventList(man modulebase.ResourceManager, s *mcclient.ClientSession, args
func init() {
R(&EventListOptions{}, "event-show", "Show operation event logs", doComputeEventList)
R(&EventListOptions{}, "region-event-show", "Show operation event logs", doComputeEventList)
R(&EventListOptions{}, "glance-event-show", "Show operation event logs", doImageEventList)
R(&EventListOptions{}, "keystone-event-show", "Show operation event logs", doIdentityEventList)
R(&EventListOptions{}, "monitor-event-show", "Show operation event logs", doMonitorEventList)
R(&EventListOptions{}, "notify-event-show", "Show operation event logs", doNotifyEventList)
R(&EventListOptions{}, "kube-event-show", "Show operation event logs", doK8sEventList)
R(&TypeEventListOptions{}, "server-event", "Show operation event logs of server", func(s *mcclient.ClientSession, args *TypeEventListOptions) error {
nargs := EventListOptions{BaseEventListOptions: args.BaseEventListOptions, Id: args.ID, Type: []string{"server"}}