cmd

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RootCmd is the root (and only) command of this service
	RootCmd = &cobra.Command{
		Use:              "oasisctl",
		Short:            "ArangoDB Oasis",
		Long:             "ArangoDB Oasis. The Managed Cloud for ArangoDB",
		Run:              ShowUsage,
		PersistentPreRun: rootCmdPersistentPreRun,
	}

	CLILog = zerolog.New(zerolog.ConsoleWriter{
		Out:     os.Stderr,
		NoColor: !supportsColor(),
	}).With().Timestamp().Logger()
	RootArgs struct {
		Token string

		Format format.Options
		// contains filtered or unexported fields
	}
)
View Source
var (
	// AcceptCmd is root for various `accept ...` commands
	AcceptCmd = &cobra.Command{
		Use:   "accept",
		Short: "Accept invites",
		Run:   ShowUsage,
	}
)
View Source
var (
	// AddCmd is root for various `add ...` commands
	AddCmd = &cobra.Command{
		Use:   "add",
		Short: "Add resources",
		Run:   ShowUsage,
	}
)
View Source
var (
	// BackupCmd is root for various `backup ...` commands
	BackupCmd = &cobra.Command{
		Use:   "backup",
		Short: "Backup commands",
		Run:   ShowUsage,
	}
)
View Source
var (
	// BackupListRootCmd is root for various `list backup ...` commands
	BackupListRootCmd = &cobra.Command{
		Use:   "backup",
		Short: "A list command for various backup resources",
		Run:   ShowUsage,
	}
)
View Source
var (
	// CloneCmd is root for various `clone ...` commands
	CloneCmd = &cobra.Command{
		Use:   "clone",
		Short: "Clone resources",
		Run:   ShowUsage,
	}
)
View Source
var (
	// CloneDeploymentCmd is root for various `clone deployment ...` commands
	CloneDeploymentCmd = &cobra.Command{
		Use:   "deployment",
		Short: "Clone deployment resources",
		Run:   ShowUsage,
	}
)
View Source
var (
	// CreateCmd is root for various `create ...` commands
	CreateCmd = &cobra.Command{
		Use:   "create",
		Short: "Create resources",
		Run:   ShowUsage,
	}
)
View Source
var (
	// DeleteCmd is root for various `delete ...` commands
	DeleteCmd = &cobra.Command{
		Use:   "delete",
		Short: "Delete resources",
		Run:   ShowUsage,
	}
)
View Source
var (
	// GenerateCmd is root for various `generate ...` commands
	GenerateCmd = &cobra.Command{
		Use:                "generate-docs",
		Short:              "Generate output",
		Run:                generateMarkdownRun,
		DisableAutoGenTag:  true,
		DisableSuggestions: true,
	}
)
View Source
var (
	// GetCmd is root for various `get ...` commands
	GetCmd = &cobra.Command{
		Use:   "get",
		Short: "Get information",
		Run:   ShowUsage,
	}
)
View Source
var (
	// GetServerCmd is based for other commands
	GetServerCmd = &cobra.Command{
		Use:   "server",
		Short: "Get server information",
		Run:   ShowUsage,
	}
)
View Source
var (
	// ListArangoDBCmd is based for other commands
	ListArangoDBCmd = &cobra.Command{
		Use:   "arangodb",
		Short: "List ArangoDB information",
		Run:   ShowUsage,
	}
)
View Source
var (
	// ListCmd is root for various `list ...` commands
	ListCmd = &cobra.Command{
		Use:   "list",
		Short: "List resources",
		Run:   ShowUsage,
	}
)
View Source
var (
	// ListEffectiveCmd is based for other commands
	ListEffectiveCmd = &cobra.Command{
		Use:   "effective",
		Short: "List effective information",
		Run:   ShowUsage,
	}
)
View Source
var (
	// ListServersCmd is based for other commands
	ListServersCmd = &cobra.Command{
		Use:   "servers",
		Short: "List servers information",
		Run:   ShowUsage,
	}
)
View Source
var (
	// LockCmd is root for various `lock ...` commands
	LockCmd = &cobra.Command{
		Use:   "lock",
		Short: "Lock resources",
		Run:   ShowUsage,
	}
)
View Source
var (
	// LoginCmd is used to login using an API key
	LoginCmd = &cobra.Command{
		Use: "login",
		Run: ShowUsage,
	}
)
View Source
var (
	// RejectCmd is root for various `reject ...` commands
	RejectCmd = &cobra.Command{
		Use:   "reject",
		Short: "Reject invites",
		Run:   ShowUsage,
	}
)
View Source
var (
	// RenewCmd is root for various `renew ...` commands
	RenewCmd = &cobra.Command{
		Use:   "renew",
		Short: "Renew keys & tokens",
		Run:   ShowUsage,
	}
)
View Source
var (
	// ResumeCmd is root for various `resume ...` commands
	ResumeCmd = &cobra.Command{
		Use:   "resume",
		Short: "Resume resources",
		Run:   ShowUsage,
	}
)
View Source
var (
	// RevokeCmd is root for various `revoke ...` commands
	RevokeCmd = &cobra.Command{
		Use:   "revoke",
		Short: "Revoke keys & tokens",
		Run:   ShowUsage,
	}
)
View Source
var (
	// UnlockCmd is root for various `unlock ...` commands
	UnlockCmd = &cobra.Command{
		Use:   "unlock",
		Short: "Unlock resources",
		Run:   ShowUsage,
	}
)
View Source
var (
	// UpdateCmd is root for various `update ...` commands
	UpdateCmd = &cobra.Command{
		Use:   "update",
		Short: "Update resources",
		Run:   ShowUsage,
	}
)
View Source
var (
	// WaitCmd is root for various `wait ...` commands
	WaitCmd = &cobra.Command{
		Use:   "wait",
		Short: "Wait for a status change",
		Run:   ShowUsage,
	}
)

Functions

func ContextWithToken

func ContextWithToken() context.Context

ContextWithToken returns a context with access token in it.

func DefaultCACertificate

func DefaultCACertificate() string

DefaultCACertificate returns the default value for a CA certificate identifier

func DefaultDeployment

func DefaultDeployment() string

DefaultDeployment returns the default value for a deployment identifier

func DefaultFormat

func DefaultFormat() string

DefaultFormat returns the default value for the output format

func DefaultGroup

func DefaultGroup() string

DefaultGroup returns the default value for a group identifier

func DefaultIPAllowlist added in v0.17.0

func DefaultIPAllowlist() string

DefaultIPAllowlist returns the default value for an IP allowlist identifier

func DefaultOrganization

func DefaultOrganization() string

DefaultOrganization returns the default value for an organization identifier

func DefaultOrganizationInvite

func DefaultOrganizationInvite() string

DefaultOrganizationInvite returns the default value for an organization-invite identifier

func DefaultPluginHandler added in v0.18.0

func DefaultPluginHandler() string

DefaultPluginHandler returns the default value for a URL

func DefaultProject

func DefaultProject() string

DefaultProject returns the default value for a project identifier

func DefaultProvider

func DefaultProvider() string

DefaultProvider returns the default value for a provider identifier

func DefaultRegion

func DefaultRegion() string

DefaultRegion returns the default value for a region identifier

func DefaultRole

func DefaultRole() string

DefaultRole returns the default value for a role identifier

func DefaultTermsAndConditions added in v0.17.0

func DefaultTermsAndConditions() string

DefaultTermsAndConditions returns the default value for a terms and conditions identifier

func DefaultURL

func DefaultURL() string

DefaultURL returns the default value for a URL

func ExecuteCommandOrPlugin added in v0.18.0

func ExecuteCommandOrPlugin(root *cobra.Command, pluginHandler PluginHandler, args []string)

ExecuteCommandOrPlugin tries to find a builtin command and execute it. If no such command it found, a plugin searched for and executed when applicable.

func InitCommand

func InitCommand(parent, cmd *cobra.Command, flagInit func(c *cobra.Command, f *flag.FlagSet)) *cobra.Command

InitCommand adds the given command to the given parent and called the flag initialization function.

func MustCheckNumberOfArgs

func MustCheckNumberOfArgs(args []string, expectedNumberOfArgs int)

MustCheckNumberOfArgs compares the number of arguments with the expected number of arguments. If there is a difference a fatal error is raised.

func MustDialAPI

func MustDialAPI(setKeepalive ...bool) *grpc.ClientConn

MustDialAPI dials the ArangoDB Oasis API

func OptOption

func OptOption(key, value string, args []string, argIndex int) (string, int)

OptOption returns given value if not empty. Returns: option-value, number-of-args-used(0|argIndex+1)

func ReqOption

func ReqOption(key, value string, args []string, argIndex int) (string, int)

ReqOption returns given value if not empty. Fails with clear error message when not set. Returns: option-value, number-of-args-used(0|argIndex+1)

func SetVersion

func SetVersion(releaseVersion string)

SetVersion must be called at bootstrap to pass the current build version

func ShowUsage

func ShowUsage(cmd *cobra.Command, args []string)

ShowUsage shows usage of the given command on stdout.

Types

type PluginHandler added in v0.18.0

type PluginHandler interface {
	// Lookup will iterate over a list of given prefixes
	// in order to recognize valid plugin filenames.
	// Returns: the first filepath to match a prefix together with true
	// or false if no match is found.
	Lookup(filename string) (string, bool)
	// Execute receives an executable's filepath, a slice
	// of arguments, and a slice of environment variables
	// to relay to the executable.
	Execute(executablePath string, cmdArgs, environment []string) error
}

PluginHandler is capable of parsing command line arguments and performing executable filename lookups to search for valid plugin files, and execute found plugins.

func NewDefaultPluginHandler added in v0.18.0

func NewDefaultPluginHandler(validPrefixes ...string) PluginHandler

NewDefaultPluginHandler instantiates the DefaultPluginHandler with a list of given filename prefixes used to identify valid plugin filenames.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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