runner

package
v0.0.0-...-0692dec Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: UPL-1.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ArgURL is the Operator URL status command argument.
	ArgURL = "url"
	// ArgTimeout is the timeout status command argument.
	ArgTimeout = "timeout"
	// ArgInterval is the retry interval status command argument.
	ArgInterval = "interval"
	// ArgSkipInsecure is the skip insecure https checks status command argument.
	ArgSkipInsecure = "insecure-skip-tls-verify"
	// ArgCertAuthority is the location of the CA file status command argument.
	ArgCertAuthority = "certificate-authority"
	// ArgCert is the location of the cert file status command argument.
	ArgCert = "client-certificate"
	// ArgKey is the location of the key file status command argument.
	ArgKey = "client-key"
)
View Source
const (
	// ArgCommand is an additional command to run after initialisation
	ArgCommand = "cmd"
	// ArgRootDir is the root directory to initialise and directories files in
	ArgRootDir = "root"
	// ArgUtilsDir is the utils directory name
	ArgUtilsDir = "utils"
	// ArgPersistenceDir is root the persistence directory name
	ArgPersistenceDir = "persistence"
	// ArgSnapshotsDir is root the snapshots directory name
	ArgSnapshotsDir = "snapshots"
)
View Source
const (
	// CommandNode is the argument to launch a Node label reader.
	CommandNode = "node"

	// ArgNode is the name of the node to query
	ArgNode = "node-name"
	// ArgDir is the directory to write files to
	ArgDir = "dir"
	// ArkKubeConfig is the location of the k8s config
	ArkKubeConfig = "kubeconfig"
)
View Source
const (
	// CommandStatus is the argument to execute a deployment status query.
	CommandStatus = "status"

	// ArgOperatorURL is the Operator URL status command argument.
	ArgOperatorURL = "operator-url"
	// ArgNamespace is the Coherence resource namespace status command argument.
	ArgNamespace = "namespace"
	// ArgName is the Coherence resource name status command argument.
	ArgName = "name"
	// ArgCondition is the required condition status command argument.
	ArgCondition = "condition"
)
View Source
const (
	// DefaultMain is an indicator to run the default main class.
	DefaultMain = "$DEFAULT$"
	// HelidonMain is the default Helidon main class name.
	HelidonMain = "io.helidon.microprofile.server.Main"
	// ServerMain is the default server main class name.
	ServerMain = "com.oracle.coherence.k8s.Main"
	// SpringBootMain is the default Spring Boot main class name.
	SpringBootMain = "org.springframework.boot.loader.PropertiesLauncher"

	// AppTypeNone is the argument to specify no application type.
	AppTypeNone = ""
	// AppTypeJava is the argument to specify a Java application.
	AppTypeJava = "java"
	// AppTypeCoherence is the argument to specify a Coherence application.
	AppTypeCoherence = "coherence"
	// AppTypeHelidon is the argument to specify a Helidon application.
	AppTypeHelidon = "helidon"
	// AppTypeSpring is the argument to specify a Spring application.
	AppTypeSpring = "spring"
)
View Source
const (
	// CommandConsole is the argument to launch a Coherence console.
	CommandConsole = "console"
)
View Source
const (
	// CommandMBeanServer is the argument to launch a MBean server.
	CommandMBeanServer = "mbeanserver"
)
View Source
const (
	// CommandOperator is the argument to launch the Operator manager.
	CommandOperator = "operator"
)
View Source
const (
	// CommandQueryPlus is the argument to launch a QueryPlus console.
	CommandQueryPlus = "queryplus"
)
View Source
const (
	// CommandReady is the argument to execute ready check.
	CommandReady = "ready"
)
View Source
const (
	// CommandServer is the argument to launch a server.
	CommandServer = "server"
)

Variables

This section is empty.

Functions

func NewRootCommand

func NewRootCommand(env map[string]string) (*cobra.Command, *viper.Viper)

NewRootCommand builds the root cobra command that handles our command line tool.

Types

type EnvFunction

type EnvFunction func(string) string

EnvFunction is a function that returns an environment variable for a given name.

type Execution

type Execution struct {
	Cmd   *cobra.Command
	App   string
	OsCmd *exec.Cmd
	V     *viper.Viper
}

Execution is a holder of details of a command execution

func Execute

func Execute() (Execution, error)

Execute runs the runner with a given environment.

func ExecuteWithArgs

func ExecuteWithArgs(env map[string]string, args []string) (Execution, error)

ExecuteWithArgs runs the runner with a given environment and argument overrides.

type MaybeRunFunction

type MaybeRunFunction func(*RunDetails, *cobra.Command) (bool, error)

MaybeRunFunction is a function to maybe run a command depending on the return bool

type RunDetails

type RunDetails struct {
	Command       string
	CoherenceHome string
	JavaHome      string
	UtilsDir      string
	Dir           string
	GetSite       bool
	AppType       string
	Classpath     string
	Args          []string
	MainClass     string
	MainArgs      []string
	BuildPacks    *bool
	// contains filtered or unexported fields
}

RunDetails contains the information to run an application.

func NewRunDetails

func NewRunDetails(v *viper.Viper) *RunDetails

func (*RunDetails) Expand

func (in *RunDetails) Expand(s string, mapping func(string) string) string

Expand replaces ${var} or $(var) or $var in the string based on the mapping function. For example, os.ExpandEnv(s) is equivalent to os.Expand(s, os.Getenv).

func (*RunDetails) ExpandEnv

func (in *RunDetails) ExpandEnv(s string) string

ExpandEnv replaces ${var} or $(var) or $var in the string according to the values of the current environment variables. References to undefined variables are replaced by the empty string.

func (*RunDetails) Getenv

func (in *RunDetails) Getenv(name string) string

Getenv returns the value for the specified environment variable, or empty string if not set.

type RunFunction

type RunFunction func(*RunDetails, *cobra.Command)

RunFunction is a function to run a command

Jump to

Keyboard shortcuts

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