cli

package
v1.22.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPage      = 1
	DefaultPageLimit = 100
)

Variables

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

Functions

func DefaultMongoDBMajorVersion added in v1.16.0

func DefaultMongoDBMajorVersion() (string, error)

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.

func GetHostnameAndPort added in v1.22.0

func GetHostnameAndPort(hostInfo string) (hostname string, port int, err error)

GetHostnameAndPort return the hostname and the port starting from the string hostname:port.

func IsCygwinTerminal added in v1.20.0

func IsCygwinTerminal(w io.Writer) bool

IsCygwinTerminal returns true is the current file descriptor is cygwin.

func IsCygwinTerminalInput added in v1.21.0

func IsCygwinTerminalInput(r io.Reader) bool

IsCygwinTerminal returns true is the current file descriptor is cygwin.

func IsTerminal added in v1.20.0

func IsTerminal(w io.Writer) bool

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

func IsTerminalInput added in v1.21.0

func IsTerminalInput(r io.Reader) bool

IsTerminalInput returns true is the current file descriptor is TTY kind of terminal.

func ParseServiceVersion added in v1.20.0

func ParseServiceVersion(v *atlas.ServiceVersion) (*semver.Version, error)

ParseServiceVersion parses service version into semver.Version.

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) PromptWithMessage added in v1.11.0

func (opts *DeleteOpts) PromptWithMessage(message string) error

PromptWithMessage 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 InputOpts added in v1.21.0

type InputOpts struct {
	InReader io.Reader
}

func (*InputOpts) ConfigReader added in v1.21.0

func (opts *InputOpts) ConfigReader() io.Reader

ConfigReader returns the io.Reader. If the reader is nil, it defaults to os.Stdin and caches it.

func (*InputOpts) InitInput added in v1.21.0

func (opts *InputOpts) InitInput(r io.Reader) func() error

InitInput allow to init the InputOpts in a functional way.

func (*InputOpts) IsCygwinTerminalInput added in v1.21.0

func (opts *InputOpts) IsCygwinTerminalInput() bool

IsCygwinTerminalInput returns true is the current file descriptor is cygwin.

func (*InputOpts) IsTerminalInput added in v1.21.0

func (opts *InputOpts) IsTerminalInput() bool

IsTerminalInput returns true is the current file descriptor is TTY kind of terminal.

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

func (*MetricsOpts) ValidatePeriodStartEnd added in v1.22.0

func (opts *MetricsOpts) ValidatePeriodStartEnd() error

ValidatePeriodStartEnd validates period, start and end flags.

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(o 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

Watch allow to init the OutputOpts in a functional way.

type Watcher added in v1.4.1

type Watcher func() (bool, error)

Directories

Path Synopsis
iam

Jump to

Keyboard shortcuts

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