Documentation ¶
Index ¶
- Variables
- func Doc(raw string) string
- func NewSynseGrpcClient(ctx, certFile string) (*grpc.ClientConn, synse.V3PluginClient, error)
- func NewSynseHTTPClient(ctx string, certFile string) (synse.Client, error)
- func NewSynseWebsocketClient(ctx string, certFile string) (synse.Client, error)
- func NewTabWriter(out io.Writer) *tabwriter.Writer
- func NormalizeTags(tags []string) []string
- func ObjToYAML(obj interface{}) ([]byte, error)
- func StringToTag(s string) (*synse.V3Tag, error)
- type Printer
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoCurrentPluginCtx = errors.New("failed creating plugin gRPC client: no current plugin context") ErrInvalidPluginCtx = errors.New("failed creating plugin gRPC client: specified context does not exist") ErrNotAPluginCtx = errors.New("failed creating plugin gRPC client: specified context is not a plugin context") )
Errors relating to gRPC client creation.
var ( ErrNoCurrentServerCtx = errors.New("failed creating server HTTP client: no current server context") ErrInvalidServerCtx = errors.New("failed creating server HTTP client: specified context does not exist") ErrNotAServerCtx = errors.New("failed creating server HTTP client: specified context is not a server context") )
Errors relating to HTTP client creation.
var ( ErrNoOutputMode = errors.New("no output mode set for printer") ErrNoRowFunc = errors.New("table output requires a row function") )
Printer-specific errors.
var ( ErrWSNoCurrentServerCtx = errors.New("failed to create server WebSocket client: no current server context") ErrWSInvalidServerCtx = errors.New("failed to create server WebSocket client: specified context does not exist") ErrWSNotAServerCtx = errors.New("failed to create server WebSocket client: specified context is not a server context") )
Errors relating to WebSocket client creation.
Functions ¶
func NewSynseGrpcClient ¶
func NewSynseGrpcClient(ctx, certFile string) (*grpc.ClientConn, synse.V3PluginClient, error)
NewSynseGrpcClient creates a new instance of a Synse gRPC client for communicating with Synse plugins.
func NewSynseHTTPClient ¶
NewSynseHTTPClient creates a new Synse HTTP client for communicating with Synse Server instances.
func NewSynseWebsocketClient ¶
NewSynseWebsocketClient creates a new Synse WebSocket client for communicating with Synse Server over its WebSocket API. The CLI only uses this client for WebSocket-only features, such as streaming live readings.
func NewTabWriter ¶
NewTabWriter creates a tabwriter with default configurations to align input text into tab-spaced columns.
func NormalizeTags ¶
NormalizeTags takes a slice specifying tags which may be comma-separated and produces a slice of tags where each element is an individual tag.
func ObjToYAML ¶
ObjToYAML converts an object to YAML, first marshalling it to JSON.
Typically, one would be able to use yaml.Marshal, but since the autogenerated gRPC/protobuf code does not include tags for YAML, the "private" XXX_ prefixed fields of the gRPC object are serialized out to YAML. The objects have a JSON tag, so by marshaling to JSON first, we can effectively use the JSON tag as a YAML tag as well.
Types ¶
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer defines the printing capabilities for CLI output.
func NewPrinter ¶
NewPrinter creates a new printer to use for output formatting.
func (*Printer) SetIntermediateYaml ¶
func (p *Printer) SetIntermediateYaml()
SetIntermediateYaml configures the printer to marshal to JSON prior to marshalling to YAML. See comment on 'nativeYaml' field for details.
func (*Printer) SetRowFunc ¶
SetRowFunc sets the table row printer function, which specifies which data gets printed in a row of the table.
func (*Printer) SetTransformFunc ¶
SetTransformFunc sets the YAML/JSON data transform function. This is optional and can be used to get data into the proper output format.