github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/docs/commands/var/list.mdx (about)

     1  ---
     2  layout: docs
     3  page_title: "Command: var list"
     4  description: |-
     5    The "var list" command lists data from Nomad's variables datastore at
     6    or beginning with the given prefix.
     7  ---
     8  
     9  # Command: var list
    10  
    11  The `var list` command returns a list of [variable][] paths accessible to the
    12  current user, optionally filtered to paths containing a provided prefix. Do not
    13  encode sensitive information in variable paths. The variable's items are not
    14  accessible via this command.
    15  
    16  When using pagination, the next page token is provided as part of the output of
    17  the command. When the output format is JSON, the returned variable list is
    18  wrapped with additional metadata that contains the next page token. For non-JSON
    19  output, the next page token is printed as a message to standard error and
    20  standard output contains the variables from the specifically requested page.
    21  
    22  
    23  ## Usage
    24  
    25  ```plaintext
    26  nomad var list [options] [<prefix>]
    27  ```
    28  
    29  If ACLs are enabled, this command requires the `variables:list` capability for
    30  the namespaces and paths containing the variables to list. See the [ACL policy][]
    31  documentation for details.
    32  
    33  ## General Options
    34  
    35  @include 'general_options.mdx'
    36  
    37  ## List Options
    38  
    39  - `-per-page` `(int: <unset>)`: How many results to show per page.
    40  
    41  - `-page-token` `(string: "")`: Where to start pagination.
    42  
    43  - `-filter` `(string: "")`: Specifies an expression used to filter query
    44    results. Queries using this option are less efficient than using the prefix
    45    parameter; therefore, the prefix parameter should be used whenever possible.
    46  
    47  - `-out` `(enum: go-template | json | table | terse )`: Format to render the
    48    variable in. When using "go-template", you must provide the template content
    49    with the `-template` option. Defaults to "table" when stdout is a terminal and
    50    to "json" when stdout is redirected.
    51  
    52  - `-template` `(string: "")` Template to render output with. Required when
    53    output is "go-template".
    54  
    55  ## Examples
    56  
    57  List values under the key "nomad/jobs":
    58  
    59  ```shell-session
    60  $ nomad var list nomad/jobs
    61  Namespace  Path                           Last Updated
    62  default    nomad/jobs/example             2022-08-23T10:35:47-04:00
    63  default    nomad/jobs/variable            2022-08-23T10:24:45-04:00
    64  default    nomad/jobs/variable/www        2022-08-23T10:24:45-04:00
    65  default    nomad/jobs/variable/www/nginx  2022-08-23T10:24:46-04:00
    66  ```
    67  
    68  List values under the key "nomad/jobs/variable/www" in JSON format:
    69  
    70  ```shell-session
    71  $ nomad var list -out=json -namespace="*" nomad/jobs/variable/www
    72  [
    73    {
    74      "Namespace": "default",
    75      "Path": "nomad/jobs/variable/www",
    76      "CreateIndex": 1457,
    77      "ModifyIndex": 1457,
    78      "CreateTime": 1662061225600373000,
    79      "ModifyTime": 1662061225600373000
    80    },
    81    {
    82      "Namespace": "default",
    83      "Path": "nomad/jobs/variable/www/nginx",
    84      "CreateIndex": 800,
    85      "ModifyIndex": 1000,
    86      "CreateTime": 1662061717905426000,
    87      "ModifyTime": 1662062162982630000
    88    }
    89  ]
    90  ```
    91  
    92  Perform a paginated query:
    93  
    94  ```shell-session
    95  $ nomad var list -per-page=3
    96  Namespace  Path                           Last Updated
    97  default    nomad/jobs/example             2022-08-23T10:35:47-04:00
    98  default    nomad/jobs/variable            2022-08-23T10:24:45-04:00
    99  default    nomad/jobs/variable/www        2022-08-23T10:24:45-04:00
   100  Next page token: default.nomad/jobs/variable/www/nginx
   101  ```
   102  
   103  To fetch the next page :
   104  
   105  ```shell-session
   106  $ nomad var list -per-page=3 \
   107    -page-token=default.nomad/jobs/variable/www/nginx
   108  Namespace  Path                 Last Updated
   109  default    nomad/jobs/variable/www/nginx  2022-08-23T10:24:46-04:00
   110  ```
   111  
   112  Perform a paginated query with JSON formatting:
   113  
   114  ```shell-session
   115  $ nomad var list -out=json -namespace="*" -per-page=1 nomad/jobs/variable/www
   116  {
   117      "Data": [
   118          {
   119             "Namespace": "default",
   120              "Path": "nomad/jobs/variable/www",
   121              "CreateIndex": 1457,
   122              "ModifyIndex": 1457,
   123              "CreateTime": 1662061225600373000,
   124              "ModifyTime": 1662061225600373000
   125          }
   126      ],
   127      "QueryMeta": {
   128          "KnownLeader": true,
   129          "LastContact": 0,
   130          "LastIndex": 43,
   131          "NextToken": "default.nomad/jobs/variable/www/nginx",
   132          "RequestTime": 875792
   133      }
   134  }
   135  ```
   136  
   137  As with the tabular version, provide the `QueryMeta.NextToken` value as the
   138  `-page-token` value to fetch the next page.
   139  
   140  [variable]: /docs/concepts/variables
   141  [ACL Policy]: /docs/other-specifications/acl-policy#variables