Documentation
¶
Overview ¶
Package cmd contains everything needed for a command to function properly, including providing user feedback as well as taking user input.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUserAbortedError ¶
IsUserAbortedError returns true if err is of type userAbortedError.
func NewRestoreCommand ¶
func NewRestoreCommand( dbConnect func(info db.DialInfo) (core.Database, error), openBackup func(path, tempRoot string) (core.BackupFile, error), machineConverter func(member core.ReplicaSetMember) core.ControllerNode, loadCreds func() (MongoCredentialInfo, error), devMode bool, ) cmd.Command
NewRestoreCommand creates a cmd.Command to check the database and restore the Juju backup.
Types ¶
type MongoCredentialInfo ¶
type MongoCredentialInfo struct {
Username string
Password string
CACert string
CAPrivateKey string
}
MongoCredentialInfo holds the information needed to authenticate to the Juju MongoDB server.
func ReadCredsFromAgentConf ¶
func ReadCredsFromAgentConf() (MongoCredentialInfo, error)
ReadCredsFromAgentConf tries to load a mongo username and password from the standard agent.conf location on a controller machine.
func ReadCredsFromPattern ¶
func ReadCredsFromPattern(pattern string, readFile func(string) ([]byte, error)) (MongoCredentialInfo, error)
ReadCredsFromPattern tries to load a mongo username and password from the first file it finds matching the pattern passed in.
type UserInteractions ¶
type UserInteractions struct {
// contains filtered or unexported fields
}
UserInteractions communicates with the user by providing feedback and by collecting user input.
func NewUserInteractions ¶
func NewUserInteractions(ctx *cmd.Context) *UserInteractions
NewUserInteractions constructs user interactions with given context.
func (*UserInteractions) Notify ¶
func (ui *UserInteractions) Notify(message string)
Notify will post message to an io.Writer of the given cmd.Context. This ensures that all messages that require user attention go consistently to the same writer.
func (*UserInteractions) UserConfirmYes ¶
func (ui *UserInteractions) UserConfirmYes() error
UserConfirmYes returns an error if we do not read a "y" or "yes" from user input.