cmd

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CommandName is the expected entrypoint of the root command.
	CommandName = "furiko"
)

Variables

View Source
var (
	DisableExample = PrepareExample(`
# Disable scheduling for the JobConfig.
{{.CommandName}} disable send-weekly-report`)
)
View Source
var (
	EnableExample = PrepareExample(`
# Enable scheduling for the JobConfig.
{{.CommandName}} enable send-weekly-report`)
)
View Source
var (
	GetJobConfigExample = PrepareExample(`
# Get a single JobConfig in the current namespace.
{{.CommandName}} get jobconfig daily-send-email

# Get multiple JobConfigs by name in the current namespace.
{{.CommandName}} get jobconfig daily-send-email weekly-report-email

# Get a single JobConfig in JSON format.
{{.CommandName}} get jobconfig daily-send-email -o json`)
)
View Source
var (
	GetJobExample = PrepareExample(`
# Get a single Job in the current namespace.
{{.CommandName}} get job job-sample-l6dc6

# Get multiple Jobs by name in the current namespace.
{{.CommandName}} get job job-sample-l6dc6 job-sample-cdwqb

# Get a single Job in JSON format.
{{.CommandName}} get job job-sample-l6dc6 -o json`)
)
View Source
var (
	KillExample = PrepareExample(`
# Request to kill an ongoing Job.
{{.CommandName}} kill job-sample-1653825000

# Request for an ongoing Job to be killed 60 seconds from now.
{{.CommandName}} kill job-sample-1653825000 -p 60s

# Request for an ongoing Job to be killed at a specific time in the future.
{{.CommandName}} kill job-sample-1653825000 -t 2023-01-01T00:00:00Z`)
)
View Source
var (
	ListJobConfigExample = PrepareExample(`
# List all JobConfigs in current namespace.
{{.CommandName}} list jobconfig

# List all JobConfigs in JSON format.
{{.CommandName}} list jobconfig -o json`)
)
View Source
var (
	ListJobExample = PrepareExample(`
# List all Jobs in current namespace.
{{.CommandName}} list job

# List all Jobs in current namespace belonging to JobConfig "daily-send-email".
{{.CommandName}} list job --for daily-send-email

# List all Jobs in JSON format.
{{.CommandName}} list job -o json`)
)
View Source
var (
	RunExample = PrepareExample(`
# Start a new Job from an existing JobConfig.
{{.CommandName}} run daily-send-email

# Start a new Job only after the specified time.
{{.CommandName}} run daily-send-email --at 2021-01-01T00:00:00+08:00

# Start a new Job, and use all default options.
{{.CommandName}} run daily-send-email --use-default-options`)
)

Functions

func GetDynamicConfig

func GetDynamicConfig(ctx context.Context, cmd *cobra.Command, name configv1alpha1.ConfigName, out interface{}) error

GetDynamicConfig loads the dynamic config by name and unmarshals to out. TODO(irvinlim): If the current user does not have permissions to read the

ConfigMap, or the ConfigMap uses a different name/namespace, we should
gracefully handle this case.

func GetNamespace

func GetNamespace(cmd *cobra.Command) (string, error)

GetNamespace returns the namespace to use depending on what was defined in the flags.

func GetOutputFormat

func GetOutputFormat(cmd *cobra.Command) (printer.OutputFormat, error)

GetOutputFormat returns the output format as parsed by the flag.

func NewContext

func NewContext(_ *cobra.Command) (controllercontext.Context, error)

NewContext returns a common context from the cobra command.

func NewDisableCommand added in v0.2.0

func NewDisableCommand(streams *streams.Streams) *cobra.Command

func NewEnableCommand added in v0.2.0

func NewEnableCommand(streams *streams.Streams) *cobra.Command

func NewGetCommand

func NewGetCommand(streams *streams.Streams) *cobra.Command

func NewGetJobCommand

func NewGetJobCommand(streams *streams.Streams) *cobra.Command

func NewGetJobConfigCommand

func NewGetJobConfigCommand(streams *streams.Streams) *cobra.Command

func NewKillCommand added in v0.2.0

func NewKillCommand(streams *streams.Streams) *cobra.Command

func NewListCommand

func NewListCommand(streams *streams.Streams) *cobra.Command

func NewListJobCommand

func NewListJobCommand(streams *streams.Streams) *cobra.Command

func NewListJobConfigCommand

func NewListJobConfigCommand(streams *streams.Streams) *cobra.Command

func NewRootCommand

func NewRootCommand(streams *streams.Streams) *cobra.Command

NewRootCommand returns a new root command for the command-line utility.

func NewRunCommand

func NewRunCommand(streams *streams.Streams) *cobra.Command

func PrepareExample

func PrepareExample(example string) string

PrepareExample replaces the root command name and indents all lines.

func PrerunWithKubeconfig

func PrerunWithKubeconfig(cmd *cobra.Command, _ []string) error

PrerunWithKubeconfig is a pre-run function that will set up the common context when kubeconfig is needed. TODO(irvinlim): We currently reuse controllercontext, but most of it is unusable for CLI interfaces.

We should create a new common context as needed.

func SetCtrlContext

func SetCtrlContext(cc controllercontext.Context)

SetCtrlContext explicitly sets the common context.

func ToRunE

func ToRunE(ctx context.Context, executor Runner) func(cmd *cobra.Command, args []string) error

ToRunE converts a Runner with a context to a RunE func.

Types

type DisableCommand added in v0.2.0

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

func (*DisableCommand) Run added in v0.2.0

func (c *DisableCommand) Run(cmd *cobra.Command, args []string) error

type EnableCommand added in v0.2.0

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

func (*EnableCommand) Run added in v0.2.0

func (c *EnableCommand) Run(cmd *cobra.Command, args []string) error

type GetJobCommand

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

func (*GetJobCommand) PrintJobs

func (c *GetJobCommand) PrintJobs(output printer.OutputFormat, jobs []*execution.Job) error

func (*GetJobCommand) Run

func (c *GetJobCommand) Run(cmd *cobra.Command, args []string) error

type GetJobConfigCommand

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

func (*GetJobConfigCommand) PrintJobConfigs

func (c *GetJobConfigCommand) PrintJobConfigs(
	ctx context.Context,
	cmd *cobra.Command,
	output printer.OutputFormat,
	jobConfigs []*execution.JobConfig,
) error

func (*GetJobConfigCommand) Run

func (c *GetJobConfigCommand) Run(cmd *cobra.Command, args []string) error

type KillCommand added in v0.2.0

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

func (*KillCommand) Run added in v0.2.0

func (c *KillCommand) Run(cmd *cobra.Command, args []string) error

type ListJobCommand

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

func (*ListJobCommand) PrintJobs

func (c *ListJobCommand) PrintJobs(output printer.OutputFormat, jobList *execution.JobList) error

func (*ListJobCommand) Run

func (c *ListJobCommand) Run(cmd *cobra.Command, args []string) error

type ListJobConfigCommand

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

func (*ListJobConfigCommand) PrintJobConfigs

func (c *ListJobConfigCommand) PrintJobConfigs(
	output printer.OutputFormat,
	jobConfigList *execution.JobConfigList,
) error

func (*ListJobConfigCommand) Run

func (c *ListJobConfigCommand) Run(cmd *cobra.Command, args []string) error

type RootCommand

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

func (*RootCommand) PersistentPreRunE

func (c *RootCommand) PersistentPreRunE(cmd *cobra.Command, args []string) error

type RunCommand

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

func (*RunCommand) Run

func (c *RunCommand) Run(cmd *cobra.Command, args []string) error

type Runner

type Runner interface {
	Run(ctx context.Context, cmd *cobra.Command, args []string) error
}

Runner knows how to run a command.

Jump to

Keyboard shortcuts

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