Releases: reubenmiller/go-c8y-cli
Cumulocity CLI 2.6.2
Cumulocity CLI 2.6.1
Changelog
Fixes
c8y util repeat
: fixes handling of random min and max delays (#100)
- fix handling of random min and max delay flags to be respected even if they are equal
--randomDelayMax
can be used without having to set--randomDelayMin
Examples
$ echo "test" | c8y util repeat 5 --randomDelayMax 10000ms -v
# Print "test" 5 times waiting between 0s and 10s after each line
$ echo "test" | c8y util repeat 5 --randomDelayMin 5s -v
# Print "test" 5 times waiting exactly 5 seconds after each line
Cumulocity CLI 2.6.0
Changelog
New Commands
c8y util repeatfile
#98
- Iterator over each line of a file X number of times
- Loop over file contents forever using
--infinite
flag which is useful for generating large amounts of data
Examples
$ c8y util repeatfile myfile.txt
Repeat each line of the file contents
$ c8y util repeatfile myfile.txt --times 2
Loop over the file twice. The file contents will be outputed from first list to last line, then read again.
$ c8y util repeatfile myfile.txt --infinite --delay 500ms
Loop over the file contents forever and delaying 500ms after each line is printed
$ c8y util repeatfile *.list --randomSkip 0.5
Loop over the files matching the "*.list" in the current directory (uses shell expansion), but randomly
skip lines at a probability of 50 percent.
Improvements/Changes
c8y template execute
support non-json output #99
Support for non-json output which allows more use-cases to generate output using the extensive jsonnet templating language.
Examples
# Generate random integer
$ c8y template execute --template "_.Int(10,20)"
14
# Use to get relative date times using go-c8y-cli functions
$ c8y template execute --template "_.Now('-30d')"
2021-12-23T21:15:59.618Z
# Create ini format
$ c8y template execute --template "std.manifestIni({sections: {main: {one:1,two:'2'}}})"
[main]
one = 1
two = 2
c8y util repeat
improvements #97
- add
--infinite
flag to create a never ending repeater --randomDelayMin
and--randomDelayMax
flags now support duration syntax, e.g. 10ms, 10s, 1m. If no unit is supplied then it assumes milliseconds- empty input is now passed down the pipeline instead of being ignored
# Following produces 10 lines c8y util repeat 10 | wc -l # Send the same request 10 times waiting 1 second after each request c8y util repeat 10 | c8y api --url /inventory/managedObjects --delay 1s
c8y firmware versions install
#96
-
Added support for
--description
flag. By default the description will be automatically generated in the following format:# If a version is specified Install firmware: "{name}" ({version}) # With an empty version Install firmware: "{name}"
-
Url field is automatically added if the matching firmware name/version is found in the Cumulocity firmware repository
# Create a firmware and version c8y firmware create --name iot-linux | c8y firmware versions create --version 1.0.0 --url "https://example.com/image.tar.gz" # Install the firmware by referencing name/version c8y firmware versions install --device 12345 --firmware iot-linux --version 1.0.0
The above
c8y firmware versions install
command produces the following operation body:// POST /devicecontrol/operations { "c8y_Firmware": { "name": "iot-linux", "url": "https://example.com/image.tar.gz", "version": "1.0.0" }, "description": "Update firmware to: \"iot-linux\" (1.0.0)", "deviceId": "12345" }
c8y software versions install
#96
- Ignore software version lookup when software, version and url are provided
c8y configuration list
-
added
--configurationType <string>
flag to filter by configuration typec8y configuration list --configurationType "AGENT_CONFIG" # => Cumulocity inventory query # => GET /inventory/managedObjects?query=$filter=(type eq 'c8y_ConfigurationDump') and (configurationType eq 'AGENT_CONFIG') $orderby=name
Cumulocity CLI 2.5.2
Changelog
Fix
- build: fix publishing of linuxbrew artifact
Cumulocity CLI 2.5.1
Cumulocity CLI 2.5.0
Changelog
Bugfixes
c8y software/firmware
Fix software management examples (#88)c8y software versions install
Allow empty version field (#83)
Features
- Support duration in days for
cacheTTL
option and subscribe commands. Previously only h, m, s and ms were supported (#88) - Add support for template and data parameters in software version install/uninstall and firmware version install (#84)
Build
- Only publish Debian package to stable distribution
- Fix homebrew publishing (#86)
Docs
- Fix asciinema iframe links
- Update online doc dependencies
- Update installation instructions to use new repositories
- Add missing quote when setting up zsh shell profile (#82)
Cumulocity CLI 2.4.5
Changelog
Bugfixes
Removed brackets around queryTemplate input string (#81)
Fix bug where the piped input to a query was being wrapped with braces (<input>)
.
Example
echo "c8y_Linux" | c8y devices list --queryTemplate "type eq '%s'" --dry
# Incorrect query with extra brackets
# => /inventory/managedObjects?q=$filter=type eq '(c8y_Linux)' $orderby=name
# Corrected query
# => /inventory/managedObjects?q=$filter=type eq 'c8y_Linux' $orderby=name
Affected Commands
The following command were affected by the bug when the --queryTemplate
option was used.
c8y agents list
c8y devices list
c8y devicegroups list
c8y smartgroups list
Cumulocity CLI 2.4.4
Changelog
Bug fixes
Support multiline matching with filter operators match
and like
Example
input.json
Some multi line json input (or response from c8y) which contains newline chars \n
{"failureReason": "some\ncomplex\nmultiline\njson"}
Then it can be filtered using the --filter
parameter.
cat input.json | c8y util show --filter "failureReason like *complex*" -o json
Cumulocity CLI 2.4.0
Breaking Changes
Default enabling of ssl verify
SSL verify is enabled by default to prevent man-in-the-middle attacks when using go-c8y-cli.
This means if you were previously using go-c8y-cli against a Cumulocity IoT Edge using a self-signed certificate, then you will need to disable ssl verification for the session or for individual commands.
Disabling SSL Verify for individual commands
c8y devices list --insecure
# or using an shortform
c8y devices list -k
Disabling SSL Verify for your session
Please only disable SSL verify if you fully trust the server/network you are working with, and have no other option!
c8y settings update defaults.insecure true
# Or using environment variables
export C8Y_SETTINGS_DEFAULTS_INSECURE=true
New Features
Request caching (#79)
Adding optional local client side caching feature which provides:
- Reduce number of requests sent to the server
- Improve performance by reusing responses across different commands, also when trying out new commands
- Provide way to dedupe POST/PUT requests docs
Caching is turned off by default, and can be opted for single commands or activated globally for specific HTTP methods (i.e. GET, PUT, POST etc.)
Example
c8y devices list --type "c8y_Linux" --cache
# => Sends a request to the server the first time
c8y devices list --type "c8y_Linux" --cache
# => A cached response is used as the same command is being used within the cache TTL
echo agent01 | c8y util repeat 2 | c8y devices get --cache --cacheTTL 60s -v
# => Control time-to-live for single commands
Checkout the new caching concept docs for more details and examples.
Cumulocity CLI 2.3.0
Changelog
Features
Device data management (configuration/firmware/software/deviceprofile) (#78)
Added support for device data (repository) management
c8y configuration
c8y software
c8y firmware
c8y deviceprofiles
Checkout the PR for full details #78
Support mixing iterators with stdin and fixed parameters (#68 & #77)
The processing of the stdin pipeline handling has been approved to allow mixing stdin with fixed parameters. So the following constellations are now supported:
echo "{\"id\":\"2\",\"otherProps\":{}}" | c8y alarms update --id 1 --dry --template input.value
c8y measurements list --device 12345 | c8y measurements create --device 22222 --template "input.value + {id:: null}"
Checkout the PR for more details #68 and #77
Bugfixes
- Special characters are URL encoded in Cumulocity queries (#76)
- bug: respecting manual views in non-request commands (#74)
- Prevent duplicate query parameters when using iterators (#70)
Docs
- Fixed alpine linux installation instructions
- Added custom install location using PowerShell installation script (#71)