Skip to content

Commit

Permalink
fix allocation spelling error, update docs (#9527)
Browse files Browse the repository at this point in the history
* fix allocation spelling error, update docs

* assign TopicACLPolicy and TopicACLToken properly
  • Loading branch information
drewbailey authored Dec 4, 2020
1 parent 574868b commit d76340f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions nomad/structs/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ type Topic string
const (
TopicDeployment Topic = "Deployment"
TopicEvaluation Topic = "Evaluation"
TopicAllocation Topic = "Allococation"
TopicAllocation Topic = "Allocation"
TopicJob Topic = "Job"
TopicNode Topic = "Node"
TopicACLPolicy Topic = "ACLToken"
TopicACLToken Topic = "ACLPolicy"
TopicACLPolicy Topic = "ACLPolicy"
TopicACLToken Topic = "ACLToken"
TopicAll Topic = "*"

TypeNodeRegistration = "NodeRegistration"
Expand Down
18 changes: 12 additions & 6 deletions website/pages/api-docs/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ description: |-

# Events HTTP API <sup>Beta</sup>

The `/event` endpoints are used to stream events and manage event sinks. Event
sinks allow for operators to configure a sink (such as a webhook). Nomad will
subscribe to the event stream with the configured sinks topics and send events
to the sink in near real time.
The `/event/stream` endpoint is used to stream events generated by Nomad.

## Event Stream

Expand All @@ -26,6 +23,9 @@ The stream will be kept alive until the connection is closed.
The table below shows this endpoint's [required ACLs](/api-docs#acls). Due to
the nature of this endpoint individual topics require specific policies.

Note that if you do not include a `topic` parameter all topics will be included
by default, requiring a management token.

| Topic | ACL Required |
| ------------ | -------------------- |
| `*` | `management` |
Expand All @@ -43,8 +43,12 @@ the nature of this endpoint individual topics require specific policies.
the requested index is no longer in the buffer the stream will start at the
next available index.

- `namespace` `(string: "default")` - Specifies the target namespace to filter
on. Specifying `*` includes all namespaces for event types that support
namespaces.

- `topic` `(topic:filter_key: "*:*")` - Specifies a topic to subscribe to and
filter on. The default is to subscrive to all topics. Multiple topics may be
filter on. The default is to subscribe to all topics. Multiple topics may be
specified by passing multiple `topic` parameters. A valid topic parameter
includes a `topic` type and an optional `filter_key` separated by a colon
`:`. As an example `?topic=Deployment:redis` would subscribe to all
Expand Down Expand Up @@ -95,15 +99,17 @@ the nature of this endpoint individual topics require specific policies.
### Sample Request

```shell-session
# Subscribe to all events and topics
$ curl -s -v -N http://127.0.0.1:4646/v1/event/stream
```

```shell-session
# Start at index 100 and subscribe to all Evaluation events
$ curl -s -v -N http://127.0.0.1:4646/v1/event/stream?index=100&topic=Evaluation
```

```shell-session
$ curl -s -v -N \
$ curl -G -s -v -N \
--data-urlencode "topic=Node:ccc4ce56-7f0a-4124-b8b1-a4015aa82c40" \
--data-urlencode "topic=Deployment" \
--data-urlencode "topic=Job:web" \
Expand Down

0 comments on commit d76340f

Please sign in to comment.