list

Definition

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

Arguments and Flags

--output=OUTPUT
Output encoding. Available OUTPUT options are plain (default), json, and xml
PREFIX
Optional prefix of keys to be listed

Usage

$ vars list [--output=OUTPUT] [PREFIX]

Examples

Returning prefixed keys

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

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

Then vars list ami will return the following keys:

/ami/region/us-east-1
/ami/region/us-west-1
/ami/region/us-west-2

Returning prefixed keys as JSON

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

[
  {
    "key": "/ami/region/us-east-1",
    "value": "ami-ID",
    "version": 1,
    "last_update": 1468422731
  },
  {
    "key": "/ami/region/us-west-1",
    "value": "ami-ID",
    "version": 1,
    "last_update": 1468422743
  },
  {
    "key": "/ami/region/us-west-2",
    "value": "ami-ID",
    "version": 1,
    "last_update": 1468422747
  }
]

Returning prefixed keys as XML

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

<Items>
   <SrItem>
      <key>/ami/region/us-east-1</key>
      <value>ami-ID</value>
      <version>1</version>
      <last_update>1468422731</last_update>
   </SrItem>
   <SrItem>
      <key>/ami/region/us-west-1</key>
      <value>ami-ID</value>
      <version>1</version>
      <last_update>1468422743</last_update>
   </SrItem>
   <SrItem>
      <key>/ami/region/us-west-2</key>
      <value>ami-ID</value>
      <version>1</version>
      <last_update>1468422747</last_update>
   </SrItem>
</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