github.com/hernad/nomad@v1.6.112/command/event.go (about)

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