github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/command/event.go (about) 1 package command 2 3 import ( 4 "strings" 5 6 "github.com/mitchellh/cli" 7 ) 8 9 var _ cli.Command = &EventCommand{} 10 11 type EventCommand struct { 12 Meta 13 } 14 15 // Help should return long-form help text that includes the command-line 16 // usage, a brief few sentences explaining the function of the command, 17 // and the complete list of flags the command accepts. 18 func (e *EventCommand) Help() string { 19 helpText := ` 20 Usage: nomad event <subcommand> [options] [args] 21 22 This command groups subcommands for interacting with Nomad event sinks. 23 Nomad's event sinks system can be used to subscribe to the event stream for 24 events that match specific topics. 25 26 Register or update an event sink: 27 28 $ cat sink.json 29 { 30 "ID": "my-sink", 31 "Type": "webhook", 32 "Address": "http://127.0.0.1:8080", 33 "Topics": { 34 "*": ["*"] 35 } 36 } 37 $ nomad event sink register sink.json 38 Successfully registered "my-sink" event sink! 39 40 List event sinks: 41 42 $ nomad event sink list 43 ID Type Address Topics LatestIndex 44 my-sink webhook http://127.0.0.1 *[*] 0 45 46 Deregister an event sink: 47 48 $ nomad event sink deregister my-sink 49 Successfully deregistered "my-sink" event sink! 50 51 Please see the individual subcommand help for detailed usage information. 52 ` 53 return strings.TrimSpace(helpText) 54 } 55 56 func (e *EventCommand) Run(args []string) int { 57 return cli.RunResultHelp 58 } 59 60 func (e *EventCommand) Synopsis() string { 61 return "Interact with event sinks" 62 }