v1.6.0: Templates and session protection
v1.6.0
Breaking Changes
- Added support for disabling create/update/delete command individually to prevent accidental data loss. See the session concept documentation for full details.
- create/update/delete command are disabled by default! They must be enabled otherwise the commands will return an error. Commands can be enabled/disabled from the session properties
- commands can be temporarily enabled/disabled in the session via environment variables without persisting them in the session settings
- CI mode which enables all commands via one environment variable
Features (PSc8y and c8y)
-
Custom rest requests no longer required the
Data
orFile
parameter forPOST
orPUT
requests. If neither is provided, then the request is sent without a bodyPowerShell
Invoke-ClientRequest -Uri "/service/exampleMS/myendpoint" -Method "POST"
Bash/zsh
c8y rest POST /service/exampleMS/myendpoint
-
Added command to read the current configuration settings as json
PowerShell
Get-ClientSetting
Bash/zsh
c8y settings list
-
Added support for templates and template variables for all POST and PUT commands. See the templates concept documentation for full details.
jsonnet
templates can be used to create json dataFile: custom.device.jsonnet
{ name: "my device", type: vars("type", "defaultType"), cpuThreshold: rand.int, c8y_IsDevice: {}, }
Usage: Bash/zsh
c8y inventory create \ --template ./examples/templates/device.jsonnet \ --templateVars "type=myCustomType1" \ --dry
Usage: PowerShell
New-ManagedObject ` -Template ./examples/templates/measurement.jsonnet ` -TemplateVars "type=myCustomType1" ` -WhatIf
Output
These command would produce the following body which would be sent to Cumulocity.
{ "name": "my device", "type": "myCustomType1", "c8y_IsDevice": {}, "cpuThreshold": 88, }
To help with the development of templates, there is a command which evaluates a template and prints the output to the console.
Bash/zsh
c8y template execute --template ./mytemplate.jsonnet
PowerShell
Invoke-Template -Template ./template.jsonnet
-
Added support for setting additional properties when uploading a binary file
PowerShell
New-Binary -File "myfile.json" -Data @{ c8y_Global = @{}; type = "c8y_upload" }
Bash/zsh
c8y binaries create --file "myfile.json" --data "c8y_Global={},type=c8y_upload"
-
The
Data
parameter now supports a json file path to make it easier to upload complex json structures.Example: Create a new managed object from a json file
./myfile.json
{ "name": "server-01", "type": "linux", "c8y_SoftwareList": [ { "name": "app1", "version": "1.0.0", "url": ""}, { "name": "app2", "version": "9", "url": ""}, { "name": "app3 test", "version": "1.1.1", "url": ""} ] }
Powershell
New-ManagedObject -Data ./myfile.json
Bash / zsh
c8y inventory create --data ./myfile.json
PSc8y (PowerShell) minor improvements / fixes
-
Fixed logic when removing username information from the current session path when using the hide sensitive information option. Affects MacOS and Linux
-
Added Pipeline support to following cmdlets
- New-TestAlarm
- New-TestEvent
- New-TestMeasurement (Confirm impact now set to High)
- New-TestOperation
- New-TestUser
- New-TestGroup
- New-TestDevice
- New-TestAgent
- New-ExternalID
-
New-Microservice
- Added
-Key
parameter to allow the user to set a custom value - Changed the default value of the
key
property from{name}-microservice-key
to{name}
so it matched the default name used by the Cumulocity Java SDK for microservices
- Added