cli

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMissingOrgID = fmt.Errorf(requiredF, flag.OrgID)

Functions

func CmdValidator added in v1.5.0

func CmdValidator(t *testing.T, subject *cobra.Command, nSubCommands int, flags []string)

CmdValidator helps validate a cobra.Command, verifying the number of sub commands and the flags that are being defined for it

func DeploymentStatus added in v1.0.0

func DeploymentStatus(baseURL, projectID string) string

func GenerateAliases added in v1.4.0

func GenerateAliases(use string, extra ...string) []string

GenerateAliases return aliases for use such that they are: a version all lower case, a version with dashes, a singular versions with the same rules.

Types

type DeleteOpts added in v1.0.0

type DeleteOpts struct {
	Entry   string
	Confirm bool
	// contains filtered or unexported fields
}

DeleteOpts options required when deleting a resource. A command can compose this struct and then safely rely on the methods Prompt, or Delete to manage the interactions with the user

func NewDeleteOpts added in v1.0.0

func NewDeleteOpts(successMsg, failMsg string) *DeleteOpts

func (*DeleteOpts) Delete added in v1.0.0

func (opts *DeleteOpts) Delete(d interface{}, a ...string) error

Delete deletes a resource not associated to a project, it expects a callback that should perform the deletion from the store.

func (*DeleteOpts) FailMessage added in v1.0.0

func (opts *DeleteOpts) FailMessage() string

FailMessage gets the set fail message or the default value

func (*DeleteOpts) Prompt added in v1.0.0

func (opts *DeleteOpts) Prompt() error

Prompt confirms that the resource should be deleted

func (*DeleteOpts) SuccessMessage added in v1.0.0

func (opts *DeleteOpts) SuccessMessage() string

SuccessMessage gets the set success message or the default value

type DownloaderOpts added in v1.0.0

type DownloaderOpts struct {
	Out   string
	Force bool
	Fs    afero.Fs
}

DownloaderOpts options required when deleting a resource. A command can compose this struct and then safely rely on the methods Prompt, or Delete to manage the interactions with the user

func (*DownloaderOpts) NewWriteCloser added in v1.0.0

func (opts *DownloaderOpts) NewWriteCloser() (io.WriteCloser, error)

NewWriteCloser creates a new file, if Force is false then don't allow to overwrite the file

func (*DownloaderOpts) OnError added in v1.0.0

func (opts *DownloaderOpts) OnError(f io.Closer) error

type GlobalOpts added in v1.0.0

type GlobalOpts struct {
	OrgID     string
	ProjectID string
}

func (*GlobalOpts) ConfigOrgID added in v1.0.0

func (opts *GlobalOpts) ConfigOrgID() string

ConfigOrgID returns the organization id. If the id is empty, it caches it after querying config.

func (*GlobalOpts) ConfigProjectID added in v1.0.0

func (opts *GlobalOpts) ConfigProjectID() string

ConfigProjectID returns the project id. If the id is empty, it caches it after querying config.

func (*GlobalOpts) PreRunE added in v1.0.0

func (opts *GlobalOpts) PreRunE(cbs ...cmdOpt) error

PreRunE is a function to call before running the command, this will call any additional function pass as a callback

func (*GlobalOpts) ValidateOrgID added in v1.8.0

func (opts *GlobalOpts) ValidateOrgID() error

ValidateOrgID validates orgID

func (*GlobalOpts) ValidateProjectID added in v1.8.0

func (opts *GlobalOpts) ValidateProjectID() error

ValidateProjectID validates projectID

type ListOpts added in v1.0.0

type ListOpts struct {
	PageNum      int
	ItemsPerPage int
}

func (*ListOpts) NewListOptions added in v1.0.0

func (opts *ListOpts) NewListOptions() *mongodbatlas.ListOptions

type MetricsOpts added in v1.0.0

type MetricsOpts struct {
	ListOpts
	Granularity     string
	Period          string
	Start           string
	End             string
	MeasurementType []string
}

func (*MetricsOpts) NewProcessMetricsListOptions added in v1.0.0

func (opts *MetricsOpts) NewProcessMetricsListOptions() *atlas.ProcessMeasurementListOptions

type OutputOpts added in v1.4.1

type OutputOpts struct {
	Template  string
	OutWriter io.Writer
	Output    string
}

func (*OutputOpts) ConfigOutput added in v1.4.1

func (opts *OutputOpts) ConfigOutput() string

ConfigOutput returns the output format. If the format is empty, it caches it after querying config.

func (*OutputOpts) ConfigWriter added in v1.4.1

func (opts *OutputOpts) ConfigWriter() io.Writer

ConfigWriter returns the io.Writer. If the writer is nil, it defaults to os.Stdout and caches it.

func (*OutputOpts) InitOutput added in v1.4.1

func (opts *OutputOpts) InitOutput(w io.Writer, t string) func() error

InitOutput allow to init the OutputOpts in a functional way

func (*OutputOpts) IsCygwinTerminal added in v1.4.1

func (opts *OutputOpts) IsCygwinTerminal() bool

IsCygwinTerminal returns true is the current file descriptor is cygwin

func (*OutputOpts) IsTerminal added in v1.4.1

func (opts *OutputOpts) IsTerminal() bool

IsTerminal returns true is the current file descriptor is TTY kind of terminal

func (*OutputOpts) Print added in v1.4.1

func (opts *OutputOpts) Print(v interface{}) error

Print will evaluate the defined format and try to parse it accordingly outputting to the set writer

type PerformanceAdvisorOpts added in v1.6.0

type PerformanceAdvisorOpts struct {
	ProcessName string
	HostID      string
}

func (*PerformanceAdvisorOpts) Host added in v1.6.0

func (opts *PerformanceAdvisorOpts) Host() (string, error)

Host returns the correct processName or the hostId in accordance with the service

func (*PerformanceAdvisorOpts) MarkRequiredFlagsByService added in v1.6.0

func (opts *PerformanceAdvisorOpts) MarkRequiredFlagsByService(cmd *cobra.Command) func() error

MarkRequiredFlagsByService marks processName or hostId as required in accordance with the service

Atlas: processName is required

OM/CM: hostId is required

type WatchOpts added in v1.4.1

type WatchOpts struct {
	OutputOpts
	// contains filtered or unexported fields
}

func (*WatchOpts) Watch added in v1.4.1

func (opts *WatchOpts) Watch(f Watcher) error

InitOutput allow to init the OutputOpts in a functional way

type Watcher added in v1.4.1

type Watcher func() (bool, error)

Jump to

Keyboard shortcuts

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