clipb

package
v0.4.27 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagToken                 = "auth-token"
	FlagJwtKey                = "jwt-key"
	FlagEndpoint              = "server-addr"
	FlagTlsInsecureSkipVerify = "tls-insecure-skip-verify"
	FlagTlsCaCertFile         = "tls-ca-cert-file"
	FlagResponseFormat        = "response-format"
	FlagTimeout               = "timeout"
	FlagRawResponse           = "raw-response"
	FlagInputFile             = "input-file"
	FlagHttpHeaders           = "header"
	FlagWithResponseHeaders   = "with-response-headers"
)
View Source
const (
	MaxTableViewColumnWidth = 200
)

Variables

This section is empty.

Functions

func MakeVarForField

func MakeVarForField(msg goten.GotenMessage, fieldPath object.FieldPath) pflag.Value

Types

type CommonOptions

type CommonOptions struct {
	ServiceName string

	*DialOptions
	*InputOptions
	*OutputOptions
}

func NewOptionsAttachedToCmd

func NewOptionsAttachedToCmd(cmd *cobra.Command, serviceName string) *CommonOptions

type DialOptions

type DialOptions struct {
	ServiceName string

	Token              string        `envconfig:"AUTH_TOKEN"`
	JwtKey             string        `envconfig:"JWT_KEY"`
	Endpoint           string        `envconfig:"SERVER_ADDR"`
	InsecureSkipVerify bool          `envconfig:"TLS_INSECURE_SKIP_VERIFY"`
	CACertFile         string        `envconfig:"TLS_CA_CERT_FILE"`
	Timeout            time.Duration `envconfig:"TIMEOUT" default:"10s"`
}

func NewDialOptionsAttachedToCmd

func NewDialOptionsAttachedToCmd(cmd *cobra.Command, serviceName string) *DialOptions

type GrpcDialer

type GrpcDialer func(ctx context.Context, dialOpts *DialOptions, extra ...grpc.DialOption) (*grpc.ClientConn, error)

type InputOptions

type InputOptions struct {
	ServiceName string

	InputFile   string `envconfig:"INPUT_FILE"`
	HttpHeaders []string
}

func NewInputOptionsAttachedToCmd

func NewInputOptionsAttachedToCmd(cmd *cobra.Command, serviceName string) *InputOptions

func (*InputOptions) WithRequestHeaders

func (io *InputOptions) WithRequestHeaders(ctx context.Context) context.Context

type NameProvider added in v0.4.20

type NameProvider struct {
	// contains filtered or unexported fields
}

func NewNameProvider added in v0.4.20

func NewNameProvider(segmentsFromContext map[string]string) *NameProvider

func (*NameProvider) FillName added in v0.4.20

func (p *NameProvider) FillName(name resource.Name)

func (*NameProvider) RegisterFlagsFromRequest added in v0.4.20

func (p *NameProvider) RegisterFlagsFromRequest(flags *pflag.FlagSet, protoMsg proto.Message)

type OutputOptions

type OutputOptions struct {
	ServiceName string

	RawResponse         bool
	WithResponseHeaders bool
	ResponseFormat      string `envconfig:"RESPONSE_FORMAT" default:"table"`
}

func NewOutputOptionsAttachedToCmd

func NewOutputOptionsAttachedToCmd(cmd *cobra.Command, serviceName string) *OutputOptions

type ResponseEncoder

type ResponseEncoder interface {
	SetColumns(fieldPaths []object.FieldPath, displayNames []string)
	Add(msg proto.Message) error
	SetPageTokens(next, prev resource.Cursor) error
	SetResponseHeaders(headers metadata.MD) error

	// Close ensures that all data gets written to encoder's stream.
	Close() error
}

ResponseEncoder encodes one or more messages in a desired format. There are two types of encoders:

streaming - Output data as quickly as it provided by SetNames and Add.
            In case of streaming responses, they output data as soon
            as it is received.
non-streaming - Need to know all data upfront in order to be able
                to format it. Data will be produced only after Finish() is called.

func NewResponseEncoder

func NewResponseEncoder(writer io.Writer, format ResponseEncoderFormat) (ResponseEncoder, error)

type ResponseEncoderFormat

type ResponseEncoderFormat string
const (
	// JsonEncoderFormat for streaming requests
	JsonEncoderFormat ResponseEncoderFormat = "json"

	// TableEncoderFormat for non-streaming requests
	TableEncoderFormat ResponseEncoderFormat = "table"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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