open-consul/website/pages/docs/commands/namespace/list.mdx
2020-05-21 14:50:45 -04:00

100 lines
1.9 KiB
Plaintext

---
layout: docs
page_title: 'Commands: Namespace List'
sidebar_title: list
---
# Consul Namespace List
Command: `consul namespace list`
<EnterpriseAlert />
This `namespace list` command lists all namespace configurations. This was added in Consul Enterprise 1.7.0. If
ACLs are enabled then this command will require a token with `operator:read` privileges or any `read` privileges
within the target namespaces. The results will be filtered based on the ACL token and therefore it is possible to
see a partial list.
## Usage
Usage: `consul namespace list`
#### API Options
@include 'http_api_options_client.mdx'
@include 'http_api_options_server.mdx'
#### Command Options
- `-format=<string>` - How to output the results. The choices are: pretty or json
- `-meta` - Indicates that namespace metadata such as the raft indices should be
shown for the namespace
## Examples
List Namespaces:
```shell-session
$ consul namespace list
default:
Description:
Builtin Default Namespace
foo:
Description:
Example Namespace
team-1:
Description:
```
Showing Raft Metadata:
```shell-session
$ consul namespace list -meta
default:
Description:
Builtin Default Namespace
Create Index: 4
Modify Index: 4
foo:
Description:
Example Namespace
Create Index: 352
Modify Index: 352
team-1:
Description:
Create Index: 339
Modify Index: 344
```
JSON Format:
```shell-session
$ consul namespace list -format=json
[
{
"Name": "default",
"Description": "Builtin Default Namespace",
"CreateIndex": 4,
"ModifyIndex": 4
},
{
"Name": "foo",
"Description": "Example Namespace",
"Meta": {
"team-id": "574407f3-8b26-4c84-8e51-028bb8cbdd37"
},
"CreateIndex": 352,
"ModifyIndex": 352
},
{
"Name": "team-1",
"CreateIndex": 339,
"ModifyIndex": 344
}
]
```