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