listget

Usage

vars [global options] listget [options]

Options

Global options are detailed here.

--output=OUTPUT
Output encoding. Available OUTPUT options are plain (default), json, and xml.
PREFIX
Optional key prefix of values to be listed.
-r | --refresh
Refresh list of values from the Vars server.
-h | --help
Show help message.

Definition

The listget command lists the values for all the keys in the local Vars client’s cache, or if a prefix is provided, a list of values for all the keys beginning with that prefix.

Examples

Using listget to return values for prefixed keys

To return a specific subset of values, use vars listget [PREFIX]. For example, if vars list returns the following keys:

/vars/instances/external-34-36-3b-62-c5-52/status
/ami/region/us-west-2
/ami/region/us-east-1
/vars/instances/conductor_vars_userland/status
/ami/region/us-west-1

And vars listget returns the following values:

READY
ami-22222222
ami-00000000
READY
ami-11111111

Then vars listget ami returns the following values:

ami-22222222
ami-00000000
ami-11111111

Using listget to return values for prefixed keys as JSON

To return a list of values for ami prefixed keys as JSON, execute vars listget --output json ami, and you’ll see something like this:

[
  {
    "key": "/ami/region/us-west-2",
    "value": "ami-22222222",
    "version": 4,
    "last_update": 1468522717,
    "castoken": "1ba777b4cf492987c1d6a0bd1f6c3dc99c1aa24e-4"
  },
  {
    "key": "/ami/region/us-east-1",
    "value": "ami-00000000",
    "version": 2,
    "last_update": 1468522704,
    "castoken": "ca7378b086cc4f4714979eeabe25d779dbbf6160-2"
  },
  {
    "key": "/ami/region/us-west-1",
    "value": "ami-11111111",
    "version": 4,
    "last_update": 1468522711,
    "castoken": "b690f74cee776b62e6ae38ad286bbcf160f826a7-4"
  }
]

Using listget to return values for prefixed keys as XML

And to return a list of values for ami prefixed keys in XML, execute vars list --output xml ami, and you’ll see something like this:

<Items>
 <GetOutput>
    <key>/ami/region/us-west-2</key>
    <value>ami-22222222</value>
    <version>4</version>
    <last_update>1468522717</last_update>
    <castoken>1ba777b4cf492987c1d6a0bd1f6c3dc99c1aa24e-4</castoken>
 </GetOutput>
 <GetOutput>
    <key>/ami/region/us-east-1</key>
    <value>ami-00000000</value>
    <version>2</version>
    <last_update>1468522704</last_update>
    <castoken>ca7378b086cc4f4714979eeabe25d779dbbf6160-2</castoken>
 </GetOutput>
 <GetOutput>
    <key>/ami/region/us-west-1</key>
    <value>ami-11111111</value>
    <version>4</version>
    <last_update>1468522711</last_update>
    <castoken>b690f74cee776b62e6ae38ad286bbcf160f826a7-4</castoken>
 </GetOutput>
</Items>

JSON and XML output fields

key
Key/value pair key
value
Key/value pair value
version
Version number of key/value pair’s value, incremented by 1 for each new value
last_update
Unix timestamp of most recent new value
castoken
Unique token for conditional updates or compare-and-swap operations