Aimee Ukasick 654528ca60
DOCS: CE-556 Add partition parameter to API endpoint docs (#21374)
* CD-556 rename partition partial that's only used in CLI

Update CLI pages for partial rename

API: Add partial for partition as body option
API: Add partial for partition as query parameter

Update API peering and members pages

* acl/auth-methods.mdx

Update partition partials to be generic

* binding-rules.mdx, policies.mdx

* roles.mdx, templated-policies.mdx

* tokens.mdx, catalog.mdx, config.mdx, intentions.mdx

* service.mdx, exported-services.mdx, kv.mdx, namespaces.mdx

* Apply suggestions from code review

Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>

* Add partial to acl/auth-methods.mdx

Fix headings indent in a few files.

* Update website/content/api-docs/acl/auth-methods.mdx

Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>

---------

Co-authored-by: Jeff Boruszak <104028618+boruszak@users.noreply.github.com>
2024-07-18 12:02:45 -05:00

114 lines
4.0 KiB
Plaintext

---
layout: commands
page_title: 'Commands: Namespace Update'
description: |
The `consul namespace update` command updates an individual namespace in Consul Enterprise. Policies, roles, namespace descriptions, and metadata can be updated.
---
# Consul Namespace Update
Command: `consul namespace update`
Corresponding HTTP API Endpoint: [\[PUT\] /v1/namespace/:name](/consul/api-docs/namespaces#update-a-namespace)
<EnterpriseAlert />
This `namespace update` command updates a namespaces using the CLI parameters provided.
This was added in Consul Enterprise 1.7.2.
The table below shows this command's [required ACLs](/consul/api-docs/api-structure#authentication). Configuration of
[blocking queries](/consul/api-docs/features/blocking) and [agent caching](/consul/api-docs/features/caching)
are not supported from commands, but may be from the corresponding HTTP endpoint.
| ACL Required |
| ---------------- |
| `operator:write` |
## 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.
#### Command Options
- `-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. The ACL token used with
this command must have [`acl:write` access](/consul/docs/security/acl/acl-rules#acl-resource-rules) to the linked policy.
- `-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. The ACL token used with
this command must have [`acl:write` access](/consul/docs/security/acl/acl-rules#acl-resource-rules) to the linked policy.
- `-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. The ACL token used with
this command must have [`acl:write` access](/consul/docs/security/acl/acl-rules#acl-resource-rules) to the linked role.
- `-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. The ACL token used with
this command must have [`acl:write` access](/consul/docs/security/acl/acl-rules#acl-resource-rules) to the linked role.
- `-description=<string>` - A description of the namespace.
- `-format=<string>` - How to output the results. The choices are: pretty or json
- `-merge-acls` - Merge the new ACL policies and roles with the existing values.
- `-merge-meta` - Merge new meta values with existing meta.
- `-meta=<value>` - Metadata to set on the namespace, formatted as key=value. This flag
may be specified multiple times to set multiple meta fields
- `-name=<string>` - The namespace's name. This flag is required.
- `-show-meta` - Indicates that namespace metadata such as the raft indices should
be shown for the namespace
#### API Options
@include 'cli-http-api-partition-options.mdx'
@include 'http_api_options_client.mdx'
@include 'http_api_options_server.mdx'
## Examples
Update a namespace with a new description:
```shell-session
$ consul namespace update -name "team-1" -description "example description"
Name: team-1
Description:
example description
```
Showing Raft Metadata:
```shell-session
$ 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:
```shell-session
$ 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
}
```