feat: resource list and table output formatter
This commit is contained in:
@ -19,7 +19,7 @@ type ResourceHandler interface {
|
||||
}
|
||||
|
||||
type GetHandler interface {
|
||||
Get(ctx context.Context, params params.Container) ([]any, error)
|
||||
Get(ctx context.Context, params params.Container) (*ResourceList, error)
|
||||
}
|
||||
|
||||
type Verb string
|
||||
|
||||
@ -1,7 +1,14 @@
|
||||
package interfaces
|
||||
|
||||
import "io"
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
type Formatter interface {
|
||||
Format(object []any) (io.Reader, error)
|
||||
Format(object *ResourceList) (io.Reader, error)
|
||||
}
|
||||
|
||||
type TableOutput interface {
|
||||
ColumnNames() []string
|
||||
Columns() []any
|
||||
}
|
||||
|
||||
12
core/interfaces/resource.go
Normal file
12
core/interfaces/resource.go
Normal file
@ -0,0 +1,12 @@
|
||||
package interfaces
|
||||
|
||||
type Resource interface {
|
||||
Kind() string
|
||||
|
||||
Name() string
|
||||
}
|
||||
|
||||
type ResourceList struct {
|
||||
ItemKind string
|
||||
Items []Resource
|
||||
}
|
||||
Reference in New Issue
Block a user