The NGSI Go is a command-line interface supporting FIWARE Open APIs for FIWARE developers.
Contents
Details
What is NGSI Go?
"Brave (hero), bearer of the blood of Erdrick, hero of legend! Know that your weapon will not
serve to vanquish the Dragonload."
— DRAGON WARRIOR (DRAGON QUEST)
The NGSI Go is a command-line interface supporting FIWARE Open APIs, which simplifies syntax.
It's a powerful tool and easy to use. It has various features as shown:
- Supported FIWARE Open APIs
- Various convenience commands
- NGSI commands to manage NGSI Entity, subscription, registration and so on
- Time series commands to manage historical data
- IoT Agent commands to manage IoT Agent Provision APIs
- Rules commands to manage Context-Aware CEP
- Convenience commands
- Print version, health-check status and API lists of FIWARE GEs
- Admin command for FIWARE Orion
- Copy and remove entities at once
- Create template of subscription or registration
- Notification receiver
- Management commands
- Broker alias or server alias with API endpoint URL, FIWARE Service and FIWARE ServicePath
- Manage @context
- Integrated oauth token management
- Compatible with a number of traditional UNIX commands for filtering text
- A single binary program written in Golang
Getting Started with NGSI Go
You register an alias to access the broker.
ngsi broker add --host letsfiware --brokerHost http://localhost:1026 --ngsiType v2
You can get the version by using the alias letsfiware
.
ngsi version -h letsfiware
{
"orion" : {
"version" : "3.0.0",
"uptime" : "0 d, 0 h, 17 m, 19 s",
"git_hash" : "d6f8f4c6c766a9093527027f0a4b3f906e7f04c4",
"compile_time" : "Mon Apr 12 14:48:44 UTC 2021",
"compiled_by" : "root",
"compiled_in" : "f307ca0746f5",
"release_date" : "Mon Apr 12 14:48:44 UTC 2021",
"machine" : "x86_64",
"doc" : "https://fiware-orion.rtfd.io/en/3.0.0/",
"libversions": {
"boost": "1_66",
"libcurl": "libcurl/7.61.1 OpenSSL/1.1.1g zlib/1.2.11 nghttp2/1.33.0",
"libmicrohttpd": "0.9.70",
"openssl": "1.1",
"rapidjson": "1.1.0",
"mongoc": "1.17.4",
"bson": "1.17.4"
}
}
}
Once you access the broker, you can omit to specify the broker.
ngsi version
If you want to check the current settings, you can run the following command.
ngsi settings list
Usage
NAME:
ngsi - command-line tool for FIWARE NGSI and NGSI-LD
USAGE:
ngsi [global options] command [command options] [arguments...]
VERSION:
0.8.0 (git_hash:995c1cec43797999a40ed6b686985dbdd0b2afcc)
COMMANDS:
help, h Shows a list of commands or help for one command
CONVENIENCE:
admin admin command for FIWARE Orion, Cygnus, Perseo, Scorpio
apis print endpoints of API
cp copy entities
wc print number of entities, subscriptions, registrations or types
man print urls of document
health print health status
ls list entities
rm remove entities
receiver notification receiver
template create template of subscription or registration
version print the version
Context-Aware CEP:
rules rules command for PERSEO
IoT Agent:
devices manage devices for IoT Agent
services manage services for IoT Agent
Keyrock:
applications manage applications for Keyrock
users manage users for Keyrock
organizations manage organizations for Keyrock
providers print service providers for Keyrock
MANAGEMENT:
broker manage config for broker
context manage @context
settings manage settings
server manage config for server
token manage token
NGSI:
append append attributes
create create entity(ies), subscription or registration
delete delete entity(ies), attribute, subscription or registration
get get entity(ies), attribute(s), subscription, registration or type
list list types, entities, subscriptions or registrations
replace replace entities or attributes
update update entities, attribute(s) or subscription
upsert upsert entity or entities
PERSISTING CONTEXT DATA:
namemappings manage namemappings for Cygnus
groupingrules manage groupingrules for Cygnus
TIME SERIES:
hdelete delete historical raw and aggregated time series context information
hget get historical raw and aggregated time series context information
GLOBAL OPTIONS:
--syslog LEVEL specify logging LEVEL (off, err, info, debug)
--stderr LEVEL specify logging LEVEL (off, err, info, debug)
--config FILE specify configuration FILE
--cache FILE specify cache FILE
--batch, -B don't use previous args (batch) (default: false)
--help show help (default: false)
--version, -v print the version (default: false)
COPYRIGHT:
(c) 2020-2021 Kazuhito Suda
Tutorial
You can try the tutorial to understand how to use the NGSI Go.
You need a environment running Docker engine and docker-compose.
Install
Install NGSI Go binary
The NGSI Go binary is installed in /usr/local/bin
.
Installation on Linux
curl -OL https://github.com/lets-fiware/ngsi-go/releases/download/v0.8.0/ngsi-v0.8.0-linux-amd64.tar.gz
sudo tar zxvf ngsi-v0.8.0-linux-amd64.tar.gz -C /usr/local/bin
ngsi-v0.8.0-linux-arm.tar.gz
and ngsi-v0.8.0-linux-arm64.tar.gz
binaries are also available.
Installation on Mac
curl -OL https://github.com/lets-fiware/ngsi-go/releases/download/v0.8.0/ngsi-v0.8.0-darwin-amd64.tar.gz
sudo tar zxvf ngsi-v0.8.0-darwin-amd64.tar.gz -C /usr/local/bin
ngsi-v0.8.0-darwin-arm64.tar.gz
binary is also available.
Install bash autocomplete file for NGSI Go
Install ngsi_bash_autocomplete file in /etc/bash_completion.d
.
curl -OL https://raw.githubusercontent.com/lets-fiware/ngsi-go/main/autocomplete/ngsi_bash_autocomplete
sudo mv ngsi_bash_autocomplete /etc/bash_completion.d/
source /etc/bash_completion.d/ngsi_bash_autocomplete
echo "source /etc/bash_completion.d/ngsi_bash_autocomplete" >> ~/.bashrc
Third party packages
The NGSI Go makes use of the following package:
The dependencies of dependencies have been omitted from the list.
Copyright and License
Copyright (c) 2020-2021 Kazuhito Suda
Licensed under the MIT License.