2020-03-16 13:42:39 +00:00
|
|
|
---
|
2020-04-07 18:55:19 +00:00
|
|
|
layout: docs
|
|
|
|
page_title: 'Commands: Namespace Update'
|
2020-04-13 18:40:26 +00:00
|
|
|
sidebar_title: update
|
2020-03-16 13:42:39 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
# Consul Namespace Update
|
|
|
|
|
|
|
|
Command: `consul namespace update`
|
|
|
|
|
2020-04-23 22:13:18 +00:00
|
|
|
<EnterpriseAlert />
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
This `namespace update` command updates a namespaces using the CLI parameters provided.
|
2020-03-16 13:42:39 +00:00
|
|
|
This was added in Consul Enterprise 1.7.2.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
|
|
Usage: `consul namespace update -name <namespace name> [options]`
|
|
|
|
|
|
|
|
Request a namespace to be update. Construction of the namespace definition is handled by this command
|
|
|
|
from the CLI arguments. Some parts of the Namespace such as ACL configurations and meta can be merged
|
|
|
|
with the existing namespace definition.
|
|
|
|
|
|
|
|
#### 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'
|
2020-03-16 13:42:39 +00:00
|
|
|
|
|
|
|
#### Command Options
|
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-default-policy-id=<value>` - ID of a policy from the default namespace to inject for all tokens
|
|
|
|
in this namespace. May be specified multiple times.
|
2020-03-16 13:42:39 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-default-policy-name=<value>` - Name of a policy from the default namespace to inject for all
|
|
|
|
tokens in this namespace. May be specified multiple times.
|
2020-03-16 13:42:39 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-default-role-id=<value>` - ID of a role from the default namespace to inject for all tokens in
|
|
|
|
this namespace. May be specified multiple times.
|
2020-03-16 13:42:39 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-default-role-name=<value>` - Name of a role from the default namespace to inject for all tokens
|
|
|
|
in this namespace. May be specified multiple times.
|
2020-03-16 13:42:39 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-description=<string>` - A description of the namespace.
|
2020-03-16 13:42:39 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-format=<string>` - How to output the results. The choices are: pretty or json
|
2020-03-16 13:42:39 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-merge-acls` - Merge the new ACL policies and roles with the existing values.
|
2020-03-16 13:42:39 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-merge-meta` - Merge new meta values with existing meta.
|
2020-03-16 13:42:39 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-meta=<value>` - Metadata to set on the namespace, formatted as key=value. This flag
|
|
|
|
may be specified multiple times to set multiple meta fields
|
2020-03-16 13:42:39 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-name=<string>` - The namespace's name. This flag is required.
|
2020-03-16 13:42:39 +00:00
|
|
|
|
2020-04-07 18:55:19 +00:00
|
|
|
- `-show-meta` - Indicates that namespace metadata such as the raft indices should
|
|
|
|
be shown for the namespace
|
2020-03-16 13:42:39 +00:00
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
Update a namespace with a new description:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2020-03-16 13:42:39 +00:00
|
|
|
$ consul namespace update -name "team-1" -description "example description"
|
|
|
|
Name: team-1
|
|
|
|
Description:
|
|
|
|
example description
|
|
|
|
```
|
|
|
|
|
|
|
|
Showing Raft Metadata:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2020-03-16 13:42:39 +00:00
|
|
|
$ consul namespace update -name team-1 -show-meta -default-policy-id 1206bf1c-6239-46e8-b9f8-b426667cf428
|
|
|
|
Name: team-1
|
|
|
|
ACLs:
|
|
|
|
Default Policies:
|
|
|
|
1206bf1c-6239-46e8-b9f8-b426667cf428 / team1-universal-policy
|
|
|
|
Create Index: 339
|
|
|
|
Modify Index: 344
|
|
|
|
```
|
|
|
|
|
|
|
|
JSON Format:
|
|
|
|
|
2020-05-19 18:32:38 +00:00
|
|
|
```shell-session
|
2020-03-16 13:42:39 +00:00
|
|
|
$ consul namespace update -name team2 -description "Example Namespace" -meta "external-source=kubernetes" -format=json
|
|
|
|
{
|
|
|
|
"Name": "team2",
|
|
|
|
"Description": "Example Namespace",
|
|
|
|
"Meta": {
|
|
|
|
"external-source": "kubernetes"
|
|
|
|
},
|
|
|
|
"CreateIndex": 352,
|
|
|
|
"ModifyIndex": 352
|
|
|
|
}
|
|
|
|
```
|