Documentation
¶
Index ¶
- Variables
- func DefaultLoggingSetup(logLevel zapcore.Level) func(ctx context.Context) context.Context
- func InitialContext() context.Context
- func SetupOutput(cbr Cobralike, loggingSetup LoggingSetup)
- func SimplifiedLoggingSetup(logLevel zapcore.Level) func(ctx context.Context) context.Context
- func ValidateTarget(args *TargetArgs) error
- type App
- type Cobralike
- type EventArgs
- type LoggingSetup
- type OutputMode
- type Params
- type PluginVersionOutput
- type TargetArgs
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupportedOutputMode if user passed unsupported output mode. ErrUnsupportedOutputMode = errors.New("unsupported output mode") // ErrInvalidFormat if user pass an un-parsable format. ErrInvalidFormat = errors.New("invalid format") // ErrCantBuildEvent if event can't be built. ErrCantBuildEvent = errors.New("can't build event") // ErrCantMarshalEvent if event can't be marshalled to text. ErrCantMarshalEvent = errors.New("can't marshal event") )
var ( // ErrUseToFlagIsRequired will be raised if user hasn't used --to flag. ErrUseToFlagIsRequired = errors.New("use --to flag is required") // ErrInvalidURLFormat will be raised if given URL is invalid. ErrInvalidURLFormat = errors.New("invalid URL format") // ErrInvalidToFormat will be raised if given addressable doesn't have a valid // expected format. ErrInvalidToFormat = errors.New("--to flag has invalid format") )
Functions ¶
func DefaultLoggingSetup ¶ added in v0.43.0
DefaultLoggingSetup is the default logging setup.
func InitialContext ¶ added in v0.43.0
InitialContext returns the initial context object, so it could be set ahead of time the setup is called.
func SetupOutput ¶ added in v0.43.0
func SetupOutput(cbr Cobralike, loggingSetup LoggingSetup)
SetupOutput will set the output for all CLIs commonly.
func SimplifiedLoggingSetup ¶ added in v0.43.0
SimplifiedLoggingSetup is just a production logger to avoid creating additional log files.
TODO: Remove this after simplified logging is supported in knative.dev/client/pkg/output/logging package.
func ValidateTarget ¶
func ValidateTarget(args *TargetArgs) error
ValidateTarget will perform validation on App element of target.
Types ¶
type App ¶
App object.
func (*App) CreateWithArgs ¶
func (a *App) CreateWithArgs(args *EventArgs) (*cloudevents.Event, error)
CreateWithArgs will create an event by parsing given args.
func (*App) PresentWith ¶
func (a *App) PresentWith(e *cloudevents.Event, output OutputMode) (string, error)
PresentWith will present an event with specified output.
func (*App) Send ¶
func (a *App) Send(ctx context.Context, ce cloudevents.Event, tArgs TargetArgs, params *Params) error
Send will send CloudEvent to target.
type Cobralike ¶ added in v0.43.0
type Cobralike interface {
SetContext(ctx context.Context)
Context() context.Context
output.Printer
SetOut(out io.Writer)
OutOrStderr() io.Writer
SetErrPrefix(prefix string)
HasParent() bool
Parent() *cobra.Command
}
Cobralike represents a cobra.Command-like entity.
type LoggingSetup ¶ added in v0.43.0
LoggingSetup is a func that sets the logging into the context.
type OutputMode ¶
OutputMode is type of output to produce.
const ( HumanReadable OutputMode = iota JSON YAML )
OutputMode enumeration values.
type Params ¶ added in v0.43.0
type Params struct {
// OutputMode define the type of output commands should be producing.
OutputMode
// Verbose tells should commands display additional information about
// what's happening? Verbose information is printed on stderr.
Verbose bool
// Kubernetes related parameters.
k8s.Params
}
Params holds a general args for all commands.
type PluginVersionOutput ¶
type PluginVersionOutput struct {
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"`
Image string `json:"image" yaml:"image"`
}
PluginVersionOutput is a struct that is used to output project version in machine readable format.
type TargetArgs ¶
TargetArgs holds args specific for even sending.