2019-12-06 16:14:56 +00:00
|
|
|
---
|
2020-04-07 18:55:19 +00:00
|
|
|
layout: docs
|
|
|
|
page_title: 'Commands: Namespace Read'
|
2020-04-13 18:40:26 +00:00
|
|
|
sidebar_title: read
|
2019-12-06 16:14:56 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Consul Namespace Read
|
|
|
|
|
|
|
|
Command: `consul namespace read`
|
|
|
|
|
2020-04-23 22:13:18 +00:00
|
|
|
<EnterpriseAlert />
|
|
|
|
|
2019-12-06 16:14:56 +00:00
|
|
|
This `namespace read` command reads a namespaces configuration. 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 namespace.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `consul namespace read <name>`
|
|
|
|
|
|
|
|
#### 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
|
|
|
|
|
|
|
#### 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
|
|
|
|
|
|
|
|
Read a Namespace:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2019-12-06 16:14:56 +00:00
|
|
|
$ consul namespace read "team-1"
|
|
|
|
Name: 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 read -meta "team-1"
|
|
|
|
Name: 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 read -format=json foo
|
|
|
|
{
|
|
|
|
"Name": "foo",
|
|
|
|
"Description": "Example Namespace",
|
|
|
|
"Meta": {
|
|
|
|
"team-id": "574407f3-8b26-4c84-8e51-028bb8cbdd37"
|
|
|
|
},
|
|
|
|
"CreateIndex": 352,
|
|
|
|
"ModifyIndex": 352
|
|
|
|
}
|
|
|
|
```
|