2019-12-06 16:14:56 +00:00
|
|
|
---
|
2020-09-01 15:14:13 +00:00
|
|
|
layout: commands
|
2020-04-07 18:55:19 +00:00
|
|
|
page_title: 'Commands: Namespace List'
|
2019-12-06 16:14:56 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Consul Namespace List
|
|
|
|
|
|
|
|
Command: `consul namespace list`
|
|
|
|
|
2022-01-11 13:26:58 +00:00
|
|
|
Corresponding HTTP API Endpoint: [\[GET\] /v1/namespaces](/api-docs/namespaces#list-all-namespaces)
|
2022-01-10 17:40:11 +00:00
|
|
|
|
2020-04-23 22:13:18 +00:00
|
|
|
<EnterpriseAlert />
|
|
|
|
|
2019-12-06 16:14:56 +00:00
|
|
|
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.
|
|
|
|
|
2022-01-10 21:44:56 +00:00
|
|
|
The table below shows this command's [required ACLs](/api#authentication). Configuration of
|
|
|
|
[blocking queries](/api/features/blocking) and [agent caching](/api/features/caching)
|
|
|
|
are not supported from commands, but may be from the corresponding HTTP endpoint.
|
|
|
|
|
2022-01-11 14:41:54 +00:00
|
|
|
| ACL Required |
|
|
|
|
| ------------------------------------------------- |
|
|
|
|
| `operator:read` or `namespace:*:read`<sup>1</sup> |
|
|
|
|
|
|
|
|
<sup>1</sup> Access can be granted to list the Namespace if the token used when making
|
|
|
|
the request has been granted any access in the namespace (read, list or write).
|
2022-01-10 21:44:56 +00:00
|
|
|
|
2019-12-06 16:14:56 +00:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `consul namespace list`
|
|
|
|
|
|
|
|
#### API Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
@include 'http_api_options_client.mdx'
|
2020-04-07 23:56:08 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
@include 'http_api_options_server.mdx'
|
2019-12-06 16:14:56 +00:00
|
|
|
|
2021-12-15 01:55:21 +00:00
|
|
|
@include 'http_api_partition_options.mdx'
|
|
|
|
|
2019-12-06 16:14:56 +00:00
|
|
|
#### Command Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-format=<string>` - How to output the results. The choices are: pretty or json
|
2019-12-06 16:14:56 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-meta` - Indicates that namespace metadata such as the raft indices should be
|
2019-12-06 16:14:56 +00:00
|
|
|
shown for the namespace
|
2020-04-07 18:55:19 +00:00
|
|
|
|
2019-12-06 16:14:56 +00:00
|
|
|
## Examples
|
|
|
|
|
|
|
|
List Namespaces:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-12-06 16:14:56 +00:00
|
|
|
$ consul namespace list
|
|
|
|
default:
|
|
|
|
Description:
|
|
|
|
Builtin Default Namespace
|
|
|
|
foo:
|
|
|
|
Description:
|
|
|
|
Example Namespace
|
|
|
|
team-1:
|
|
|
|
Description:
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
Showing Raft Metadata:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-12-06 16:14:56 +00:00
|
|
|
$ 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:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-12-06 16:14:56 +00:00
|
|
|
$ 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
|
|
|
|
}
|
|
|
|
]
|
|
|
|
```
|