KV Command Type

The KV command interact with the Choria Key-Value Store and supports usual operations such as Get, Put, Delete and more.

Since this is built into Choria it will simply use your Choria Client configuration for the user executing the command to find the Choria Brokers and more. It supports the usual override methods such as creating a choria.conf file in your project working directory. No connection properties are required or supported.

Version Hint

This feature is only available when hosting App Builder applications within the Choria Server version 0.26.0 or newer

Overview

All variations of this command have a number of required properties, here’s the basic get operation, all these keys are required:

name: version
description: Retrieve the `version` key
type: kv

action: get
bucket: DEPLOYMENT
key: version

Usual standard properties like flags, arguments, commands and so forth are all supported. The bucket and key flags supports templating.

Writing data using put

Data can be written to the bucket, it’s identical to the above example with the addition of the value property that supports templating.

name: version
description: Stores a new version for the deployment
type: kv

action: put
bucket: DEPLOYMENT
key: version
value: '{{- .Arguments.version -}}'
arguments:
  - name: version
    description: The version to store
    required: true

Retrieving data and transformations using get

Stored data can be retrieved and rendered to the screen, typically the value is just dumped. Keys and Values however have additional metadata that can be rendered in JSON format.

name: version
description: Retrieve the `version` key
type: kv

action: get
bucket: DEPLOYMENT
key: state

# Triggers rendering the KV entry as JSON that will include metadata ab out the value.
json: true

Further if it’s known that the entry holds JSON data it can be formatted using data transformations:

name: version
description: Retrieve the `version` key
type: kv

action: get
bucket: DEPLOYMENT
key: state

transform:
  query: .state

Deleting data using del

Deleting a specific key is very similar to a basic retrieve, just use a different action:

name: version
description: Deletes the deployment configuration property
type: kv

action: del
bucket: DEPLOYMENT
key: configuration

Viewing key history using history

Choria Key-Value store optionally has historical data for keys, the data can be shown in tabular (default) or JSON formats:

name: version
description: Deploy version history
type: kv

action: history
bucket: DEPLOYMENT
key: version

# optionally renders the result as JSON
json: true