9 releases (4 breaking)

Uses old Rust 2015

0.4.0 Dec 21, 2017
0.3.1 Dec 15, 2017
0.3.0 Nov 21, 2017
0.2.1 Nov 13, 2017
0.0.1 Nov 5, 2017

#37 in #cli-client

22 downloads per month

MIT license

47KB
942 lines

nakacli

Build Status Released Version

CLI Client for Nakadi - Cross-platform, no-dependency minimal CLI for interacting with Nakadi

Install

macOS

brew install amrhassan/macosapps/nakacli

Ubuntu

snap install --edge nakacli

Arch Linux

yaourt -S nakacli-bin   # Or substitute with your favorite AUR helper

Other Platforms

nakacli compiles into a single executable binary with no extra runtime dependencies, so find the latest release in releases and run it however you run binaries on your operating system.

Features

  • Metrics querying
  • Zign authentication
  • Event type creation
  • Even type deletion
  • Publishing events
  • Stream published events of a certain type
  • Creating subscriptions
  • Stream-listening on events from a subscription

Usage

Commands

nakacli event publish [FLAGS] [OPTIONS] <event-type> <json-body>

Publishes one or more events of the type <event-type>. The <json-body> can be the full body of a single event as a JSON object, or a JSON array containing an object for each event to be published.

You can specify a file path to read the event body from by passing @FILEPATH as the <json-body> value.

Data Change events

To publish a Data Change event, you'll have to provide one of the options: --data-create, --data-update, --data-delete, or --data-snapshot, otherwise your command will not be, accepted by the Nakadi server.

Business events To publish a Business event, you'll have to provide the --business option, otherwise your command will not be accepted by the Nakadi server.

nakacli event stream [FLAGS] [OPTIONS] <event-type>

Starts streaming published events of type <event-type> to STDOUT. It should block while it's streaming published events until it is interrupted by the user, or it has consumed N number of events where N is provide by the --take=N option.

nakacli event-type create [FLAGS] [OPTIONS] <owning-application> <name> <json-schema>

Creates an event type with the given parameters. Optionally accepts a --partition-strategy=hash param, with which you'll have to specify one or more --partition-key-field to indicate the fields to be used in computing the partitioning hash. Compatibility mode for created event type can be specified using the --compatibility-mode option.

You can specify a file path to read the JSON Schema from by passing @FILEPATH as the <json-schema> value.

nakacli event-type delete [FLAGS] [OPTIONS] <name>

Deletes the event-type with the specified <name>.

nakacli event-type list [FLAGS] [OPTIONS]

Lists all the registered available event-types (most likely a lot of output, prepare to pipe it to less. Also the --pretty flag might make it more human-readable if you're interested in reading it.)

nakacli metrics [FLAGS] [OPTIONS]

Prints the Nakadi server metrics.

Global options/flags

--bearer-token <TOKEN> and --zign

For any command, you can specify a Bearer token via the --bearer-token <TOKEN> option or the BEARER_TOKEN environment variable.

If you have Zign set up, you can use it by simply passing the --zign flag.

--url <NAKADI_URL>

Specifies the URL to the Nakadi server in the format scheme://[auth:]hostname:[port]. It can also be set via the NAKADI_URL environment variable.

--pretty

Makes JSON output properly-indented for easier human readability.

--network-timeout <network-timeout>

Specifies the network timeout for non-streaming operations in seconds (default value: 1).

More

Check nakacli help for a full list of all the supported commands, and nakacli COMMAND --help for their options, flags and arguments.

Dependencies

~12–21MB
~281K SLoC