diff --git a/website/source/docs/commands/namespace.html.md.erb b/website/source/docs/commands/namespace.html.md.erb index e9915ea17..c94980c66 100644 --- a/website/source/docs/commands/namespace.html.md.erb +++ b/website/source/docs/commands/namespace.html.md.erb @@ -35,10 +35,12 @@ Usage: consul namespace [options] [args] ... Subcommands: + create Create a Namespace delete Delete a Namespace list List all Namespaces read Read a Namespace - write Create or update a Namespace + update Update a Namespace + write Create or update a Namespace from its full definition ``` For more information, examples, and usage about a subcommand, click on the name @@ -46,7 +48,13 @@ of the subcommand in the sidebar. ## Basic Examples -Create or update a Namespace: +Create a Namespace + +```sh +$ consul namespace create -name team1 +``` + +Create or Update a Namespace from its full definition: ```sh $ consul namespace write ns1.hcl @@ -64,8 +72,14 @@ List all Namespaces: $ consul namespace list ``` +Update a namespace + +```sh +$ consul namespace update -name team1 -description "first namespace" +``` + Delete a Namespace: ```sh -$ consul namespace delete ns1 -``` +$ consul namespace delete team1 +``` \ No newline at end of file diff --git a/website/source/docs/commands/namespace/create.html.md.erb b/website/source/docs/commands/namespace/create.html.md.erb new file mode 100644 index 000000000..917a1414a --- /dev/null +++ b/website/source/docs/commands/namespace/create.html.md.erb @@ -0,0 +1,85 @@ +--- +layout: "docs" +page_title: "Commands: Namespace Create" +sidebar_current: "docs-commands-namespace-create" +--- + +<%= enterprise_alert :consul %> + +# Consul Namespace Create + +Command: `consul namespace create` + +This `namespace create` command creates a namespaces using the CLI parameters provided. +This was added in Consul Enterprise 1.7.2. + +## Usage + +Usage: `consul namespace create -name [options]` + +Request a namespace to be created. Construction of the namespace definition is handled by this command +from the CLI arguments. + +#### API Options + +<%= partial "docs/commands/http_api_options_client" %> +<%= partial "docs/commands/http_api_options_server" %> + +#### Command Options + +* `-default-policy-id=` - ID of a policy from the default namespace to inject for all tokens + in this namespace. May be specified multiple times. + +* `-default-policy-name=` - Name of a policy from the default namespace to inject for all + tokens in this namespace. May be specified multiple times. + +* `-default-role-id=` - ID of a role from the default namespace to inject for all tokens in + this namespace. May be specified multiple times. + +* `-default-role-name=` - Name of a role from the default namespace to inject for all tokens + in this namespace. May be specified multiple times. + +* `-description=` - A description of the namespace. + +* `-format=` - How to output the results. The choices are: pretty or json + +* `-meta=` - Metadata to set on the namespace, formatted as key=value. This flag + may be specified multiple times to set multiple meta fields + +* `-name=` - 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 + +## Examples + +Create a new Namespace: + +```sh +$ consul namespace create -name "team-1" +Name: team-1 +``` + +Showing Raft Metadata: + +```sh +$ consul namespace create -name team-1 -show-meta +Name: team-1 +Create Index: 339 +Modify Index: 344 +``` + +JSON Format: + +```sh +$ consul namespace create -name team2 -description "Example Namespace" -meta "team-id=574407f3-8b26-4c84-8e51-028bb8cbdd37" -format=json +{ + "Name": "team2", + "Description": "Example Namespace", + "Meta": { + "team-id": "574407f3-8b26-4c84-8e51-028bb8cbdd37" + }, + "CreateIndex": 352, + "ModifyIndex": 352 +} +``` diff --git a/website/source/docs/commands/namespace/update.html.md.erb b/website/source/docs/commands/namespace/update.html.md.erb new file mode 100644 index 000000000..1a1d75a55 --- /dev/null +++ b/website/source/docs/commands/namespace/update.html.md.erb @@ -0,0 +1,95 @@ +--- +layout: "docs" +page_title: "Commands: Namespace Update" +sidebar_current: "docs-commands-namespace-update" +--- + +<%= enterprise_alert :consul %> + +# Consul Namespace Update + +Command: `consul namespace update` + +This `namespace update` command updates a namespaces using the CLI parameters provided. +This was added in Consul Enterprise 1.7.2. + +## Usage + +Usage: `consul namespace update -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 + +<%= partial "docs/commands/http_api_options_client" %> +<%= partial "docs/commands/http_api_options_server" %> + +#### Command Options + +* `-default-policy-id=` - ID of a policy from the default namespace to inject for all tokens + in this namespace. May be specified multiple times. + +* `-default-policy-name=` - Name of a policy from the default namespace to inject for all + tokens in this namespace. May be specified multiple times. + +* `-default-role-id=` - ID of a role from the default namespace to inject for all tokens in + this namespace. May be specified multiple times. + +* `-default-role-name=` - Name of a role from the default namespace to inject for all tokens + in this namespace. May be specified multiple times. + +* `-description=` - A description of the namespace. + +* `-format=` - 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=` - Metadata to set on the namespace, formatted as key=value. This flag + may be specified multiple times to set multiple meta fields + +* `-name=` - 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 + +## Examples + +Update a namespace with a new description: + +```sh +$ consul namespace update -name "team-1" -description "example description" +Name: team-1 +Description: + example description +``` + +Showing Raft Metadata: + +```sh +$ 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: + +```sh +$ 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 +} +``` diff --git a/website/source/docs/commands/namespace/write.html.md.erb b/website/source/docs/commands/namespace/write.html.md.erb index c04ad3f2a..a36e4c68d 100644 --- a/website/source/docs/commands/namespace/write.html.md.erb +++ b/website/source/docs/commands/namespace/write.html.md.erb @@ -10,7 +10,7 @@ sidebar_current: "docs-commands-namespace-write" Command: `consul namespace write` -This `namespace write` command creates or updates a namespaces configuration. This was added in Consul Enterprise 1.7.0. +This `namespace write` command creates or updates a namespace's configuration from its full definition. This was added in Consul Enterprise 1.7.0. ## Usage diff --git a/website/source/layouts/docs.erb b/website/source/layouts/docs.erb index af8ca60bb..3bdd4d6e0 100644 --- a/website/source/layouts/docs.erb +++ b/website/source/layouts/docs.erb @@ -330,6 +330,9 @@ > namespace