fleet/orbit/pkg/table/empty_extension.go
Juan Fernandez 9cc07b2446
Orbit shell fails to query orbit_info extension table (#38714)
Resolves #37220

Added a dummy implementation of the orbit_info table to the orbit shell.
A full implementation is not possible directly in the shell because the
orbit service stores specific instrumentation values in memory. To query
the live orbit_info table, users must connect to the osquery-orbit
extension socket.
2026-01-28 18:42:29 -04:00

40 lines
765 B
Go

package table
import (
"context"
"github.com/osquery/osquery-go/plugin/table"
)
// EmptyExtension implements a basic table extension that displays an instructional
// message to the user during queries.
type EmptyExtension struct {
name string
msg string
}
func NewEmptyExtension(
name string,
msg string,
) Opt {
return WithExtension(
&EmptyExtension{
name: name,
msg: msg,
},
)
}
func (o EmptyExtension) Name() string {
return o.name
}
func (o EmptyExtension) Columns() []table.ColumnDefinition {
return []table.ColumnDefinition{
table.TextColumn("message"),
}
}
func (o EmptyExtension) GenerateFunc(_ context.Context, _ table.QueryContext) ([]map[string]string, error) {
return []map[string]string{{
"message": o.msg,
}}, nil
}