You can use this program to interact easily with EdgeStack backend. This program behaves just like every other Unix CLI program: prints the main output in stdout and the errors in stderr. The program prints the events in realtime and returns the result when the process is finished an a synchronous way. Inputs are taken in stdin and expected as one-line JSON messages.
Under the hood we use HTTP and socket-io (websockets) to catch events in realtime from the backend. Feel free to reproduce and port this program in your favourite programming language or just spawn it using your favourite I/O library!
Also, the program supports two types of authentication:
- Consumer API key based: this allows you to call the backend, you should use this in cases where CLI program runs in your own environment
- Secret API key based: this allows you to call the backend but this is used just in Netter internal procedures
You can find compiled executables here:
- Windows x64:
- Linux x64:
- MacOS x64:
You can create a shortcut to call the CLI utility using netter. You should move the downloaded file to:
- Linux and MacOS:
sudo mv <file> /usr/local/bin/netter && sudo chmod +x /usr/local/bin/netter - Windows:
sudo mv <file> /usr/local/bin/netter && sudo chmod +x /usr/local/bin/netter
Now run: netter on your terminal to use the program.
In order to compile this project, install these software using your OS-specific package managers/installers:
node.js: https://nodejs.org/it/jq: https://stedolan.github.io/jq/download/
Tips:
- You should pipe the output to
jqfor better visualization of the query result, appending| jq '.'to your command.
Then go into the root folder of this project and execute:
npm inpm run compile
First, you should setup as environment variables:
- your
TENANT_FQDN_NAME(for example: yourcompany.cloudprovider.com) - your
CONSUMER_API_KEY(optional)
You can set them up session-related environment variables:
- on Linux and MacOS, using
export NAME=VALUE - on Windows, using
setx NAME "VALUE"
Tenant name is required while consumer API key can be undefined. In that case, the interactive authentication will be required. The interactive JWT-based authentication requires credentials and token, that can be passed:
- to stdin in an interactive way
- to
<options>as a parameter
However using this program with a CONSUMER_API_KEY is strongly recommended and this is the procedure to obtain it using this CLI program:
Type on the terminal: netter api login
When asked type:
- username
- password
- domain (if any)
Type: netter api users get me | jq '.' and copy consumer_api_key value. Set it as environment variable as above.
Syntax: <program> <options> <service> <entity> <query> <params>
Examples:
<program>:/usr/local/bin/netteror simplynetter<options>: (optional)--username john --token 1214215<service>:apiors3<entity>:usersorenterprises<query>:getorgetByIdorsetorcreateordelete<params>:all business_sector=financial active=trueor<uuidv4>
Lookup the service manual by executing: <executable> <service> help
Supported service are:
api
Copyright (C) 2021 Netter srl
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
