github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/command/commands.go (about) 1 package command 2 3 import ( 4 "fmt" 5 "os" 6 7 "github.com/hashicorp/nomad/command/agent" 8 "github.com/hashicorp/nomad/version" 9 colorable "github.com/mattn/go-colorable" 10 "github.com/mitchellh/cli" 11 ) 12 13 const ( 14 // EnvNomadCLINoColor is an env var that toggles colored UI output. 15 EnvNomadCLINoColor = `NOMAD_CLI_NO_COLOR` 16 17 // EnvNomadCLIForceColor is an env var that forces colored UI output. 18 EnvNomadCLIForceColor = `NOMAD_CLI_FORCE_COLOR` 19 ) 20 21 // DeprecatedCommand is a command that wraps an existing command and prints a 22 // deprecation notice and points the user to the new command. Deprecated 23 // commands are always hidden from help output. 24 type DeprecatedCommand struct { 25 cli.Command 26 Meta 27 28 // Old is the old command name, New is the new command name. 29 Old, New string 30 } 31 32 // Help wraps the embedded Help command and prints a warning about deprecations. 33 func (c *DeprecatedCommand) Help() string { 34 c.warn() 35 return c.Command.Help() 36 } 37 38 // Run wraps the embedded Run command and prints a warning about deprecation. 39 func (c *DeprecatedCommand) Run(args []string) int { 40 c.warn() 41 return c.Command.Run(args) 42 } 43 44 func (c *DeprecatedCommand) warn() { 45 c.Ui.Warn(wrapAtLength(fmt.Sprintf( 46 "WARNING! The \"nomad %s\" command is deprecated. Please use \"nomad %s\" "+ 47 "instead. This command will be removed a later version of Nomad.", 48 c.Old, 49 c.New))) 50 c.Ui.Warn("") 51 } 52 53 // NamedCommand is a interface to denote a commmand's name. 54 type NamedCommand interface { 55 Name() string 56 } 57 58 // Commands returns the mapping of CLI commands for Nomad. The meta 59 // parameter lets you set meta options for all commands. 60 func Commands(metaPtr *Meta, agentUi cli.Ui) map[string]cli.CommandFactory { 61 if metaPtr == nil { 62 metaPtr = new(Meta) 63 } 64 65 meta := *metaPtr 66 if meta.Ui == nil { 67 meta.Ui = &cli.BasicUi{ 68 Reader: os.Stdin, 69 Writer: colorable.NewColorableStdout(), 70 ErrorWriter: colorable.NewColorableStderr(), 71 } 72 } 73 74 all := map[string]cli.CommandFactory{ 75 "acl": func() (cli.Command, error) { 76 return &ACLCommand{ 77 Meta: meta, 78 }, nil 79 }, 80 "acl auth-method": func() (cli.Command, error) { 81 return &ACLAuthMethodCommand{ 82 Meta: meta, 83 }, nil 84 }, 85 "acl auth-method create": func() (cli.Command, error) { 86 return &ACLAuthMethodCreateCommand{ 87 Meta: meta, 88 }, nil 89 }, 90 "acl auth-method delete": func() (cli.Command, error) { 91 return &ACLAuthMethodDeleteCommand{ 92 Meta: meta, 93 }, nil 94 }, 95 "acl auth-method info": func() (cli.Command, error) { 96 return &ACLAuthMethodInfoCommand{ 97 Meta: meta, 98 }, nil 99 }, 100 "acl auth-method list": func() (cli.Command, error) { 101 return &ACLAuthMethodListCommand{ 102 Meta: meta, 103 }, nil 104 }, 105 "acl auth-method update": func() (cli.Command, error) { 106 return &ACLAuthMethodUpdateCommand{ 107 Meta: meta, 108 }, nil 109 }, 110 "acl bootstrap": func() (cli.Command, error) { 111 return &ACLBootstrapCommand{ 112 Meta: meta, 113 }, nil 114 }, 115 "acl policy": func() (cli.Command, error) { 116 return &ACLPolicyCommand{ 117 Meta: meta, 118 }, nil 119 }, 120 "acl policy apply": func() (cli.Command, error) { 121 return &ACLPolicyApplyCommand{ 122 Meta: meta, 123 }, nil 124 }, 125 "acl policy delete": func() (cli.Command, error) { 126 return &ACLPolicyDeleteCommand{ 127 Meta: meta, 128 }, nil 129 }, 130 "acl policy info": func() (cli.Command, error) { 131 return &ACLPolicyInfoCommand{ 132 Meta: meta, 133 }, nil 134 }, 135 "acl policy list": func() (cli.Command, error) { 136 return &ACLPolicyListCommand{ 137 Meta: meta, 138 }, nil 139 }, 140 "acl role": func() (cli.Command, error) { 141 return &ACLRoleCommand{ 142 Meta: meta, 143 }, nil 144 }, 145 "acl role create": func() (cli.Command, error) { 146 return &ACLRoleCreateCommand{ 147 Meta: meta, 148 }, nil 149 }, 150 "acl role delete": func() (cli.Command, error) { 151 return &ACLRoleDeleteCommand{ 152 Meta: meta, 153 }, nil 154 }, 155 "acl role info": func() (cli.Command, error) { 156 return &ACLRoleInfoCommand{ 157 Meta: meta, 158 }, nil 159 }, 160 "acl role list": func() (cli.Command, error) { 161 return &ACLRoleListCommand{ 162 Meta: meta, 163 }, nil 164 }, 165 "acl role update": func() (cli.Command, error) { 166 return &ACLRoleUpdateCommand{ 167 Meta: meta, 168 }, nil 169 }, 170 "acl token": func() (cli.Command, error) { 171 return &ACLTokenCommand{ 172 Meta: meta, 173 }, nil 174 }, 175 "acl token create": func() (cli.Command, error) { 176 return &ACLTokenCreateCommand{ 177 Meta: meta, 178 }, nil 179 }, 180 "acl token update": func() (cli.Command, error) { 181 return &ACLTokenUpdateCommand{ 182 Meta: meta, 183 }, nil 184 }, 185 "acl token delete": func() (cli.Command, error) { 186 return &ACLTokenDeleteCommand{ 187 Meta: meta, 188 }, nil 189 }, 190 "acl token info": func() (cli.Command, error) { 191 return &ACLTokenInfoCommand{ 192 Meta: meta, 193 }, nil 194 }, 195 "acl token list": func() (cli.Command, error) { 196 return &ACLTokenListCommand{ 197 Meta: meta, 198 }, nil 199 }, 200 "acl token self": func() (cli.Command, error) { 201 return &ACLTokenSelfCommand{ 202 Meta: meta, 203 }, nil 204 }, 205 "alloc": func() (cli.Command, error) { 206 return &AllocCommand{ 207 Meta: meta, 208 }, nil 209 }, 210 "alloc exec": func() (cli.Command, error) { 211 return &AllocExecCommand{ 212 Meta: meta, 213 }, nil 214 }, 215 "alloc signal": func() (cli.Command, error) { 216 return &AllocSignalCommand{ 217 Meta: meta, 218 }, nil 219 }, 220 "alloc stop": func() (cli.Command, error) { 221 return &AllocStopCommand{ 222 Meta: meta, 223 }, nil 224 }, 225 "alloc fs": func() (cli.Command, error) { 226 return &AllocFSCommand{ 227 Meta: meta, 228 }, nil 229 }, 230 "alloc logs": func() (cli.Command, error) { 231 return &AllocLogsCommand{ 232 Meta: meta, 233 }, nil 234 }, 235 "alloc restart": func() (cli.Command, error) { 236 return &AllocRestartCommand{ 237 Meta: meta, 238 }, nil 239 }, 240 "alloc checks": func() (cli.Command, error) { 241 return &AllocChecksCommand{ 242 Meta: meta, 243 }, nil 244 }, 245 "alloc status": func() (cli.Command, error) { 246 return &AllocStatusCommand{ 247 Meta: meta, 248 }, nil 249 }, 250 "alloc-status": func() (cli.Command, error) { 251 return &AllocStatusCommand{ 252 Meta: meta, 253 }, nil 254 }, 255 "agent": func() (cli.Command, error) { 256 return &agent.Command{ 257 Version: version.GetVersion(), 258 Ui: agentUi, 259 ShutdownCh: make(chan struct{}), 260 }, nil 261 }, 262 "agent-info": func() (cli.Command, error) { 263 return &AgentInfoCommand{ 264 Meta: meta, 265 }, nil 266 }, 267 "check": func() (cli.Command, error) { 268 return &AgentCheckCommand{ 269 Meta: meta, 270 }, nil 271 }, 272 "config": func() (cli.Command, error) { 273 return &ConfigCommand{ 274 Meta: meta, 275 }, nil 276 }, 277 "config validate": func() (cli.Command, error) { 278 return &ConfigValidateCommand{ 279 Meta: meta, 280 }, nil 281 }, 282 // operator debug was released in 0.12 as debug. This top-level alias preserves compatibility 283 "debug": func() (cli.Command, error) { 284 return &OperatorDebugCommand{ 285 Meta: meta, 286 }, nil 287 }, 288 "deployment": func() (cli.Command, error) { 289 return &DeploymentCommand{ 290 Meta: meta, 291 }, nil 292 }, 293 "deployment fail": func() (cli.Command, error) { 294 return &DeploymentFailCommand{ 295 Meta: meta, 296 }, nil 297 }, 298 "deployment list": func() (cli.Command, error) { 299 return &DeploymentListCommand{ 300 Meta: meta, 301 }, nil 302 }, 303 "deployment pause": func() (cli.Command, error) { 304 return &DeploymentPauseCommand{ 305 Meta: meta, 306 }, nil 307 }, 308 "deployment promote": func() (cli.Command, error) { 309 return &DeploymentPromoteCommand{ 310 Meta: meta, 311 }, nil 312 }, 313 "deployment resume": func() (cli.Command, error) { 314 return &DeploymentResumeCommand{ 315 Meta: meta, 316 }, nil 317 }, 318 "deployment status": func() (cli.Command, error) { 319 return &DeploymentStatusCommand{ 320 Meta: meta, 321 }, nil 322 }, 323 "deployment unblock": func() (cli.Command, error) { 324 return &DeploymentUnblockCommand{ 325 Meta: meta, 326 }, nil 327 }, 328 "eval": func() (cli.Command, error) { 329 return &EvalCommand{ 330 Meta: meta, 331 }, nil 332 }, 333 "eval delete": func() (cli.Command, error) { 334 return &EvalDeleteCommand{ 335 Meta: meta, 336 }, nil 337 }, 338 "eval list": func() (cli.Command, error) { 339 return &EvalListCommand{ 340 Meta: meta, 341 }, nil 342 }, 343 "eval status": func() (cli.Command, error) { 344 return &EvalStatusCommand{ 345 Meta: meta, 346 }, nil 347 }, 348 "eval-status": func() (cli.Command, error) { 349 return &EvalStatusCommand{ 350 Meta: meta, 351 }, nil 352 }, 353 "exec": func() (cli.Command, error) { 354 return &AllocExecCommand{ 355 Meta: meta, 356 }, nil 357 }, 358 "fmt": func() (cli.Command, error) { 359 return &FormatCommand{ 360 Meta: meta, 361 }, nil 362 }, 363 "fs": func() (cli.Command, error) { 364 return &AllocFSCommand{ 365 Meta: meta, 366 }, nil 367 }, 368 "init": func() (cli.Command, error) { 369 return &JobInitCommand{ 370 Meta: meta, 371 }, nil 372 }, 373 "inspect": func() (cli.Command, error) { 374 return &JobInspectCommand{ 375 Meta: meta, 376 }, nil 377 }, 378 "job": func() (cli.Command, error) { 379 return &JobCommand{ 380 Meta: meta, 381 }, nil 382 }, 383 "job allocs": func() (cli.Command, error) { 384 return &JobAllocsCommand{ 385 Meta: meta, 386 }, nil 387 }, 388 "job deployments": func() (cli.Command, error) { 389 return &JobDeploymentsCommand{ 390 Meta: meta, 391 }, nil 392 }, 393 "job dispatch": func() (cli.Command, error) { 394 return &JobDispatchCommand{ 395 Meta: meta, 396 }, nil 397 }, 398 "job eval": func() (cli.Command, error) { 399 return &JobEvalCommand{ 400 Meta: meta, 401 }, nil 402 }, 403 "job history": func() (cli.Command, error) { 404 return &JobHistoryCommand{ 405 Meta: meta, 406 }, nil 407 }, 408 "job init": func() (cli.Command, error) { 409 return &JobInitCommand{ 410 Meta: meta, 411 }, nil 412 }, 413 "job inspect": func() (cli.Command, error) { 414 return &JobInspectCommand{ 415 Meta: meta, 416 }, nil 417 }, 418 "job periodic": func() (cli.Command, error) { 419 return &JobPeriodicCommand{ 420 Meta: meta, 421 }, nil 422 }, 423 "job periodic force": func() (cli.Command, error) { 424 return &JobPeriodicForceCommand{ 425 Meta: meta, 426 }, nil 427 }, 428 "job plan": func() (cli.Command, error) { 429 return &JobPlanCommand{ 430 Meta: meta, 431 }, nil 432 }, 433 "job promote": func() (cli.Command, error) { 434 return &JobPromoteCommand{ 435 Meta: meta, 436 }, nil 437 }, 438 "job revert": func() (cli.Command, error) { 439 return &JobRevertCommand{ 440 Meta: meta, 441 }, nil 442 }, 443 "job run": func() (cli.Command, error) { 444 return &JobRunCommand{ 445 Meta: meta, 446 }, nil 447 }, 448 "job scale": func() (cli.Command, error) { 449 return &JobScaleCommand{ 450 Meta: meta, 451 }, nil 452 }, 453 "job scaling-events": func() (cli.Command, error) { 454 return &JobScalingEventsCommand{ 455 Meta: meta, 456 }, nil 457 }, 458 "job status": func() (cli.Command, error) { 459 return &JobStatusCommand{ 460 Meta: meta, 461 }, nil 462 }, 463 "job stop": func() (cli.Command, error) { 464 return &JobStopCommand{ 465 Meta: meta, 466 }, nil 467 }, 468 "job validate": func() (cli.Command, error) { 469 return &JobValidateCommand{ 470 Meta: meta, 471 }, nil 472 }, 473 "license": func() (cli.Command, error) { 474 return &LicenseCommand{ 475 Meta: meta, 476 }, nil 477 }, 478 "license get": func() (cli.Command, error) { 479 return &LicenseGetCommand{ 480 Meta: meta, 481 }, nil 482 }, 483 "logs": func() (cli.Command, error) { 484 return &AllocLogsCommand{ 485 Meta: meta, 486 }, nil 487 }, 488 "monitor": func() (cli.Command, error) { 489 return &MonitorCommand{ 490 Meta: meta, 491 }, nil 492 }, 493 "namespace": func() (cli.Command, error) { 494 return &NamespaceCommand{ 495 Meta: meta, 496 }, nil 497 }, 498 "namespace apply": func() (cli.Command, error) { 499 return &NamespaceApplyCommand{ 500 Meta: meta, 501 }, nil 502 }, 503 "namespace delete": func() (cli.Command, error) { 504 return &NamespaceDeleteCommand{ 505 Meta: meta, 506 }, nil 507 }, 508 "namespace inspect": func() (cli.Command, error) { 509 return &NamespaceInspectCommand{ 510 Meta: meta, 511 }, nil 512 }, 513 "namespace list": func() (cli.Command, error) { 514 return &NamespaceListCommand{ 515 Meta: meta, 516 }, nil 517 }, 518 "namespace status": func() (cli.Command, error) { 519 return &NamespaceStatusCommand{ 520 Meta: meta, 521 }, nil 522 }, 523 "node": func() (cli.Command, error) { 524 return &NodeCommand{ 525 Meta: meta, 526 }, nil 527 }, 528 "node config": func() (cli.Command, error) { 529 return &NodeConfigCommand{ 530 Meta: meta, 531 }, nil 532 }, 533 "node-drain": func() (cli.Command, error) { 534 return &NodeDrainCommand{ 535 Meta: meta, 536 }, nil 537 }, 538 "node drain": func() (cli.Command, error) { 539 return &NodeDrainCommand{ 540 Meta: meta, 541 }, nil 542 }, 543 "node eligibility": func() (cli.Command, error) { 544 return &NodeEligibilityCommand{ 545 Meta: meta, 546 }, nil 547 }, 548 "node-status": func() (cli.Command, error) { 549 return &NodeStatusCommand{ 550 Meta: meta, 551 }, nil 552 }, 553 "node status": func() (cli.Command, error) { 554 return &NodeStatusCommand{ 555 Meta: meta, 556 }, nil 557 }, 558 "operator": func() (cli.Command, error) { 559 return &OperatorCommand{ 560 Meta: meta, 561 }, nil 562 }, 563 564 "operator api": func() (cli.Command, error) { 565 return &OperatorAPICommand{ 566 Meta: meta, 567 }, nil 568 }, 569 570 "operator autopilot": func() (cli.Command, error) { 571 return &OperatorAutopilotCommand{ 572 Meta: meta, 573 }, nil 574 }, 575 576 "operator autopilot get-config": func() (cli.Command, error) { 577 return &OperatorAutopilotGetCommand{ 578 Meta: meta, 579 }, nil 580 }, 581 582 "operator autopilot set-config": func() (cli.Command, error) { 583 return &OperatorAutopilotSetCommand{ 584 Meta: meta, 585 }, nil 586 }, 587 "operator debug": func() (cli.Command, error) { 588 return &OperatorDebugCommand{ 589 Meta: meta, 590 }, nil 591 }, 592 593 // COMPAT(1.4.0): deprecated, remove in Nomad 1.5.0 594 // Note: we can't just put this in the DeprecatedCommand list 595 // because the flags have changed too. So we've provided the 596 // deprecation warning in the original command and when it's 597 // time to remove it we can remove the entire command 598 "operator keyring": func() (cli.Command, error) { 599 return &OperatorKeyringCommand{ 600 Meta: meta, 601 }, nil 602 }, 603 604 "operator gossip keyring": func() (cli.Command, error) { 605 return &OperatorGossipKeyringCommand{ 606 Meta: meta, 607 }, nil 608 }, 609 "operator gossip keyring install": func() (cli.Command, error) { 610 return &OperatorGossipKeyringInstallCommand{ 611 Meta: meta, 612 }, nil 613 }, 614 "operator gossip keyring use": func() (cli.Command, error) { 615 return &OperatorGossipKeyringUseCommand{ 616 Meta: meta, 617 }, nil 618 }, 619 "operator gossip keyring list": func() (cli.Command, error) { 620 return &OperatorGossipKeyringListCommand{ 621 Meta: meta, 622 }, nil 623 }, 624 "operator gossip keyring remove": func() (cli.Command, error) { 625 return &OperatorGossipKeyringRemoveCommand{ 626 Meta: meta, 627 }, nil 628 }, 629 "operator gossip keyring generate": func() (cli.Command, error) { 630 return &OperatorGossipKeyringGenerateCommand{ 631 Meta: meta, 632 }, nil 633 }, 634 635 "operator metrics": func() (cli.Command, error) { 636 return &OperatorMetricsCommand{ 637 Meta: meta, 638 }, nil 639 }, 640 "operator raft": func() (cli.Command, error) { 641 return &OperatorRaftCommand{ 642 Meta: meta, 643 }, nil 644 }, 645 646 "operator raft list-peers": func() (cli.Command, error) { 647 return &OperatorRaftListCommand{ 648 Meta: meta, 649 }, nil 650 }, 651 652 "operator raft remove-peer": func() (cli.Command, error) { 653 return &OperatorRaftRemoveCommand{ 654 Meta: meta, 655 }, nil 656 }, 657 "operator raft info": func() (cli.Command, error) { 658 return &OperatorRaftInfoCommand{ 659 Meta: meta, 660 }, nil 661 }, 662 "operator raft logs": func() (cli.Command, error) { 663 return &OperatorRaftLogsCommand{ 664 Meta: meta, 665 }, nil 666 }, 667 "operator raft state": func() (cli.Command, error) { 668 return &OperatorRaftStateCommand{ 669 Meta: meta, 670 }, nil 671 }, 672 "operator scheduler": func() (cli.Command, error) { 673 return &OperatorSchedulerCommand{ 674 Meta: meta, 675 }, nil 676 }, 677 "operator scheduler get-config": func() (cli.Command, error) { 678 return &OperatorSchedulerGetConfig{ 679 Meta: meta, 680 }, nil 681 }, 682 "operator scheduler set-config": func() (cli.Command, error) { 683 return &OperatorSchedulerSetConfig{ 684 Meta: meta, 685 }, nil 686 }, 687 "operator root keyring": func() (cli.Command, error) { 688 return &OperatorRootKeyringCommand{ 689 Meta: meta, 690 }, nil 691 }, 692 "operator root keyring list": func() (cli.Command, error) { 693 return &OperatorRootKeyringListCommand{ 694 Meta: meta, 695 }, nil 696 }, 697 "operator root keyring remove": func() (cli.Command, error) { 698 return &OperatorRootKeyringRemoveCommand{ 699 Meta: meta, 700 }, nil 701 }, 702 "operator root keyring rotate": func() (cli.Command, error) { 703 return &OperatorRootKeyringRotateCommand{ 704 Meta: meta, 705 }, nil 706 }, 707 "operator snapshot": func() (cli.Command, error) { 708 return &OperatorSnapshotCommand{ 709 Meta: meta, 710 }, nil 711 }, 712 "operator snapshot save": func() (cli.Command, error) { 713 return &OperatorSnapshotSaveCommand{ 714 Meta: meta, 715 }, nil 716 }, 717 "operator snapshot inspect": func() (cli.Command, error) { 718 return &OperatorSnapshotInspectCommand{ 719 Meta: meta, 720 }, nil 721 }, 722 "operator snapshot state": func() (cli.Command, error) { 723 return &OperatorSnapshotStateCommand{ 724 Meta: meta, 725 }, nil 726 }, 727 "operator snapshot restore": func() (cli.Command, error) { 728 return &OperatorSnapshotRestoreCommand{ 729 Meta: meta, 730 }, nil 731 }, 732 733 "plan": func() (cli.Command, error) { 734 return &JobPlanCommand{ 735 Meta: meta, 736 }, nil 737 }, 738 739 "plugin": func() (cli.Command, error) { 740 return &PluginCommand{ 741 Meta: meta, 742 }, nil 743 }, 744 "plugin status": func() (cli.Command, error) { 745 return &PluginStatusCommand{ 746 Meta: meta, 747 }, nil 748 }, 749 750 "quota": func() (cli.Command, error) { 751 return &QuotaCommand{ 752 Meta: meta, 753 }, nil 754 }, 755 756 "quota apply": func() (cli.Command, error) { 757 return &QuotaApplyCommand{ 758 Meta: meta, 759 }, nil 760 }, 761 762 "quota delete": func() (cli.Command, error) { 763 return &QuotaDeleteCommand{ 764 Meta: meta, 765 }, nil 766 }, 767 768 "quota init": func() (cli.Command, error) { 769 return &QuotaInitCommand{ 770 Meta: meta, 771 }, nil 772 }, 773 774 "quota inspect": func() (cli.Command, error) { 775 return &QuotaInspectCommand{ 776 Meta: meta, 777 }, nil 778 }, 779 780 "quota list": func() (cli.Command, error) { 781 return &QuotaListCommand{ 782 Meta: meta, 783 }, nil 784 }, 785 786 "quota status": func() (cli.Command, error) { 787 return &QuotaStatusCommand{ 788 Meta: meta, 789 }, nil 790 }, 791 792 "recommendation": func() (cli.Command, error) { 793 return &RecommendationCommand{ 794 Meta: meta, 795 }, nil 796 }, 797 "recommendation apply": func() (cli.Command, error) { 798 return &RecommendationApplyCommand{ 799 RecommendationAutocompleteCommand: RecommendationAutocompleteCommand{ 800 Meta: meta, 801 }, 802 }, nil 803 }, 804 "recommendation dismiss": func() (cli.Command, error) { 805 return &RecommendationDismissCommand{ 806 RecommendationAutocompleteCommand: RecommendationAutocompleteCommand{ 807 Meta: meta, 808 }, 809 }, nil 810 }, 811 "recommendation info": func() (cli.Command, error) { 812 return &RecommendationInfoCommand{ 813 RecommendationAutocompleteCommand: RecommendationAutocompleteCommand{ 814 Meta: meta, 815 }, 816 }, nil 817 }, 818 "recommendation list": func() (cli.Command, error) { 819 return &RecommendationListCommand{ 820 Meta: meta, 821 }, nil 822 }, 823 824 "run": func() (cli.Command, error) { 825 return &JobRunCommand{ 826 Meta: meta, 827 }, nil 828 }, 829 "scaling": func() (cli.Command, error) { 830 return &ScalingCommand{ 831 Meta: meta, 832 }, nil 833 }, 834 "scaling policy": func() (cli.Command, error) { 835 return &ScalingPolicyCommand{ 836 Meta: meta, 837 }, nil 838 }, 839 "scaling policy info": func() (cli.Command, error) { 840 return &ScalingPolicyInfoCommand{ 841 Meta: meta, 842 }, nil 843 }, 844 "scaling policy list": func() (cli.Command, error) { 845 return &ScalingPolicyListCommand{ 846 Meta: meta, 847 }, nil 848 }, 849 "sentinel": func() (cli.Command, error) { 850 return &SentinelCommand{ 851 Meta: meta, 852 }, nil 853 }, 854 "sentinel list": func() (cli.Command, error) { 855 return &SentinelListCommand{ 856 Meta: meta, 857 }, nil 858 }, 859 "sentinel apply": func() (cli.Command, error) { 860 return &SentinelApplyCommand{ 861 Meta: meta, 862 }, nil 863 }, 864 "sentinel delete": func() (cli.Command, error) { 865 return &SentinelDeleteCommand{ 866 Meta: meta, 867 }, nil 868 }, 869 "sentinel read": func() (cli.Command, error) { 870 return &SentinelReadCommand{ 871 Meta: meta, 872 }, nil 873 }, 874 "server": func() (cli.Command, error) { 875 return &ServerCommand{ 876 Meta: meta, 877 }, nil 878 }, 879 "server force-leave": func() (cli.Command, error) { 880 return &ServerForceLeaveCommand{ 881 Meta: meta, 882 }, nil 883 }, 884 "server join": func() (cli.Command, error) { 885 return &ServerJoinCommand{ 886 Meta: meta, 887 }, nil 888 }, 889 "server members": func() (cli.Command, error) { 890 return &ServerMembersCommand{ 891 Meta: meta, 892 }, nil 893 }, 894 "server-force-leave": func() (cli.Command, error) { 895 return &ServerForceLeaveCommand{ 896 Meta: meta, 897 }, nil 898 }, 899 "server-join": func() (cli.Command, error) { 900 return &ServerJoinCommand{ 901 Meta: meta, 902 }, nil 903 }, 904 "server-members": func() (cli.Command, error) { 905 return &ServerMembersCommand{ 906 Meta: meta, 907 }, nil 908 }, 909 "service": func() (cli.Command, error) { 910 return &ServiceCommand{ 911 Meta: meta, 912 }, nil 913 }, 914 "service list": func() (cli.Command, error) { 915 return &ServiceListCommand{ 916 Meta: meta, 917 }, nil 918 }, 919 "service info": func() (cli.Command, error) { 920 return &ServiceInfoCommand{ 921 Meta: meta, 922 }, nil 923 }, 924 "service delete": func() (cli.Command, error) { 925 return &ServiceDeleteCommand{ 926 Meta: meta, 927 }, nil 928 }, 929 "status": func() (cli.Command, error) { 930 return &StatusCommand{ 931 Meta: meta, 932 }, nil 933 }, 934 "stop": func() (cli.Command, error) { 935 return &JobStopCommand{ 936 Meta: meta, 937 }, nil 938 }, 939 "system": func() (cli.Command, error) { 940 return &SystemCommand{ 941 Meta: meta, 942 }, nil 943 }, 944 "system gc": func() (cli.Command, error) { 945 return &SystemGCCommand{ 946 Meta: meta, 947 }, nil 948 }, 949 "system reconcile": func() (cli.Command, error) { 950 return &SystemReconcileCommand{ 951 Meta: meta, 952 }, nil 953 }, 954 "system reconcile summaries": func() (cli.Command, error) { 955 return &SystemReconcileSummariesCommand{ 956 Meta: meta, 957 }, nil 958 }, 959 "tls": func() (cli.Command, error) { 960 return &TLSCommand{ 961 Meta: meta, 962 }, nil 963 }, 964 "tls ca": func() (cli.Command, error) { 965 return &TLSCACommand{ 966 Meta: meta, 967 }, nil 968 }, 969 "tls ca create": func() (cli.Command, error) { 970 return &TLSCACreateCommand{ 971 Meta: meta, 972 }, nil 973 }, 974 "tls ca info": func() (cli.Command, error) { 975 return &TLSCAInfoCommand{ 976 Meta: meta, 977 }, nil 978 }, 979 "tls cert": func() (cli.Command, error) { 980 return &TLSCertCommand{ 981 Meta: meta, 982 }, nil 983 }, 984 "tls cert create": func() (cli.Command, error) { 985 return &TLSCertCreateCommand{ 986 Meta: meta, 987 }, nil 988 }, 989 "tls cert info": func() (cli.Command, error) { 990 return &TLSCertInfoCommand{ 991 Meta: meta, 992 }, nil 993 }, 994 "ui": func() (cli.Command, error) { 995 return &UiCommand{ 996 Meta: meta, 997 }, nil 998 }, 999 "validate": func() (cli.Command, error) { 1000 return &JobValidateCommand{ 1001 Meta: meta, 1002 }, nil 1003 }, 1004 "var": func() (cli.Command, error) { 1005 return &VarCommand{ 1006 Meta: meta, 1007 }, nil 1008 }, 1009 "var purge": func() (cli.Command, error) { 1010 return &VarPurgeCommand{ 1011 Meta: meta, 1012 }, nil 1013 }, 1014 "var init": func() (cli.Command, error) { 1015 return &VarInitCommand{ 1016 Meta: meta, 1017 }, nil 1018 }, 1019 "var list": func() (cli.Command, error) { 1020 return &VarListCommand{ 1021 Meta: meta, 1022 }, nil 1023 }, 1024 "var put": func() (cli.Command, error) { 1025 return &VarPutCommand{ 1026 Meta: meta, 1027 }, nil 1028 }, 1029 "var get": func() (cli.Command, error) { 1030 return &VarGetCommand{ 1031 Meta: meta, 1032 }, nil 1033 }, 1034 "version": func() (cli.Command, error) { 1035 return &VersionCommand{ 1036 Version: version.GetVersion(), 1037 Ui: meta.Ui, 1038 }, nil 1039 }, 1040 "volume": func() (cli.Command, error) { 1041 return &VolumeCommand{ 1042 Meta: meta, 1043 }, nil 1044 }, 1045 "volume init": func() (cli.Command, error) { 1046 return &VolumeInitCommand{ 1047 Meta: meta, 1048 }, nil 1049 }, 1050 "volume status": func() (cli.Command, error) { 1051 return &VolumeStatusCommand{ 1052 Meta: meta, 1053 }, nil 1054 }, 1055 "volume register": func() (cli.Command, error) { 1056 return &VolumeRegisterCommand{ 1057 Meta: meta, 1058 }, nil 1059 }, 1060 "volume deregister": func() (cli.Command, error) { 1061 return &VolumeDeregisterCommand{ 1062 Meta: meta, 1063 }, nil 1064 }, 1065 "volume detach": func() (cli.Command, error) { 1066 return &VolumeDetachCommand{ 1067 Meta: meta, 1068 }, nil 1069 }, 1070 "volume create": func() (cli.Command, error) { 1071 return &VolumeCreateCommand{ 1072 Meta: meta, 1073 }, nil 1074 }, 1075 "volume delete": func() (cli.Command, error) { 1076 return &VolumeDeleteCommand{ 1077 Meta: meta, 1078 }, nil 1079 }, 1080 "volume snapshot": func() (cli.Command, error) { 1081 return &VolumeSnapshotCommand{ 1082 Meta: meta, 1083 }, nil 1084 }, 1085 "volume snapshot create": func() (cli.Command, error) { 1086 return &VolumeSnapshotCreateCommand{ 1087 Meta: meta, 1088 }, nil 1089 }, 1090 "volume snapshot delete": func() (cli.Command, error) { 1091 return &VolumeSnapshotDeleteCommand{ 1092 Meta: meta, 1093 }, nil 1094 }, 1095 "volume snapshot list": func() (cli.Command, error) { 1096 return &VolumeSnapshotListCommand{ 1097 Meta: meta, 1098 }, nil 1099 }, 1100 } 1101 1102 deprecated := map[string]cli.CommandFactory{ 1103 "client-config": func() (cli.Command, error) { 1104 return &DeprecatedCommand{ 1105 Old: "client-config", 1106 New: "node config", 1107 Meta: meta, 1108 Command: &NodeConfigCommand{ 1109 Meta: meta, 1110 }, 1111 }, nil 1112 }, 1113 1114 "keygen": func() (cli.Command, error) { 1115 return &DeprecatedCommand{ 1116 Old: "keygen", 1117 New: "operator gossip keyring generate", 1118 Meta: meta, 1119 Command: &OperatorGossipKeyringGenerateCommand{ 1120 Meta: meta, 1121 }, 1122 }, nil 1123 }, 1124 1125 "operator keygen": func() (cli.Command, error) { 1126 return &DeprecatedCommand{ 1127 Old: "operator keygen", 1128 New: "operator gossip keyring generate", 1129 Meta: meta, 1130 Command: &OperatorGossipKeyringGenerateCommand{ 1131 Meta: meta, 1132 }, 1133 }, nil 1134 }, 1135 1136 "keyring": func() (cli.Command, error) { 1137 return &DeprecatedCommand{ 1138 Old: "keyring", 1139 New: "operator gossip keyring", 1140 Meta: meta, 1141 Command: &OperatorKeyringCommand{ 1142 Meta: meta, 1143 }, 1144 }, nil 1145 }, 1146 1147 "server-force-leave": func() (cli.Command, error) { 1148 return &DeprecatedCommand{ 1149 Old: "server-force-leave", 1150 New: "server force-leave", 1151 Meta: meta, 1152 Command: &ServerForceLeaveCommand{ 1153 Meta: meta, 1154 }, 1155 }, nil 1156 }, 1157 1158 "server-join": func() (cli.Command, error) { 1159 return &DeprecatedCommand{ 1160 Old: "server-join", 1161 New: "server join", 1162 Meta: meta, 1163 Command: &ServerJoinCommand{ 1164 Meta: meta, 1165 }, 1166 }, nil 1167 }, 1168 1169 "server-members": func() (cli.Command, error) { 1170 return &DeprecatedCommand{ 1171 Old: "server-members", 1172 New: "server members", 1173 Meta: meta, 1174 Command: &ServerMembersCommand{ 1175 Meta: meta, 1176 }, 1177 }, nil 1178 }, 1179 } 1180 1181 for k, v := range deprecated { 1182 all[k] = v 1183 } 1184 1185 for k, v := range EntCommands(metaPtr, agentUi) { 1186 all[k] = v 1187 } 1188 1189 return all 1190 }