cli

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PrintBluef func(format string, a ...interface{})

PrintBluef prints in blue.

View Source
var PrintGreenf func(format string, a ...interface{})

PrintGreenf prints in green.

View Source
var PrintRedf func(format string, a ...interface{})

PrintRedf prints in red.

View Source
var PrintYellowf func(format string, a ...interface{})

PrintYellowf prints in yellow.

Functions

func AskForConfirmation

func AskForConfirmation(s string) bool

AskForConfirmation asks the user for confirmation. A user must type in "yes" or "no" and then press enter. It has fuzzy matching, so "y", "Y", "yes", "YES", and "Yes" all count as confirmations. If the input is not recognized, it will ask again. The function does not return until it gets a valid response from the user.

func DebugMsg

func DebugMsg(messages ...string)

DebugMsg prints given message when debug mode is on.

func EditEnvFile

func EditEnvFile(content string) (string, error)

EditEnvFile opens content in EDITOR, and returns saved content.

func ExecOcCmd

func ExecOcCmd(args []string, namespace string, selector string) *exec.Cmd

ExecOcCmd executes "oc" with given namespace and selector applied.

func ExecPlainOcCmd

func ExecPlainOcCmd(args []string) *exec.Cmd

ExecPlainOcCmd executes "oc" with given arguments applied.

func RunCmd

func RunCmd(cmd *exec.Cmd) (outBytes, errBytes []byte, err error)

RunCmd runs the given command and returns the result

func VerboseMsg

func VerboseMsg(messages ...string)

VerboseMsg prints given message when verbose mode is on. Verbose mode is implicitly turned on when debug mode is on.

Types

type ClientProcessorExporter

type ClientProcessorExporter interface {
	OcClientProcessor
	OcClientExporter
}

ClientProcessorExporter allows to process templates and export resources.

type CompareOptions

type CompareOptions struct {
	*GlobalOptions
	*NamespaceOptions
	ContextDir              string
	Selector                string
	Exclude                 string
	TemplateDir             string
	ParamDir                string
	PrivateKey              string
	Passphrase              string
	Labels                  string
	Params                  []string
	ParamFiles              []string
	Diff                    string
	IgnorePaths             []string
	IgnoreUnknownParameters bool
	UpsertOnly              bool
	AllowRecreate           bool
	RevealSecrets           bool
	Resource                string
}

CompareOptions are context-wide.

func NewCompareOptions

func NewCompareOptions(
	globalOptions *GlobalOptions,
	contextDir string,
	namespaceFlag string,
	selectorFlag string,
	excludeFlag string,
	templateDirFlag string,
	paramDirFlag string,
	publicKeyDirFlag string,
	privateKeyFlag string,
	passphraseFlag string,
	labelsFlag string,
	paramFlag []string,
	paramFileFlag []string,
	diffFlag string,
	ignorePathFlag []string,
	ignoreUnknownParametersFlag bool,
	upsertOnlyFlag bool,
	allowRecreateFlag bool,
	revealSecretsFlag bool,
	resourceArg string) (*CompareOptions, error)

NewCompareOptions returns new options for the status/update command based on file/flags.

func (*CompareOptions) ResolvedParamDir

func (o *CompareOptions) ResolvedParamDir() string

ResolvedParamDir returns param dir prefixed by the context dir.

func (*CompareOptions) ResolvedTemplateDir

func (o *CompareOptions) ResolvedTemplateDir() string

ResolvedTemplateDir returns template dir prefixed by the context dir.

type ExportOptions

type ExportOptions struct {
	*GlobalOptions
	*NamespaceOptions
	ContextDir      string
	Selector        string
	Exclude         string
	TemplateDir     string
	ParamDir        string
	WithAnnotations bool
	Resource        string
}

ExportOptions are context-wide.

func NewExportOptions

func NewExportOptions(
	globalOptions *GlobalOptions,
	contextDir string,
	namespaceFlag string,
	selectorFlag string,
	excludeFlag string,
	templateDirFlag string,
	paramDirFlag string,
	withAnnotationsFlag bool,
	resourceArg string) (*ExportOptions, error)

NewExportOptions returns new options for the export command based on file/flags.

type GlobalOptions

type GlobalOptions struct {
	Verbose        bool
	Debug          bool
	NonInteractive bool
	OcBinary       string
	File           string
	ContextDirs    []string
	Force          bool
	IsLoggedIn     bool
}

GlobalOptions are app-wide that cannot be modified within a context.

func NewGlobalOptions

func NewGlobalOptions(
	clusterRequired bool,
	fileFlag string,
	verboseFlag bool,
	debugFlag bool,
	nonInteractiveFlag bool,
	ocBinaryFlag string,
	contextDirFlag []string,
	forceFlag bool) (*GlobalOptions, error)

NewGlobalOptions returns new global options based on file/flags. Those options are shared across all commands.

type NamespaceOptions

type NamespaceOptions struct {
	Namespace         string
	CheckedNamespaces []string
}

NamespaceOptions are context-wide.

type OcClient

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

OcClient is a wrapper around the "oc" binary (client).

func NewOcClient

func NewOcClient(namespace string) *OcClient

NewOcClient creates a new ocClient.

func (*OcClient) CheckLoggedIn

func (c *OcClient) CheckLoggedIn() (bool, error)

CheckLoggedIn returns true if the given project (namespace) exists.

func (*OcClient) CheckProjectExists

func (c *OcClient) CheckProjectExists(p string) (bool, error)

CheckProjectExists returns true if the given project (namespace) exists.

func (*OcClient) Create

func (c *OcClient) Create(config string, selector string) ([]byte, error)

Create creates given resource configuration.

func (*OcClient) CurrentProject

func (c *OcClient) CurrentProject() (string, error)

CurrentProject returns the currently active project name (namespace).

func (*OcClient) Delete

func (c *OcClient) Delete(kind string, name string) ([]byte, error)

Delete deletes given resource.

func (*OcClient) Export

func (c *OcClient) Export(target string, label string) ([]byte, error)

Export exports resources from OpenShift as a template.

func (*OcClient) Patch

func (c *OcClient) Patch(target string, patches string) ([]byte, error)

Patch applies the given patch on the target.

func (*OcClient) Process

func (c *OcClient) Process(args []string) ([]byte, []byte, error)

Process processes an OpenShift template. The API is just a stop-gap solution and will be better in the future.

func (*OcClient) Version

func (c *OcClient) Version() ([]byte, []byte, error)

Version returns the output of "ov versiopn".

type OcClientCreator

type OcClientCreator interface {
	Create(config string, selector string) ([]byte, error)
}

OcClientCreator allows to create a resource.

type OcClientDeleter

type OcClientDeleter interface {
	Delete(kind string, name string) ([]byte, error)
}

OcClientDeleter allows to delete a resource.

type OcClientExporter

type OcClientExporter interface {
	Export(target string, label string) ([]byte, error)
}

OcClientExporter allows to export resources.

type OcClientPatcher

type OcClientPatcher interface {
	Patch(target string, patches string) ([]byte, error)
}

OcClientPatcher allows to patch a resource.

type OcClientProcessor

type OcClientProcessor interface {
	Process(args []string) ([]byte, []byte, error)
}

OcClientProcessor is a stop-gap solution only ... should have a better API.

type OcClientVersioner

type OcClientVersioner interface {
	Version() ([]byte, []byte, error)
}

OcClientVersioner allows to retrieve the OpenShift version..

type SecretsOptions

type SecretsOptions struct {
	*GlobalOptions
	ContextDir   string
	ParamDir     string
	PublicKeyDir string
	PrivateKey   string
	Passphrase   string
}

SecretsOptions are context-wide.

func NewSecretsOptions

func NewSecretsOptions(
	globalOptions *GlobalOptions,
	paramDirFlag string,
	publicKeyDirFlag string,
	privateKeyFlag string,
	passphraseFlag string) (*SecretsOptions, error)

NewSecretsOptions returns new options for the secrets subcommand based on file/flags.

func (*SecretsOptions) ResolvedParamDir

func (o *SecretsOptions) ResolvedParamDir() string

ResolvedParamDir returns param dir prefixed by the context dir.

Jump to

Keyboard shortcuts

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