app

package
v0.0.0-...-ae01f8c Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 57 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvVarDebug    = "SWCTL_DEBUG"
	EnvVarLogLevel = "SWCTL_LOGLEVEL"
)
View Source
const (
	MissingExternalToolMessageKey = "MissingExternalTool"
)
View Source
const (
	NonInputVariablePrefix = "noninput_" // used for go templating variables that are not Entity input variables, i.e. temporal range loop variable
)

Variables

This section is empty.

Functions

func AllocatedHugePages

func AllocatedHugePages(cli Cli) (int, error)

func GetSudoPrefix

func GetSudoPrefix(cli Cli) string

func InitGlobalOptions

func InitGlobalOptions(cli Cli, opts *GlobalOptions)

func InstallAgentCtl

func InstallAgentCtl(cli Cli, agentctlCommitVersion string) error

func InstallDocker

func InstallDocker(cli Cli, dockerVersion string) error

func InstallVPPProbe

func InstallVPPProbe(cli Cli, vppProbeTagVersion string) error

func IsAgentctlAvailable

func IsAgentctlAvailable(agentctlCommitVersion string, logger io.Writer) (bool, error)

func IsDockerAvailable

func IsDockerAvailable(cli Cli) (bool, error)

func IsVPPProbeAvailable

func IsVPPProbeAvailable(vppProbeTagVersion string, logger io.Writer) (bool, error)

func NewConfigCmd

func NewConfigCmd(cli Cli) *cobra.Command

func NewDependencyCmd

func NewDependencyCmd(cli Cli) *cobra.Command

func NewDeploymentCmd

func NewDeploymentCmd(cli Cli) *cobra.Command

func NewManageCmd

func NewManageCmd(cli Cli) *cobra.Command

func NewRootCmd

func NewRootCmd(cli Cli) *cobra.Command

NewRootCmd returns new root command

func NewStatusCmd

func NewStatusCmd(cli Cli) *cobra.Command

func NewSupportCmd

func NewSupportCmd(cli Cli) *cobra.Command

func NewTraceCmd

func NewTraceCmd(cli Cli) *cobra.Command

func NewVersionCmd

func NewVersionCmd() *cobra.Command

func ResizeHugePages

func ResizeHugePages(cli Cli, size uint) error

Types

type CLI

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

CLI implements Cli interface.

func NewCli

func NewCli(appName string, opt ...CliOption) (*CLI, error)

NewCli returns a new CLI instance. It accepts CliOption for customization.

func (*CLI) AppName

func (cli *CLI) AppName() string

func (*CLI) Apply

func (cli *CLI) Apply(opt ...CliOption) error

func (*CLI) Client

func (cli *CLI) Client() client.API

func (*CLI) Entities

func (cli *CLI) Entities() []Entity

func (*CLI) Err

func (cli *CLI) Err() io.Writer

func (*CLI) Exec

func (cli *CLI) Exec(cmd string, args []string, liveOutput bool) (string, string, error)

func (*CLI) GlobalOptions

func (cli *CLI) GlobalOptions() *GlobalOptions

func (*CLI) In

func (cli *CLI) In() *streams.In

func (*CLI) Initialize

func (cli *CLI) Initialize(opts *GlobalOptions) (err error)

func (*CLI) Out

func (cli *CLI) Out() *streams.Out

type Cli

type Cli interface {
	Initialize(opts *GlobalOptions) error
	Apply(...CliOption) error
	Client() client.API
	Entities() []Entity
	GlobalOptions() *GlobalOptions
	Exec(cmd string, args []string, liveOutput bool) (stdout string, stderr string, err error)
	AppName() string

	Out() *streams.Out
	Err() io.Writer
	In() *streams.In
}

Cli is a client API for CLI application.

type CliOption

type CliOption func(cli *CLI) error

CliOption is a function that customizes CLI.

func WithClient

func WithClient(c client.API) CliOption

WithClient sets an APIClient.

func WithCombinedStreams

func WithCombinedStreams(combined io.Writer) CliOption

WithCombinedStreams uses the same stream for the output and error streams.

func WithCustomizations

func WithCustomizations(customizations map[string]interface{}) CliOption

WithCustomizations sets the generic customizations of the CLI.

func WithErrorStream

func WithErrorStream(err io.Writer) CliOption

WithErrorStream sets a cli error stream.

func WithInputStream

func WithInputStream(in io.ReadCloser) CliOption

WithInputStream sets a cli input stream.

func WithOutputStream

func WithOutputStream(out io.Writer) CliOption

WithOutputStream sets a cli output stream.

func WithStandardStreams

func WithStandardStreams() CliOption

WithStandardStreams sets a cli in, out and err streams with the standard streams.

type ConfigCmdOptions

type ConfigCmdOptions struct {
	ShowInternal bool
	Args         []string
}

func (*ConfigCmdOptions) InstallFlags

func (opts *ConfigCmdOptions) InstallFlags(flagset *pflag.FlagSet)

type Entity

type Entity struct {
	Origin string `json:"-"`

	Name        string      `json:"name"`
	Plural      string      `json:"plural"`
	Description string      `json:"description"`
	Vars        []EntityVar `json:"vars"`
	Config      string      `json:"config"`
	Single      bool        `json:"single"`
	Files       []ExtraFile `json:"files"`
}

Entity is a blueprint for an object defined with a config template of related parts.

func (Entity) GetName

func (e Entity) GetName() string

func (Entity) GetPlural

func (e Entity) GetPlural() string

func (Entity) GetVars

func (e Entity) GetVars() []EntityVar

type EntityFile

type EntityFile struct {
	Entities []Entity `json:"entities"`
}

EntityFile is a file containing entities loaded during initialization.

type EntityVar

type EntityVar struct {
	Index int `json:"-"`

	Name        string `json:"name"`
	Description string `json:"description"`
	Value       string `json:"default"`
	Type        string `json:"type"`
	When        string `json:"when"`
}

EntityVar is a variable of an entity defined with a template to render its value.

type ExecResult

type ExecResult struct {
	Took   time.Duration
	Status int
	Stdout string
	Stderr string
}

type ExtraFile

type ExtraFile struct {
	Name    string `json:"name"`
	Content string `json:"content"`
	When    string `json:"when"`
}

type GitHubRelease

type GitHubRelease struct {
	TagName string `json:"tag_name"`
	Assets  []struct {
		Name               string `json:"name"`
		BrowserDownloadUrl string `json:"browser_download_url"`
	} `json:"assets"`
}

type GlobalOptions

type GlobalOptions struct {
	Debug    bool
	LogLevel string
	Color    string

	ComposeFiles       []string
	EntityFiles        []string
	EmbeddedEntityByte []byte
}

func (*GlobalOptions) InstallFlags

func (glob *GlobalOptions) InstallFlags(flags *pflag.FlagSet)

type ManageOptions

type ManageOptions struct {
	Format      string
	Target      string
	Count       uint
	Force       bool
	IdOffset    int
	DryRun      bool
	Vars        map[string]string
	ShowConfig  bool
	Interactive bool
	OutputFile  string
}

func (*ManageOptions) InstallFlags

func (opts *ManageOptions) InstallFlags(flagset *pflag.FlagSet)

type NetworkInterface

type NetworkInterface struct {
	Name        string
	Pci         string
	Description string
	SwName      string
	Module      string
	// Nil Driver means that device is unbounded and can be used by vpp which choose driver
	Driver string
}

func DumpDevices

func DumpDevices(cli Cli) ([]NetworkInterface, error)

type StatusOptions

type StatusOptions struct {
	Format         string
	ShowInterfaces bool
}

func (*StatusOptions) InstallFlags

func (opts *StatusOptions) InstallFlags(flagset *pflag.FlagSet)

type SupportCmdOptions

type SupportCmdOptions struct {
	OutputDirectory string
}

type TraceCmdOptions

type TraceCmdOptions struct {
	Args []string
}

Jump to

Keyboard shortcuts

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