search

package
v0.5.9-alpha.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCustomColumnsFormatter added in v0.5.3

func NewCustomColumnsFormatter(spec string) (*customColumnsFormatter, error)

NewCustomColumnsFormatter creates a custom columns formatter from a comma separated list of <header>:<jsonpath-field-spec> pairs. e.g. NAME:metadata.name,API_VERSION:apiVersion creates a formatter that formats the input to:

{"fields":{"API_VERSION":"v1","NAME":"foo"},"titles":["NAME","API_VERSION"]}

func SearchForResource

func SearchForResource(searchMgr *search.SearchManager, aiMgr *ai.AIManager, searchStorage storage.SearchStorage) http.HandlerFunc

SearchForResource returns an HTTP handler function that returns an array of Kubernetes runtime Object matched using the query from context. It utilizes a SearchManager to execute the logic.

@Summary SearchForResource returns an array of Kubernetes runtime Object matched using the query from context. @Description This endpoint returns an array of Kubernetes runtime Object matched using the query from context. @Tags search @Produce json @Param query query string true "The query to use for search. Required" @Param pattern query string true "The search pattern. Can be either sql, dsl or nl. Required" @Param pageSize query string false "The size of the page. Default to 10" @Param page query string false "The current page to fetch. Default to 1" @Success 200 {array} runtime.Object "Array of runtime.Object" @Failure 400 {string} string "Bad Request" @Failure 401 {string} string "Unauthorized" @Failure 404 {string} string "Not Found" @Failure 405 {string} string "Method Not Allowed" @Failure 429 {string} string "Too Many Requests" @Failure 500 {string} string "Internal Server Error" @Router /rest-api/v1/search [get]

Types

type CustomColumnsOutput added in v0.5.3

type CustomColumnsOutput struct {
	Fields map[string]any `json:"fields,omitempty"`

	// Titles is to imply the keys order as the keys order of the fields is random.
	Titles []string `json:"titles,omitempty"`
}

type Formatter added in v0.5.3

type Formatter interface {
	Format(obj runtime.Object) (any, error)
}

func ParseObjectFormatter added in v0.5.3

func ParseObjectFormatter(format string) (Formatter, error)

ParseObjectFormatter parses a format string and returns a Formatter.

type NopFormatter added in v0.5.3

type NopFormatter struct{}

func (*NopFormatter) Format added in v0.5.3

func (f *NopFormatter) Format(obj runtime.Object) (any, error)

Format keeps the obj unchanged.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL