#1159 Haystack CLI tool and libraries

Christopher Andronikos Tue 13 May

Overview

As far as I'm aware, utilities for interacting with zinc or SkySpark native data do not exist. This project aims to fill that gap by providing a suite of tools inspired by the GNU/Linux ecosystem. These tools enable remote access, data reads and writes, and efficient data wrangling of supported data formats.

Users familiar with Linux shells will find it easy to connect to Haystack servers with the same convenience as ssh or mosh, and chain multiple CLI calls without needing to open a browser.

Full details can be found on the project page at candronikos.com. This is a live document that will be updated with the library.

Source code can be found on Github.

Sub crates

haystack-client (CLI)

Command line utility for interacting with a haystack server and supporting SkySpark-specific REST calls. The CLI also includes a repl.

Usage

# Reuse haystack bearer token
( # () Opens a sub-shell
  export HAYSTACK_AUTH_CONFIG=`hs default auth`;

  # Destination does not need to be included if the environment variable
  # HAYSTACK_AUTH_CONFIG is set.

  # I also set up my .bashrc to use the alias "hs" instead of the full name.
  # Stick with `haystack-client` if you haven't configured your .bashrc this way
  hs read --filter "point" --limit=1

  # Example below of correct character escaping in bash shell when passing
  # filters enclosed by either single or double quotes.
  hs read --filter 'point and unit==\"kWh\" and equipRef->siteRef'
  hs read --filter "point and unit==\\\"kWh\\\" and equipRef->siteRef"
)

# Read–eval–print loop (REPL) You will see the prompt "hs〉"
# To learn about the $DEST argument, see the configuration section below.
haystack-client $DEST repl
hs〉about

# About
haystack-client $DEST about

Configuration

# identifier used as $DEST in command line
name: default
url: https://localhost/api/demo
username: superUser
password: accountPassword
# Set to true in my case. Should be false in production
accept-invalid-certs: true

Supported REST Operations

All standard Haytack ops except pointWrite and invokeAction. It's a work in progress.

haystack-client (Library)

The underlying API library implementing an asynchronous haystack client. API may change and will be documented further once finalised.

haystack-types

Rust-native implementations of haystack data types as well as zinc parsers for each type enabling interactivity with haystack servers.

Conclusion

This project is actively being developed, and support will continue to improve over time. You may download or build the source code, via the repository on Github.

Brian Frank Tue 13 May

This is awesome Christopher. I'm going to add a link to the downloads page. But I'm going to use the GitHub link. I'd recommend you add hyperlink in your readme.md to your project page that has all the details.

Christopher Andronikos Tue 13 May

Thanks for the feedback! I'll update the readme from github as suggested.

Christopher Andronikos Wed 14 May

To save you the trouble of building from source, binaries for windows and linux (built on ubuntu) can be downloaded from the releases page here.

Login or Signup to reply.