2015-06-01 11:46:21 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
2015-06-01 13:25:51 +00:00
|
|
|
"github.com/hashicorp/nomad/command"
|
2015-08-16 01:34:47 +00:00
|
|
|
"github.com/hashicorp/nomad/command/agent"
|
2017-08-16 22:42:15 +00:00
|
|
|
"github.com/hashicorp/nomad/version"
|
2015-06-01 11:46:21 +00:00
|
|
|
"github.com/mitchellh/cli"
|
|
|
|
)
|
|
|
|
|
2015-09-20 20:37:11 +00:00
|
|
|
// Commands returns the mapping of CLI commands for Nomad. The meta
|
2015-06-01 11:46:21 +00:00
|
|
|
// parameter lets you set meta options for all commands.
|
|
|
|
func Commands(metaPtr *command.Meta) map[string]cli.CommandFactory {
|
|
|
|
if metaPtr == nil {
|
|
|
|
metaPtr = new(command.Meta)
|
|
|
|
}
|
|
|
|
|
|
|
|
meta := *metaPtr
|
|
|
|
if meta.Ui == nil {
|
2015-09-16 23:08:39 +00:00
|
|
|
meta.Ui = &cli.BasicUi{
|
2016-03-24 21:43:20 +00:00
|
|
|
Reader: os.Stdin,
|
2015-09-16 23:08:39 +00:00
|
|
|
Writer: os.Stdout,
|
|
|
|
ErrorWriter: os.Stderr,
|
2015-06-01 11:46:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return map[string]cli.CommandFactory{
|
2017-09-11 17:46:17 +00:00
|
|
|
"acl": func() (cli.Command, error) {
|
|
|
|
return &command.ACLCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"acl bootstrap": func() (cli.Command, error) {
|
|
|
|
return &command.ACLBootstrapCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-09-15 04:31:05 +00:00
|
|
|
"acl policy": func() (cli.Command, error) {
|
|
|
|
return &command.ACLPolicyCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"acl policy apply": func() (cli.Command, error) {
|
|
|
|
return &command.ACLPolicyApplyCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-09-17 18:22:07 +00:00
|
|
|
"acl policy delete": func() (cli.Command, error) {
|
|
|
|
return &command.ACLPolicyDeleteCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-09-17 13:36:54 +00:00
|
|
|
"acl policy info": func() (cli.Command, error) {
|
|
|
|
return &command.ACLPolicyInfoCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-10-13 20:45:10 +00:00
|
|
|
"acl policy list": func() (cli.Command, error) {
|
|
|
|
return &command.ACLPolicyListCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-09-15 04:55:25 +00:00
|
|
|
"acl token": func() (cli.Command, error) {
|
|
|
|
return &command.ACLTokenCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"acl token create": func() (cli.Command, error) {
|
|
|
|
return &command.ACLTokenCreateCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-09-15 23:54:41 +00:00
|
|
|
"acl token update": func() (cli.Command, error) {
|
|
|
|
return &command.ACLTokenUpdateCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-09-15 16:29:46 +00:00
|
|
|
"acl token delete": func() (cli.Command, error) {
|
|
|
|
return &command.ACLTokenDeleteCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-09-16 00:03:22 +00:00
|
|
|
"acl token info": func() (cli.Command, error) {
|
|
|
|
return &command.ACLTokenInfoCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-10-13 20:45:10 +00:00
|
|
|
"acl token self": func() (cli.Command, error) {
|
|
|
|
return &command.ACLTokenSelfCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2015-09-27 19:02:14 +00:00
|
|
|
"alloc-status": func() (cli.Command, error) {
|
|
|
|
return &command.AllocStatusCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2015-08-16 01:34:47 +00:00
|
|
|
"agent": func() (cli.Command, error) {
|
|
|
|
return &agent.Command{
|
2017-08-16 22:42:15 +00:00
|
|
|
Version: version.GetVersion(),
|
|
|
|
Ui: meta.Ui,
|
|
|
|
ShutdownCh: make(chan struct{}),
|
2015-08-16 01:34:47 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2015-09-22 18:01:41 +00:00
|
|
|
"agent-info": func() (cli.Command, error) {
|
|
|
|
return &command.AgentInfoCommand{
|
2015-09-14 20:13:52 +00:00
|
|
|
Meta: meta,
|
2015-09-11 19:31:13 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2016-04-10 08:13:25 +00:00
|
|
|
"check": func() (cli.Command, error) {
|
|
|
|
return &command.AgentCheckCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2015-09-25 18:49:31 +00:00
|
|
|
"client-config": func() (cli.Command, error) {
|
|
|
|
return &command.ClientConfigCommand{
|
2015-09-25 04:31:15 +00:00
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-06-30 17:59:19 +00:00
|
|
|
"deployment": func() (cli.Command, error) {
|
|
|
|
return &command.DeploymentCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-06-30 21:27:13 +00:00
|
|
|
"deployment fail": func() (cli.Command, error) {
|
|
|
|
return &command.DeploymentFailCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-06-30 17:59:19 +00:00
|
|
|
"deployment list": func() (cli.Command, error) {
|
|
|
|
return &command.DeploymentListCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-06-30 21:27:13 +00:00
|
|
|
"deployment pause": func() (cli.Command, error) {
|
|
|
|
return &command.DeploymentPauseCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-06-30 23:22:06 +00:00
|
|
|
"deployment promote": func() (cli.Command, error) {
|
|
|
|
return &command.DeploymentPromoteCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-06-30 21:27:13 +00:00
|
|
|
"deployment resume": func() (cli.Command, error) {
|
|
|
|
return &command.DeploymentResumeCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-06-30 19:35:59 +00:00
|
|
|
"deployment status": func() (cli.Command, error) {
|
|
|
|
return &command.DeploymentStatusCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2016-05-25 21:11:14 +00:00
|
|
|
"eval-status": func() (cli.Command, error) {
|
|
|
|
return &command.EvalStatusCommand{
|
2015-09-14 20:13:52 +00:00
|
|
|
Meta: meta,
|
2015-09-11 17:50:39 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2016-02-08 03:07:50 +00:00
|
|
|
"executor": func() (cli.Command, error) {
|
|
|
|
return &command.ExecutorPluginCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2016-02-05 19:01:29 +00:00
|
|
|
"fs": func() (cli.Command, error) {
|
|
|
|
return &command.FSCommand{
|
2016-02-02 22:36:11 +00:00
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2015-09-21 00:06:02 +00:00
|
|
|
"init": func() (cli.Command, error) {
|
|
|
|
return &command.InitCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2016-03-21 19:46:35 +00:00
|
|
|
"inspect": func() (cli.Command, error) {
|
|
|
|
return &command.InspectCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2016-10-17 17:48:04 +00:00
|
|
|
"keygen": func() (cli.Command, error) {
|
|
|
|
return &command.KeygenCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"keyring": func() (cli.Command, error) {
|
|
|
|
return &command.KeyringCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2016-12-05 05:22:13 +00:00
|
|
|
"job": func() (cli.Command, error) {
|
|
|
|
return &command.JobCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-07-01 00:37:12 +00:00
|
|
|
"job deployments": func() (cli.Command, error) {
|
|
|
|
return &command.JobDeploymentsCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2016-12-05 05:22:13 +00:00
|
|
|
"job dispatch": func() (cli.Command, error) {
|
|
|
|
return &command.JobDispatchCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-06-30 00:16:20 +00:00
|
|
|
"job history": func() (cli.Command, error) {
|
|
|
|
return &command.JobHistoryCommand{
|
2017-07-19 22:39:32 +00:00
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"job promote": func() (cli.Command, error) {
|
|
|
|
return &command.JobPromoteCommand{
|
2017-06-30 00:16:20 +00:00
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-06-30 03:28:52 +00:00
|
|
|
"job revert": func() (cli.Command, error) {
|
|
|
|
return &command.JobRevertCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-08-09 15:05:55 +00:00
|
|
|
"job status": func() (cli.Command, error) {
|
|
|
|
return &command.JobStatusCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2016-07-18 18:39:38 +00:00
|
|
|
"logs": func() (cli.Command, error) {
|
|
|
|
return &command.LogsCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-09-07 23:56:15 +00:00
|
|
|
"namespace": func() (cli.Command, error) {
|
|
|
|
return &command.NamespaceCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"namespace apply": func() (cli.Command, error) {
|
|
|
|
return &command.NamespaceApplyCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"namespace delete": func() (cli.Command, error) {
|
|
|
|
return &command.NamespaceDeleteCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-10-13 21:36:02 +00:00
|
|
|
"namespace inspect": func() (cli.Command, error) {
|
|
|
|
return &command.NamespaceInspectCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-09-07 23:56:15 +00:00
|
|
|
"namespace list": func() (cli.Command, error) {
|
|
|
|
return &command.NamespaceListCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-10-13 21:36:02 +00:00
|
|
|
"namespace status": func() (cli.Command, error) {
|
|
|
|
return &command.NamespaceStatusCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2018-02-23 23:56:36 +00:00
|
|
|
"node": func() (cli.Command, error) {
|
|
|
|
return &command.NodeCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2015-09-22 18:01:41 +00:00
|
|
|
"node-drain": func() (cli.Command, error) {
|
|
|
|
return &command.NodeDrainCommand{
|
2015-09-14 20:13:52 +00:00
|
|
|
Meta: meta,
|
2015-09-11 22:48:36 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2018-02-23 23:56:36 +00:00
|
|
|
"node drain": func() (cli.Command, error) {
|
|
|
|
return &command.NodeDrainCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2018-02-27 21:54:27 +00:00
|
|
|
"node eligibility": func() (cli.Command, error) {
|
|
|
|
return &command.NodeEligibilityCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2015-09-22 18:01:41 +00:00
|
|
|
"node-status": func() (cli.Command, error) {
|
|
|
|
return &command.NodeStatusCommand{
|
2015-09-14 20:13:52 +00:00
|
|
|
Meta: meta,
|
2015-09-11 19:58:16 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2018-02-23 23:56:36 +00:00
|
|
|
"node status": func() (cli.Command, error) {
|
|
|
|
return &command.NodeStatusCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-02-10 01:58:20 +00:00
|
|
|
"operator": func() (cli.Command, error) {
|
|
|
|
return &command.OperatorCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
2017-12-18 21:16:23 +00:00
|
|
|
"operator autopilot": func() (cli.Command, error) {
|
|
|
|
return &command.OperatorAutopilotCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
|
|
|
"operator autopilot get-config": func() (cli.Command, error) {
|
|
|
|
return &command.OperatorAutopilotGetCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
|
|
|
"operator autopilot set-config": func() (cli.Command, error) {
|
|
|
|
return &command.OperatorAutopilotSetCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
2017-02-10 01:58:20 +00:00
|
|
|
"operator raft": func() (cli.Command, error) {
|
|
|
|
return &command.OperatorRaftCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
|
|
|
"operator raft list-peers": func() (cli.Command, error) {
|
|
|
|
return &command.OperatorRaftListCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
|
|
|
"operator raft remove-peer": func() (cli.Command, error) {
|
|
|
|
return &command.OperatorRaftRemoveCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
2016-05-13 00:17:02 +00:00
|
|
|
"plan": func() (cli.Command, error) {
|
|
|
|
return &command.PlanCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
2017-10-13 21:36:02 +00:00
|
|
|
"quota": func() (cli.Command, error) {
|
|
|
|
return &command.QuotaCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
|
|
|
"quota apply": func() (cli.Command, error) {
|
|
|
|
return &command.QuotaApplyCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
|
|
|
"quota delete": func() (cli.Command, error) {
|
|
|
|
return &command.QuotaDeleteCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
|
|
|
"quota init": func() (cli.Command, error) {
|
|
|
|
return &command.QuotaInitCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
|
|
|
"quota inspect": func() (cli.Command, error) {
|
|
|
|
return &command.QuotaInspectCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
|
|
|
"quota list": func() (cli.Command, error) {
|
|
|
|
return &command.QuotaListCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
|
|
|
"quota status": func() (cli.Command, error) {
|
|
|
|
return &command.QuotaStatusCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
|
2015-09-22 18:01:41 +00:00
|
|
|
"run": func() (cli.Command, error) {
|
|
|
|
return &command.RunCommand{
|
2015-09-16 23:08:39 +00:00
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-09-19 14:47:10 +00:00
|
|
|
"sentinel": func() (cli.Command, error) {
|
|
|
|
return &command.SentinelCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"sentinel list": func() (cli.Command, error) {
|
|
|
|
return &command.SentinelListCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"sentinel apply": func() (cli.Command, error) {
|
|
|
|
return &command.SentinelApplyCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"sentinel delete": func() (cli.Command, error) {
|
|
|
|
return &command.SentinelDeleteCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
"sentinel read": func() (cli.Command, error) {
|
|
|
|
return &command.SentinelReadCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2015-09-22 18:01:41 +00:00
|
|
|
"server-force-leave": func() (cli.Command, error) {
|
|
|
|
return &command.ServerForceLeaveCommand{
|
2015-09-14 20:13:52 +00:00
|
|
|
Meta: meta,
|
2015-09-13 00:09:03 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2015-09-22 18:01:41 +00:00
|
|
|
"server-join": func() (cli.Command, error) {
|
|
|
|
return &command.ServerJoinCommand{
|
2015-09-14 20:13:52 +00:00
|
|
|
Meta: meta,
|
2015-09-12 20:55:51 +00:00
|
|
|
}, nil
|
|
|
|
},
|
2015-09-22 18:01:41 +00:00
|
|
|
"server-members": func() (cli.Command, error) {
|
|
|
|
return &command.ServerMembersCommand{
|
2015-09-16 01:22:51 +00:00
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-08-14 17:35:13 +00:00
|
|
|
"status": func() (cli.Command, error) {
|
|
|
|
return &command.StatusCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2015-09-17 00:35:58 +00:00
|
|
|
"stop": func() (cli.Command, error) {
|
|
|
|
return &command.StopCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2017-10-10 06:01:55 +00:00
|
|
|
"ui": func() (cli.Command, error) {
|
|
|
|
return &command.UiCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2015-09-25 01:29:46 +00:00
|
|
|
"validate": func() (cli.Command, error) {
|
|
|
|
return &command.ValidateCommand{
|
|
|
|
Meta: meta,
|
|
|
|
}, nil
|
|
|
|
},
|
2015-06-01 11:46:21 +00:00
|
|
|
"version": func() (cli.Command, error) {
|
|
|
|
return &command.VersionCommand{
|
2017-08-16 22:42:15 +00:00
|
|
|
Version: version.GetVersion(),
|
2017-07-17 18:04:07 +00:00
|
|
|
Ui: meta.Ui,
|
2015-06-01 11:46:21 +00:00
|
|
|
}, nil
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|