Documentation ¶
Index ¶
- Constants
- Variables
- func BackupCleanCommand(args CommandArgs) int
- func BackupCreateCommand(args CommandArgs) int
- func BackupListCommand(args CommandArgs) int
- func BackupRestoreCommand(args CommandArgs) int
- func BatchCreateCommand(args CommandArgs) int
- func BatchEditCommand(args CommandArgs) int
- func CPUCommand(args CommandArgs) int
- func CheckCommand(args CommandArgs) int
- func CliCommand(args CommandArgs) int
- func ClientsCommand(args CommandArgs) int
- func ConfCommand(args CommandArgs) int
- func CreateCommand(args CommandArgs) int
- func DestroyCommand(args CommandArgs) int
- func EditCommand(args CommandArgs) int
- func GenTokenCommand(args CommandArgs) int
- func GoCommand(args CommandArgs) int
- func HelpCommand(args CommandArgs) int
- func InfoCommand(args CommandArgs) int
- func Init(gitRev string, gomod []byte)
- func KillCommand(args CommandArgs) int
- func ListCommand(args CommandArgs) int
- func LogCommand(args CommandArgs) int
- func MaintenanceCommand(args CommandArgs) int
- func MemoryCommand(args CommandArgs) int
- func RegenCommand(args CommandArgs) int
- func ReloadCommand(args CommandArgs) int
- func ReplicationCommand(args CommandArgs) int
- func ReplicationRoleSetCommand(args CommandArgs) int
- func RestartAllCommand(args CommandArgs) int
- func RestartAllPropCommand(args CommandArgs) int
- func RestartCommand(args CommandArgs) int
- func RestartPropCommand(args CommandArgs) int
- func RestoreStateCommand(args CommandArgs) int
- func SaveStateCommand(args CommandArgs) int
- func SentinelCheckCommand(args CommandArgs) int
- func SentinelInfoCommand(args CommandArgs) int
- func SentinelMasterCommand(args CommandArgs) int
- func SentinelResetCommand(args CommandArgs) int
- func SentinelStartCommand(args CommandArgs) int
- func SentinelStatusCommand(args CommandArgs) int
- func SentinelStopCommand(args CommandArgs) int
- func SentinelSwitchMasterCommand(args CommandArgs) int
- func SettingsCommand(args CommandArgs) int
- func SlowlogGetCommand(args CommandArgs) int
- func SlowlogResetCommand(args CommandArgs) int
- func StartAllCommand(args CommandArgs) int
- func StartAllPropCommand(args CommandArgs) int
- func StartCommand(args CommandArgs) int
- func StartPropCommand(args CommandArgs) int
- func StatsCommand(args CommandArgs) int
- func StatsCommandCommand(args CommandArgs) int
- func StatsErrorCommand(args CommandArgs) int
- func StatsLatencyCommand(args CommandArgs) int
- func StatusCommand(args CommandArgs) int
- func StopAllCommand(args CommandArgs) int
- func StopAllPropCommand(args CommandArgs) int
- func StopCommand(args CommandArgs) int
- func StopPropCommand(args CommandArgs) int
- func TagAddCommand(args CommandArgs) int
- func TagRemoveCommand(args CommandArgs) int
- func TopCommand(args CommandArgs) int
- func TopDiffCommand(args CommandArgs) int
- func TopDumpCommand(args CommandArgs) int
- func TrackCommand(args CommandArgs) int
- func UptimeCommand(args CommandArgs) int
- func ValidateTemplatesCommand(args CommandArgs) int
- type AuthFlag
- type CommandArgs
- type CommandHandler
- type CommandRoutine
- type Logger
- type Preferences
Constants ¶
const ( APP = "RDS" VER = "1.11.2" DESC = "Tool for Redis orchestration" )
const ( OPT_PRIVATE = "p:private" OPT_EXTRA = "x:extra" OPT_TAGS = "t:tags" OPT_FORMAT = "f:format" OPT_SECURE = "s:secure" OPT_DISABLE_SAVES = "ds:disable-saves" OPT_YES = "y:yes" OPT_PAGER = "P:pager" OPT_SIMPLE = "S:simple" OPT_RAW = "R:raw" OPT_NO_COLOR = "nc:no-color" OPT_HELP = "h:help" OPT_VERSION = "v:version" OPT_VERBOSE_VERSION = "vv:verbose-version" OPT_GENERATE_MAN = "generate-man" OPT_COMPLETION = "completion" )
Command line options list
const ( COMMAND_BACKUP_CREATE = "backup-create" COMMAND_BACKUP_RESTORE = "backup-restore" COMMAND_BACKUP_CLEAN = "backup-clean" COMMAND_BACKUP_LIST = "backup-list" COMMAND_BATCH_CREATE = "batch-create" COMMAND_BATCH_EDIT = "batch-edit" COMMAND_CHECK = "check" COMMAND_CLI = "cli" COMMAND_CLIENTS = "clients" COMMAND_CPU = "cpu" COMMAND_CONF = "conf" COMMAND_CREATE = "create" COMMAND_DELETE = "delete" COMMAND_DESTROY = "destroy" COMMAND_EDIT = "edit" COMMAND_GEN_TOKEN = "gen-token" COMMAND_GO = "go" COMMAND_HELP = "help" COMMAND_INFO = "info" COMMAND_INIT = "init" COMMAND_KILL = "kill" COMMAND_LIST = "list" COMMAND_LOG = "log" COMMAND_MAINTENANCE = "maintenance" COMMAND_MEMORY = "memory" COMMAND_REGEN = "regen" COMMAND_RELEASE = "release" COMMAND_RELOAD = "reload" COMMAND_REMOVE = "remove" COMMAND_REPLICATION = "replication" COMMAND_REPLICATION_ROLE_SET = "replication-role-set" COMMAND_RESTART = "restart" COMMAND_RESTART_ALL = "restart-all" COMMAND_RESTART_ALL_PROP = "@" + COMMAND_RESTART_ALL COMMAND_RESTART_PROP = "@" + COMMAND_RESTART COMMAND_SENTINEL_CHECK = "sentinel-check" COMMAND_SENTINEL_INFO = "sentinel-info" COMMAND_SENTINEL_MASTER = "sentinel-master" COMMAND_SENTINEL_RESET = "sentinel-reset" COMMAND_SENTINEL_START = "sentinel-start" COMMAND_SENTINEL_STATUS = "sentinel-status" COMMAND_SENTINEL_STOP = "sentinel-stop" COMMAND_SENTINEL_SWITCH = "sentinel-switch-master" COMMAND_SETTINGS = "settings" COMMAND_SLOWLOG_GET = "slowlog-get" COMMAND_SLOWLOG_RESET = "slowlog-reset" COMMAND_START = "start" COMMAND_START_ALL = "start-all" COMMAND_START_ALL_PROP = "@" + COMMAND_START_ALL COMMAND_START_PROP = "@" + COMMAND_START COMMAND_STATE_RESTORE = "state-restore" COMMAND_STATE_SAVE = "state-save" COMMAND_STATS = "stats" COMMAND_STATS_COMMAND = "stats-command" COMMAND_STATS_LATENCY = "stats-latency" COMMAND_STATS_ERROR = "stats-error" COMMAND_STATUS = "status" COMMAND_STOP = "stop" COMMAND_STOP_ALL = "stop-all" COMMAND_STOP_ALL_PROP = "@" + COMMAND_STOP_ALL COMMAND_STOP_PROP = "@" + COMMAND_STOP COMMAND_TAG_ADD = "tag-add" COMMAND_TAG_REMOVE = "tag-remove" COMMAND_TOP = "top" COMMAND_TOP_DIFF = "top-diff" COMMAND_TOP_DUMP = "top-dump" COMMAND_TRACK = "track" COMMAND_VALIDATE_TEMPLATES = "validate-templates" COMMAND_UPTIME = "uptime" )
Supported commands
const ( FORMAT_TEXT = "text" FORMAT_JSON = "json" FORMAT_XML = "xml" )
const ( EC_OK = 0 EC_ERROR = 1 EC_WARN = 2 EC_CANCEL = 3 )
const ( BACKUP_PERMS = 0600 // Default permissions for backups MAX_BACKUPS = 10 // Maximum number of backups )
const ( LOG_SOURCE_CLI = "cli" LOG_SOURCE_SYNC = "sync" )
const CONFIG_FILE = "/etc/rds.knf"
CONFIG_FILE is path to configuration file
const EMPTY_RESULT = "-none-"
EMPTY_RESULT is default value for an empty result from Redis
const MAINTENANCE_LOCK_FILE = ".maintenance"
MAINTENANCE_LOCK_FILE is name of lock file from maintenance mode
const MAX_DESC_LENGTH = 64
MAX_DESC_LENGTH is maximum width of description line
Variables ¶
var FilteredProps = []string{
"masterauth",
"masteruser",
"rename-command",
"requirepass",
"user",
}
FilteredProps is a slice with props that must not be shown in the command output
Functions ¶
func BackupCleanCommand ¶ added in v1.2.0
func BackupCleanCommand(args CommandArgs) int
BackupCleanCommand is "backup-clean" command handler
func BackupCreateCommand ¶ added in v1.2.0
func BackupCreateCommand(args CommandArgs) int
BackupCreateCommand is "backup-create" command handler
func BackupListCommand ¶ added in v1.2.0
func BackupListCommand(args CommandArgs) int
BackupListCommand is "backup-list" command handler
func BackupRestoreCommand ¶ added in v1.2.0
func BackupRestoreCommand(args CommandArgs) int
BackupRestoreCommand is "backup-restore" command handler
func BatchCreateCommand ¶
func BatchCreateCommand(args CommandArgs) int
BatchCreateCommand is "batch-create" command handler
func BatchEditCommand ¶
func BatchEditCommand(args CommandArgs) int
BatchEditCommand is "batch-edit" command handler
func ClientsCommand ¶
func ClientsCommand(args CommandArgs) int
ClientsCommand is "clients" command handler
func CreateCommand ¶
func CreateCommand(args CommandArgs) int
CreateCommand is "create" command handler
func DestroyCommand ¶
func DestroyCommand(args CommandArgs) int
DestroyCommand is "destroy" command handler
func GenTokenCommand ¶
func GenTokenCommand(args CommandArgs) int
GenTokenCommand is "gen-token" command handler
func LogCommand ¶ added in v1.8.0
func LogCommand(args CommandArgs) int
LogCommand is "log" command handler
func MaintenanceCommand ¶
func MaintenanceCommand(args CommandArgs) int
MaintenanceCommand is "maintenance" command handler
func MemoryCommand ¶
func MemoryCommand(args CommandArgs) int
MemoryCommand is "memory" command handler
func ReloadCommand ¶
func ReloadCommand(args CommandArgs) int
ReloadCommand is "reload" command handler
func ReplicationCommand ¶
func ReplicationCommand(args CommandArgs) int
ReplicationCommand is "replication" command handler
func ReplicationRoleSetCommand ¶
func ReplicationRoleSetCommand(args CommandArgs) int
ReplicationCommand is "replication" command handler
func RestartAllCommand ¶
func RestartAllCommand(args CommandArgs) int
RestartAllCommand is "restart-all" command handler
func RestartAllPropCommand ¶
func RestartAllPropCommand(args CommandArgs) int
RestartAllPropCommand is "@restart-all" command handler
func RestartCommand ¶
func RestartCommand(args CommandArgs) int
RestartCommand is "restart" command handler
func RestartPropCommand ¶
func RestartPropCommand(args CommandArgs) int
RestartPropCommand is "@restart" command handler
func RestoreStateCommand ¶
func RestoreStateCommand(args CommandArgs) int
RestoreStateCommand is "state-restore" command handler
func SaveStateCommand ¶
func SaveStateCommand(args CommandArgs) int
SaveStateCommand is "state-save" command handler
func SentinelCheckCommand ¶
func SentinelCheckCommand(args CommandArgs) int
SentinelCheckCommand is "sentinel-check" command handler
func SentinelInfoCommand ¶
func SentinelInfoCommand(args CommandArgs) int
SentinelInfoCommand is "sentinel-info" command handler
func SentinelMasterCommand ¶
func SentinelMasterCommand(args CommandArgs) int
SentinelMasterCommand is "sentinel-master" command handler
func SentinelResetCommand ¶
func SentinelResetCommand(args CommandArgs) int
SentinelResetCommand is "sentinel-reset" command handler
func SentinelStartCommand ¶
func SentinelStartCommand(args CommandArgs) int
SentinelStartCommand is "sentinel-start" command handler
func SentinelStatusCommand ¶
func SentinelStatusCommand(args CommandArgs) int
SentinelStatusCommand is "sentinel-status" command handler
func SentinelStopCommand ¶
func SentinelStopCommand(args CommandArgs) int
SentinelStopCommand is "sentinel-stop" command handler
func SentinelSwitchMasterCommand ¶
func SentinelSwitchMasterCommand(args CommandArgs) int
SentinelSwitchMasterCommand is "sentinel-switch-master" command handler
func SettingsCommand ¶
func SettingsCommand(args CommandArgs) int
StopAllCommand is "settings" command handler
func SlowlogGetCommand ¶
func SlowlogGetCommand(args CommandArgs) int
SlowlogGetCommand is "slowlog-get" command handler
func SlowlogResetCommand ¶
func SlowlogResetCommand(args CommandArgs) int
SlowlogResetCommand is "slowlog-reset" command handler
func StartAllCommand ¶
func StartAllCommand(args CommandArgs) int
StartAllCommand is "start-all" command handler
func StartAllPropCommand ¶
func StartAllPropCommand(args CommandArgs) int
StartAllPropCommand is "@start-all" command handler
func StartPropCommand ¶
func StartPropCommand(args CommandArgs) int
StartPropCommand is "@start" command handler
func StatsCommandCommand ¶
func StatsCommandCommand(args CommandArgs) int
StatsCommandCommand is "stats-command" command handler
func StatsErrorCommand ¶
func StatsErrorCommand(args CommandArgs) int
StatsErrorCommand is "stats-error" command handler
func StatsLatencyCommand ¶
func StatsLatencyCommand(args CommandArgs) int
StatsLatencyCommand is "stats-latency" command handler
func StatusCommand ¶
func StatusCommand(args CommandArgs) int
StatusCommand is "status" command handler
func StopAllCommand ¶
func StopAllCommand(args CommandArgs) int
StopAllCommand is "stop-all" command handler
func StopAllPropCommand ¶
func StopAllPropCommand(args CommandArgs) int
StopAllPropCommand is "@stop-all" command handler
func StopPropCommand ¶
func StopPropCommand(args CommandArgs) int
StopPropCommand is "@stop" command handler
func TagAddCommand ¶
func TagAddCommand(args CommandArgs) int
TagAddCommand is "tag-add" command handler
func TagRemoveCommand ¶
func TagRemoveCommand(args CommandArgs) int
TagRemoveCommand is "tag-remove" command handler
func TopDiffCommand ¶
func TopDiffCommand(args CommandArgs) int
TopDiffCommand is "top-diff" command handler
func TopDumpCommand ¶
func TopDumpCommand(args CommandArgs) int
TopDumpCommand is "top-dump" command handler
func UptimeCommand ¶ added in v1.11.0
func UptimeCommand(args CommandArgs) int
UptimeCommand is "uptime" command handler
func ValidateTemplatesCommand ¶ added in v1.2.0
func ValidateTemplatesCommand(args CommandArgs) int
ValidateTemplatesCommand is "validate-templates" command handler
Types ¶
type CommandArgs ¶
type CommandArgs []string
func (CommandArgs) Check ¶
func (a CommandArgs) Check(mustWorks bool) error
Check checks command arguments
func (CommandArgs) Get ¶
func (a CommandArgs) Get(index int) string
Get returns argument with given index
func (CommandArgs) GetB ¶
func (a CommandArgs) GetB(index int) (bool, error)
GetB returns argument with given index as boolean
func (CommandArgs) GetF ¶
func (a CommandArgs) GetF(index int) (float64, error)
GetF returns argument with given index as float
func (CommandArgs) GetI ¶
func (a CommandArgs) GetI(index int) (int, error)
GetI returns argument with given index as int
func (CommandArgs) Has ¶
func (a CommandArgs) Has(index int) bool
Has returns true if arguments contains argument with given index
type CommandHandler ¶
type CommandHandler func(CommandArgs) int
type CommandRoutine ¶
type CommandRoutine struct { Handler CommandHandler Auth AuthFlag PrettyOutput bool }
type Logger ¶ added in v1.2.0
type Logger struct{}
type Preferences ¶ added in v1.5.0
Preferences struct contains user-specific preferences
func GetPreferences ¶ added in v1.5.0
func GetPreferences() Preferences
GetPreferences reads preferences defined by current user
Source Files ¶
- cli.go
- command_backup.go
- command_batch_create.go
- command_batch_edit.go
- command_check.go
- command_cli.go
- command_clients.go
- command_conf.go
- command_cpu.go
- command_create.go
- command_destroy.go
- command_edit.go
- command_gen_token.go
- command_go.go
- command_help.go
- command_info.go
- command_kill.go
- command_list.go
- command_log.go
- command_maintenance.go
- command_memory.go
- command_regen.go
- command_reload.go
- command_replication.go
- command_replication_role_set.go
- command_restart.go
- command_restart_all.go
- command_sentinel.go
- command_settings.go
- command_slowlog.go
- command_start.go
- command_start_all.go
- command_state.go
- command_stats.go
- command_stats_command.go
- command_stats_error.go
- command_stats_latency.go
- command_status.go
- command_stop.go
- command_stop_all.go
- command_tag.go
- command_top.go
- command_track.go
- command_uptime.go
- command_validate_templates.go
- common.go
- input_validators.go
- logger.go
- preferences.go
- tips.go