https://github.com/jerakia/jerakia-client
CLI and Ruby client library for Jerakia Server
https://github.com/jerakia/jerakia-client
Last synced: 8 months ago
JSON representation
CLI and Ruby client library for Jerakia Server
- Host: GitHub
- URL: https://github.com/jerakia/jerakia-client
- Owner: jerakia
- License: apache-2.0
- Created: 2016-12-11T11:06:46.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-15T09:58:08.000Z (almost 9 years ago)
- Last Synced: 2025-01-08T00:58:45.820Z (over 1 year ago)
- Language: Ruby
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# jerakia-client
## Description
A ruby client library and CLI for integrating with Jerakia Server (Jerakia 1.2.0+)
For more details on Jerakia Server please see [The official Jerakia site](http://jerakia.io)
This client is for use with Jerakia Server, which ships in 1.2.0, it does not integrate with Jerakia 1.1 or below
## Usage
### Command line
```
Usage:
jerakia-client lookup [KEY]
Options:
H, [--host=HOST] # Hostname or IP to connect to
P, [--port=PORT] # Port to connect to
T, [--token=TOKEN] # Token to use for authorization, if not provided a jerakia.yaml will be searched for (see docs)
a, [--api=API] # API Version to implement (see docs)
p, [--policy=POLICY] # Lookup policy
# Default: default
n, [--namespace=NAMESPACE] # Lookup namespace
t, [--type=TYPE] # Lookup type
# Default: first
s, [--scope=SCOPE] # Scope handler
# Default: metadata
[--scope-options=key:value] # Key/value pairs to be passed to the scope handler
m, [--merge-type=MERGE_TYPE] # Merge type
# Default: array
v, [--verbose], [--no-verbose] # Print verbose information
D, [--debug], [--no-debug] # Debug information to console, implies --log-level debug
o, [--output=OUTPUT] # Output format, yaml, json or msgpack
# Default: json
c, [--content_type=TYPE] # Content type, json or msgpack
# Default: json
Lookup [KEY] with Jerakia
```
It is possible to set some of the global settings in the `jerakia.yaml` config file:
```
$ cat ~/.jerakia/jerakia.yaml
---
client:
token: 'test:bcb4ed451b890d62b7784058ecf75e225c490eef62073a3089f1cbd9db50f9034630b33c7ca06b80'
host: 'localhost'
port: 9992
api: 'v1'
proto: 'http'
content_type: 'msgpack'
```
### Ruby bindings
#### `Jeraia::Client.new`
Initiate a new client instance.
```
client = Jerakia::Client.new(opts)
```
Options can be given as a hash of:
* `host`: Hostname or IP to connect to (default localhost)
* `port`: Port to connect to (default 9843)
* `api`: The Jerakia Server API version impemented on the server (default v1)
* `proto`: The protocol to use, `http` or `https` are supported, `http` is the default.
* `token`: The authentication token to use in the request, if no token is specified jerakia-client will look for a `jerakia.yaml` file in `/etc/jerakia` and `~/.jerakia` for a key called `client_token`
#### Instance methods
Once initiated the client can be used with the following instance methods
##### lookup(key, params)
```
client.lookup("port", { :namespace => 'apache' })
```
`params` is a hash of all of the options specified in the Jerakia Server API for the `/v1/lookup` endpoint
## LICENSE
This software is licensed under the Apache 2.0 license, please see the `LICENSE` file for full details
## Author
Written and maintained by Craig Dunn