@@ -121,6 +121,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if err := cmdutil.ValidateEnum("order-by", flagOrderBy, []string{"CREATED_AT"}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
variables["orderBy"] = map[string]any{
|
||||
"field": flagOrderBy,
|
||||
"direction": flagOrderDir,
|
||||
@@ -131,15 +132,19 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if flagAction != "" {
|
||||
filter["action"] = flagAction
|
||||
}
|
||||
|
||||
if flagActorID != "" {
|
||||
filter["actorId"] = flagActorID
|
||||
}
|
||||
|
||||
if flagResourceType != "" {
|
||||
filter["resourceType"] = flagResourceType
|
||||
}
|
||||
|
||||
if flagResourceID != "" {
|
||||
filter["resourceId"] = flagResourceID
|
||||
}
|
||||
|
||||
if len(filter) > 0 {
|
||||
variables["filter"] = filter
|
||||
}
|
||||
@@ -159,12 +164,15 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if err := json.Unmarshal(data, &resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.Node == nil {
|
||||
return nil, fmt.Errorf("organization %s not found", flagOrg)
|
||||
}
|
||||
|
||||
if resp.Node.Typename != "Organization" {
|
||||
return nil, fmt.Errorf("expected Organization node, got %s", resp.Node.Typename)
|
||||
}
|
||||
|
||||
return &resp.Node.AuditLogEntries, nil
|
||||
},
|
||||
)
|
||||
@@ -176,6 +184,7 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
if entries == nil {
|
||||
entries = []auditLogEntry{}
|
||||
}
|
||||
|
||||
return cmdutil.PrintJSON(f.IOStreams.Out, entries)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user