Documentation
¶
Index ¶
- Variables
- func ContextValue(c *Client) cli.Action
- func Describe(paramsopt ...*DescribeParams) cli.Action
- func Do() cli.Action
- func FetchAndPrint() cli.Action
- func FlagsAndArgs() cli.Action
- func Import() cli.Action
- func ListFilters() cli.Action
- func NewFilterDownloader(f Filter, d joehttpclient.Downloader, h historyGenerator) joehttpclient.Downloader
- func Open() cli.Action
- func SetFilter(f ...*provider.Value) cli.Action
- func SetIncludeMetadata(f ...bool) cli.Action
- func SetType(v ...Type) cli.Action
- type Client
- type DescribeParams
- type Filter
- type IncludeMetadataFilter
- type Location
- type LocationResolver
- type Option
- type Request
- type Response
- type Type
Constants ¶
This section is empty.
Variables ¶
var ( // FilterRegistry contains all filters available to the client. FilterRegistry = &provider.Registry{ Name: "filter", AllowUnknown: true, Providers: provider.Details{ "jmespath": { Factory: provider.FactoryOf(newJMESPath), Defaults: map[string]string{ "query": "@", }, HelpText: "Use JMES Path to select matching JSON data", }, "dig": { Factory: provider.FactoryOf(newDig), Defaults: map[string]string{ "query": "", }, HelpText: "Use a simple expression to retrieve a value", }, "gotpl": { Factory: provider.FactoryOf(newTemplate), Defaults: map[string]string{ "text": "Result: {{ .Result }}", "file": "", }, HelpText: "Use Go template to manipulate matching data", }, "json": { Factory: provider.FactoryOf(newJSONFilter), Defaults: map[string]string{ "pretty": "false", }, HelpText: "Generate JSON output", }, "xpath": { Factory: provider.FactoryOf(newXPathFilter), Defaults: map[string]string{ "query": "", }, HelpText: "Apply an XPath expression", }, "xml": { Factory: provider.FactoryOf(newXMLFilter), Defaults: map[string]string{}, HelpText: "Generate XML output", }, "yaml": { Factory: provider.FactoryOf(newYAMLFilter), Defaults: map[string]string{}, HelpText: "Generate YAML output", }, "raw": { Value: NewRawFilter(), Defaults: map[string]string{}, Aliases: []string{"r", "text"}, HelpText: "Raw text without processing", }, }, } )
Functions ¶
func ContextValue ¶
ContextValue provides an action which sets the client into the context.
func Describe ¶
func Describe(paramsopt ...*DescribeParams) cli.Action
Describe provides the action for describing a resource
func Do ¶
func Do() cli.Action
Do provides the default action of the client which is to invoke it and print the results. This can be assigned to the Uses pipeline to set up necessary prerequisites. The actual action is FetchAndPrint
func FetchAndPrint ¶
func FetchAndPrint() cli.Action
FetchAndPrint invokes the client and prints the results.
func FlagsAndArgs ¶
FlagsAndArgs provides an action which sets up flags and args used by the client. Despite its name, the action contributes no args.
func ListFilters ¶
ListFilters provides an action which lists all filters available to the filter registry.
func NewFilterDownloader ¶
func NewFilterDownloader(f Filter, d joehttpclient.Downloader, h historyGenerator) joehttpclient.Downloader
NewFilterDownloader applies the filter to an underlying downloader.
func Open ¶
func Open() cli.Action
Open reveals a particular file or link in the editor or web browser
func SetFilter ¶
SetFilter provides an action which sets the filter which will be used in the response. This also provides an accessory flag.
func SetIncludeMetadata ¶
Types ¶
type Client ¶
Client provides the Pastiche client, which can invoke underlying HTTP or gRPC services
func FromContext ¶
FromContext obtains the client stored in the context
func (*Client) SetIncludeMetadata ¶
type DescribeParams ¶
type DescribeParams struct {
*Request
}
type Filter ¶
Filter applies a search to the response data and returns the response data.
func NewDigFilter ¶
NewDigFilter creates a filter which resolves a qualified name in a response value.
func NewJMESPathFilter ¶
NewJMESPathFilter provides a filter which uses the given query to search a data structure with JSON semantics using JMESPath.
func NewNamedOutputFilter ¶
NewNamedOutputFilter creates a filter that resolves a named output configuration from the service resolver at runtime.
func NewRawFilter ¶
func NewRawFilter() Filter
NewRawFilter provides a filter which does not processing
func NewTemplateFilter ¶
NewTemplateFilter creates a filter which resolves a qualified name in a response value.
func NewXPathFilter ¶
NewXPathFilter generates a new XPath filter
type IncludeMetadataFilter ¶
IncludeMetadataFilter is a filter which can request metadata be included in the response data
type Location ¶
type Location interface {
httpclient.Location
Resolved() model.ResolvedResource
}
Location represents an HTTP client location and its resolved resource or operation in the configuration
type LocationResolver ¶
type LocationResolver interface {
httpclient.LocationResolver
BaseURL() *url.URL
Vars() map[string]any
}
LocationResolver represents an HTTP client location resolver
func NewServiceResolver ¶
func NewServiceResolver( c *model.Model, root func(context.Context) *model.ServiceSpec, server func(context.Context) string, method func(context.Context) string, ) LocationResolver
NewServiceResolver creates a service resolver compatible with the client.
type Option ¶
type Option func(*Client)
Option identifies a client option
func WithDefaultLocationResolver ¶
func WithDefaultLocationResolver() Option
WithDefaultLocationResolver provides a client option which sets up the default location resolver, which uses the CLI arguments and flags named "service", "server", and "method"
func WithLocationResolver ¶
func WithLocationResolver(value httpclient.LocationResolver) Option
WithLocationResolver sets the location resolver used by the client
type Type ¶
type Type int
Type enumerates the client types available to Pastiche client
func (Type) MarshalText ¶
MarshalText provides the textual representation
func (*Type) UnmarshalText ¶
UnmarshalText converts the textual representation