From d76340f0f7e7b44ad8ecb2b10cfc9bc710c940de Mon Sep 17 00:00:00 2001 From: Drew Bailey <2614075+drewbailey@users.noreply.github.com> Date: Fri, 4 Dec 2020 12:04:58 -0500 Subject: [PATCH] fix allocation spelling error, update docs (#9527) * fix allocation spelling error, update docs * assign TopicACLPolicy and TopicACLToken properly --- nomad/structs/event.go | 6 +++--- website/pages/api-docs/events.mdx | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/nomad/structs/event.go b/nomad/structs/event.go index e1583112b..b18ed388b 100644 --- a/nomad/structs/event.go +++ b/nomad/structs/event.go @@ -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" diff --git a/website/pages/api-docs/events.mdx b/website/pages/api-docs/events.mdx index e3bb61d8a..1f39ad545 100644 --- a/website/pages/api-docs/events.mdx +++ b/website/pages/api-docs/events.mdx @@ -8,10 +8,7 @@ description: |- # Events HTTP API Beta -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 @@ -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` | @@ -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 @@ -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" \