Skip to content

Releases: reubenmiller/go-c8y-cli

Cumulocity CLI 2.12.0

10 Jun 05:54
cc121cf
Compare
Choose a tag to compare

Changelog

Improvements

  • Support tab completion for aliases (#147)

  • Support installing go-c8y-cli via go install. This is not the recommended way of installing the tool, however it does make it easier to test out branches/PRs before they have been released without having to clone and build the project yourself. (#148)

    # install: need to set a specific branch
    go install github.com/reubenmiller/go-c8y-cli/cmd/c8y@master
    
    # add the GOPATH to the PATH variable
    export PATH="$(go env GOPATH)/bin:$PATH"
    
    # use it. Note: The branch name will be set to "unknown"
    c8y version

Build

  • Update build dependencies (#148)

Cumulocity CLI 2.11.0

09 Jun 07:20
Compare
Choose a tag to compare

Changelog

New commands

  • c8y measurements createBulk - Bulk creation of measurements via piped input. The command uses the Cumulocity measurement bulk api to make the calls more efficient for large number of measurements (#146)

Improvements

c8y sessions create (#144, #145)

  • The user is now prompted for the host name if it is not provided via parameters (only if the console is in interactive mode)
  • prompt user to select session type/mode if not specified via parameters. The options include a brief description of what each means.

Fixes

Required parameters not being enforced (#144)

Parameters marked as required were not being enforced. Now the user will be shown an error if the required parameter is not provided by the user.

Affected commands

  • c8y inventory find
  • c8y microservices create
  • c8y microservices serviceuser create
  • c8y sessions clone
  • c8y sessions create
  • c8y sessions decryptText
  • c8y sessions encryptText
  • c8y sessions set
  • c8y template execute

Cumulocity CLI 2.10.13

07 Jun 11:58
c96802b
Compare
Choose a tag to compare

Changelog

Fixes

  • c8y assert text - no output when using table output format (#142)

Cumulocity CLI 2.10.12

06 Jun 22:05
Compare
Choose a tag to compare

Changelog

New Commands

c8y applications open

New command to support opening a Cumulocity application in the user's default web browser (#135)

$ c8y applications open --application cockpit
Open the cockpit application in a local web browser

$ c8y devices list | c8y applications open --application devicemanagement --page control
Open a multiple web browser tabs in the devicemanagement application, one for each device found

$ c8y devicegroups list | c8y applications open --path "/apps/cockpit/index.html#/group/{device}/subassets"
Open a multiple web browser tabs for a list of device groups in the cockpit application

c8y assert text

Assert/filter input text by either applying a regex patter, json schema

# Assert that the input text matches a given regular expression (case sensitive)
$ echo -e "myname\nsomething" | c8y assert text --regex '.*name$'
=> myname

Improvements

c8y devices list

  • New flags
    • availability <string> : Filter by c8y_Availability.status
    • lastMessageDateFrom <datetime|relativedatetime> : Filter by c8y_Availability.lastMessage date
    • lastMessageDateTo <datetime|relativedatetime> : Filter by c8y_Availability.lastMessage date
    • group <id|name> : Filter by group inclusion (using bygroupid query operator)
  • Fixed handling of the queryTemplate. It is now only applied to the given query value instead of each query element

c8y agents list

  • New flags
    • availability <string> : Filter by c8y_Availability.status
    • lastMessageDateFrom <datetime|relativedatetime> : Filter by c8y_Availability.lastMessage date
    • lastMessageDateTo <datetime|relativedatetime> : Filter by c8y_Availability.lastMessage date
    • group <id|name> : Filter by group inclusion (using bygroupid query operator)
    • orderBy : Sort the query results by a specific property
  • Fixed handling of the queryTemplate. It is now only applied to the given query value instead of each query element

c8y usergroups update

Added support for data/template flags (#141)

c8y api

Support sending the body when using DELETE methods. (#140, #127)

```sh
c8y api DELETE /dummy --template "{value: 'one'}" --dry
```

filter flag

Added a version filter operator (#134)

```sh
c8y template execute --template "{value: '1.10.8'}" | c8y util show --filter "value version >= 1.2.0"
```

See the docs for more examples

Fixes

  • Fix escaping of spaces in configuration/deviceprofiles/firmware/software queries (#136)
  • Fix broken tab completion of parameter value (e.g. device lookup etc.) (#139)

Build

  • Support building on MacOS arm64 (#125)
  • Migrating some powershell tests to bash (#85)

Cumulocity CLI 2.9.0

23 Mar 22:47
Compare
Choose a tag to compare

Changelog

New Commands

  • c8y users revokeTOTPSecret - revoke a user's TOTP (TFA) secret (#123)

Improvements

  • support multiple ids in --id flags by using csv format (#117)
  • c8y api support templateVars completion (#122)
  • c8y applications createHostedApplication support templateVars completion (#122)
  • c8y microservices create detect application name from manifest file (#119)
  • c8y applications - Limit hosted applications to tenant scope (#118)

Fixes

  • set-session fix display of TFA error message which causes the output to be duplicated (#120)

Cumulocity CLI 2.8.3

20 Feb 18:35
Compare
Choose a tag to compare

Changelog

Fixes

  • c8y microservices create - fixed detection of manifest cumulocity.json from a microservice zip file (#112)

Build

  • ignore duplicate error when publishing to PSGallery (as PSGallery has problems from time to time)

Cumulocity CLI 2.8.1

17 Feb 21:50
Compare
Choose a tag to compare

Changelog

Fixes

  • prevent panics when checking if files or folders exist (#111)
  • c8y users list - removed unused query parameters (#110)

Cumulocity CLI 2.8.0

16 Feb 21:38
Compare
Choose a tag to compare

Improvements

Filter: Add date and relative date client side filtering (#109)

Add new operations to compare dates which is timezone aware and supports relative dates. Checkout the filter docs for more details.

Examples

# filter by relative date
c8y inventory list \
    --pageSize 2000 \
    --filter "creationTime newerthan -2h" \
    --select id,creationTime

# filter by date range
c8y inventory list \
    --pageSize 20 \
    --filter "lastUpdated newerthan 2022-01-18" \
    --filter "lastUpdated olderthan 2022-01-18 15:00" \
    --select id,lastUpdated

c8y users create/update: support template and data flags (#107)

# Create a user using a template
c8y users create --template "{email: '[email protected]', userName: $.email, firstName: 'Peter'}" --sendPasswordResetEmail

# Update the email field in each user to match the id (if the id includes the @ sign)
c8y users list --filter "id like *@*" | c8y users update --template "{email: input.value.id}"

c8y alarms list (#108)

Added the following flags:

  • createdFrom - Start date or date and time of the alarm creation. Version >= 10.11
  • createdTo - End date or date and time of the alarm creation. Version >= 10.11
  • lastUpdatedFrom - Start date or date and time of the last update made. Version >= 10.11
  • lastUpdatedTo - End date or date and time of the last update made. Version >= 10.11

c8y alarms updateCollection (#108)

Added the following flags:

  • createdFrom - Start date or date and time of the alarm creation. Version >= 10.11
  • createdTo - End date or date and time of the alarm creation. Version >= 10.11

c8y alarms deleteCollection (#108)

Added the following flags:

  • createdFrom - Start date or date and time of the alarm creation. Version >= 10.11
  • createdTo - End date or date and time of the alarm creation. Version >= 10.11

Fixes

  • filter flag now supports filtering by Boolean values (#107)

    echo "{\"value\": true}" | c8y util show --filter "value eq true"

Cumulocity CLI 2.7.1

14 Feb 22:42
f353191
Compare
Choose a tag to compare

Changelog

Bugfixes

  • prevent panic during golang atomic operation when running on arm32 bit cpu (#105)

Cumulocity CLI 2.7.0

08 Feb 23:22
Compare
Choose a tag to compare

Change log

Breaking changes

Renamed c8y devices setRequiredAvailability

c8y devices setRequiredAvailability => c8y devices availability set

New Commands

c8y alarms count

New command to get the total count of alarms matching a given criteria

$ c8y alarms count --severity MAJOR
Get number of active alarms with the severity set to MAJOR

$ c8y alarms count --dateFrom "-10m" --status ACTIVE
Get number of active alarms which occurred in the last 10 minutes

$ c8y alarms count --dateFrom "-10m" --status ACTIVE --device 12345
Get number of active alarms which occurred in the last 10 minutes on a device

$ c8y devices list --type linuxA | c8y alarms count --dateFrom "-10m"
Get number of alarms from a list of devices using pipeline

c8y devices availability get

Retrieve the date when a specific managed object (by a given ID) sent the last message to Cumulocity IoT.

$ c8y devices availability get --id 12345
Get a device's availability by id

$ c8y devices availability get --id device01
Get a device's availability by name

$ c8y devices get --id device01 --dry=false | c8y devices availability get
Get a device's availability using a pipeline

c8y devices user get - Get device user related to a managed object

$ c8y devices user get --id 12345
Get device user by id

$ c8y devices user get --id device01
Get device user by name

c8y devices user update - Update device user related to a managed object

$ c8y devices user update --id 12345 --enabled
Enable a device user by name

$ c8y devices user update --id device01 --enabled=false
Disable a device user

c8y devices statistics list

Retrieve device statistics from a specific tenant (by a given ID). Either daily or monthly.

$ c8y devices statistics list
Get daily (default) device statistics for all devices in the current tenant

$ c8y devices statistics list --date "-7d" --type daily
Get daily device statistics for all devices in the current tenant 7 days ago

$ c8y devices statistics list --date "-30d" --device 12345
Get daily device statistics for all devices in the current tenant 30 days ago

$ c8y devices statistics list --date 2022-01-01 --type monthly
Get monthly device statistics for all devices for a specific month (day is ignored)

c8y inventory count

Retrieve the total number of managed objects (e.g. devices, assets, etc.) registered in your tenant, or a subset based on queries.

$ c8y inventory count
Get count of managed objects

$ c8y inventory count --text myname
Get count of managed objects matching text (using Cumulocity text search algorithm)

$ c8y inventory count --type "c8y_Sensor"
Get count of managed objects with a specific type value

$ c8y inventory count --type "c8y_Sensor" --owner "device_mylinuxbox01"
Get count of managed objects with a specific type value and owner

$ c8y inventory count --fragmentType "c8y_IsDevice"
Get total number of devices

Improvements

c8y alarms list and c8y alarms deleteCollection

  • status can be defined multiple times rather than only just using csv e.g. --status ACTIVE --status ACKNOWLEDGED. This improves tab-completion compatibility

    c8y alarms list --status ACTIVE --status ACKNOWLEDGED --dry

c8y applications delete

Added the following flags:

  • unsubscribeAll (force query parameter) - Force deletion by unsubscribing all tenants from the application first and then deleting the application itself.

c8y applications list and c8y microservices list

Added the following flags:

  • name - The name of the application.
  • owner - The ID of the tenant that owns the applications.
  • providedFor - The ID of a tenant that is subscribed to the applications but doesn't own them.
  • subscriber - The ID of a tenant that is subscribed to the applications.
  • user - The ID of a user that has access to the applications.

c8y binaries list

Added the following flags:

  • ids - The managed object IDs to search for.
  • type - The type of managed object to search for.
  • owner - Username of the owner of the managed objects.
  • text - Search for managed objects where any property value is equal to the given one. Only string values are supported.
  • childAdditionId - Search for a specific child addition and list all the groups to which it belongs.
  • childAssetId - Search for a specific child asset and list all the groups to which it belongs.
  • childDeviceId - Search for a specific child device and list all the groups to which it belongs.

c8y devices listChildren

  • withChildren - Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.

c8y events deleteCollection

Added the following flags:

  • createdFrom - Start date or date and time of the event's creation (set by the platform during creation).
  • createdTo - End date or date and time of the event's creation (set by the platform during creation).

c8y events list

Added the following flags:

  • fragmentValue - Allows filtering events by the fragment's value, but only when provided together with fragmentType.
  • createdFrom - Start date or date and time of the event's creation (set by the platform during creation).
  • createdTo - End date or date and time of the event's creation (set by the platform during creation).
  • lastUpdatedFrom - Start date or date and time of the last update made.
  • lastUpdatedTo - End date or date and time of the last update made.
  • withSourceAssets - When set to true also events for related source assets will be included in the request. When this parameter is provided a source must be specified.
  • withSourceDevices - When set to true also events for related source devices will be included in the request. When this parameter is provided a source must be specified.

c8y inventory get

Added the following flags:

  • skipChildrenNames - Don't include the child devices names in the response. This can improve the API response because the names don't need to be retrieved
  • withChildren - Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.

c8y inventory list

Added the following flags:

  • owner - List of managed objects that are owned by the given username.
  • onlyRoots - When set to true it returns managed objects which don't have any parent. If the current user doesn't have access to the parent, this is also root for the user
  • childAdditionId - Search for a specific child addition and list all the groups to which it belongs.
  • childAssetId - Search for a specific child asset and list all the groups to which it belongs.
  • childDeviceId - Search for a specific child device and list all the groups to which it belongs.
  • withChildren - Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.
  • withGroups - When set to true it returns additional information about the groups to which the searched managed object belongs. This results in setting the assetParents property with additional information about the groups.

c8y inventory additions list and c8y inventory assets list

Added the following flags:

  • withChildren - Determines if children with ID and name should be returned when fetching the managed object. Set it to false to improve query performance.

Fixes

c8y inventory assert exist and c8y inventory assert fragments

  • A non-zero exit code and log output is only printed when using the --strict flag. This aligns with the c8y devices assert commands.

    c8y inventory assert exists --id 0
    => Exit Code: 112
    => Stderr: No Output
    
    c8y inventory assert exists --id 0 --strict
    => Exit Code: 112
    => Stderr: 2022-02-08T20:23:41.519Z        ERROR   assertionError: managedObject - wanted: Found, got: NotFound, context: {ID:0}