From 8364bd9e6c1df5c9eeb32f42ef8f9d1c870acae0 Mon Sep 17 00:00:00 2001 From: Jason Stirnaman Date: Fri, 30 Jun 2023 10:57:15 -0500 Subject: [PATCH] fix(dedicated): influxctl create token (closes #5000): (#5004) * fix(dedicated): influxctl create token (closes #5000): - Use multiple database example for preview. - Note that permissions args are repeatable. - Use code-placeholders. - Replace expands with headings for linking. * Update content/influxdb/cloud-dedicated/reference/cli/influxctl/token/create.md * Update content/influxdb/cloud-dedicated/admin/tokens/create.md * Update content/influxdb/cloud-dedicated/reference/cli/influxctl/token/create.md * fix(dedicated): Placeholder instruction --- .../cloud-dedicated/admin/tokens/create.md | 86 +++++++++++-------- .../reference/cli/influxctl/token/create.md | 53 ++++++++---- .../admin/tokens/create-token.md | 1 + .../cloud/security/tokens/create-token.md | 1 + 4 files changed, 89 insertions(+), 52 deletions(-) diff --git a/content/influxdb/cloud-dedicated/admin/tokens/create.md b/content/influxdb/cloud-dedicated/admin/tokens/create.md index 070e86086..9f83b55cc 100644 --- a/content/influxdb/cloud-dedicated/admin/tokens/create.md +++ b/content/influxdb/cloud-dedicated/admin/tokens/create.md @@ -2,8 +2,8 @@ title: Create a token description: > Use the [`influxctl token create` command](/influxdb/cloud-dedicated/reference/cli/influxctl/token/create/) - to create a database token in your InfluxDB Cloud Dedicated cluster. - Provide a token description and grant permissions to databases. + to create a database token for reading and writing data in your InfluxDB Cloud Dedicated cluster. + Provide a token description and permissions for databases. menu: influxdb_cloud_dedicated: parent: Manage tokens @@ -11,10 +11,12 @@ weight: 201 list_code_example: | ```sh influxctl token create \ - --write-database \ - --read-database \ - + --read-database DATABASE1_NAME \ + --read-database DATABASE2_NAME \ + --write-database DATABASE2_NAME \ + "Read-only on DATABASE1_NAME, Read/write on DATABASE2_NAME" ``` +alt_engine: /influxdb/cloud-serverless/admin/tokens/create-token/ --- Use the [`influxctl token create` command](/influxdb/cloud-dedicated/reference/cli/influxctl/token/create/) @@ -23,17 +25,23 @@ to create a token that grants access to databases in your InfluxDB Cloud Dedicat 1. If you haven't already, [download and install the `influxctl` CLI](/influxdb/cloud-dedicated/reference/cli/influxctl/#download-and-install-influxctl). 2. Run the `influxctl token create` command and provide the following: - - Token permissions (read and write per database) - - `--read-database`: Grant read permissions to a database - - `--write-database`: Grant write permissions to a database + - Token permissions (read and write) + - `--read-database`: Grants read permissions to the specified database. Repeatable. + - `--write-database`: Grants write permissions to the specified database. Repeatable. - Token description +{{% code-placeholders "DATABASE_NAME|TOKEN_DESCRIPTION" %}} ```sh influxctl token create \ - --read-database \ - --write-database \ - + --read-database DATABASE_NAME \ + --write-database DATABASE_NAME \ + "Read/write token for DATABASE_NAME" ``` +{{% /code-placeholders %}} + +Replace the following: + +- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: your {{% cloud-name %}} database The command returns the token ID and the token string. **This is the only time the token string is available in plain text.** @@ -51,48 +59,58 @@ For example, see how to [authenticate Telegraf using tokens in your OS secret st #### Example token creation commands -{{< expand-wrapper >}} -{{% expand "Create a token with read and write access to a database" %}} +##### Create a token with read and write access to a database +{{% code-placeholders "DATABASE_NAME" %}} ```sh influxctl token create \ - --read-database mydb \ - --write-database mydb \ - "Read/write token for mydb" + --read-database DATABASE_NAME \ + --write-database DATABASE_NAME \ + "Read/write token for DATABASE_NAME" ``` +{{% /code-placeholders %}} -{{% /expand %}} -{{% expand "Create a token with read-only access to a database" %}} +Replace the following: +- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: your {{% cloud-name %}} database + +##### Create a token with read-only access to a database + +{{% code-placeholders "DATABASE_NAME" %}} ```sh influxctl token create \ - --read-database mydb \ - "Read-only token for mydb" + --read-database DATABASE_NAME \ + "Read-only token for DATABASE_NAME" ``` +{{% /code-placeholders %}} -{{% /expand %}} -{{% expand "Create a token with read-only access to multiple database" %}} +##### Create a token with read-only access to multiple databases +{{% code-placeholders "DATABASE_NAME|DATABASE2_NAME" %}} ```sh influxctl token create \ - --read-database mydb1 \ - --read-database mydb2 \ - "Read-only token for mydb1 and mydb2" + --read-database DATABASE_NAME \ + --read-database DATABASE2_NAME \ + "Read-only token for DATABASE_NAME and DATABASE2_NAME" ``` +{{% /code-placeholders %}} -{{% /expand %}} -{{% expand "Create a token with mixed permissions on multiple database" %}} +Replace the following: +- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: your {{% cloud-name %}} database +- {{% code-placeholder-key %}}`DATABASE2_NAME`{{% /code-placeholder-key %}}: your {{% cloud-name %}} database + +##### Create a token with mixed permissions to multiple databases + +{{% code-placeholders "DATABASE_NAME|DATABASE2_NAME" %}} ```sh influxctl token create \ - --read-database mydb1 \ - --read-database mydb2 \ - --write-database mydb2 \ - "Read-only on mydb1, Read/write on mydb2" + --read-database DATABASE_NAME \ + --read-database DATABASE2_NAME \ + --write-database DATABASE2_NAME \ + "Read-only on DATABASE_NAME, read/write on DATABASE2_NAME" ``` - -{{% /expand %}} -{{< /expand-wrapper >}} +{{% /code-placeholders %}} {{% note %}} #### Tokens cannot be updated diff --git a/content/influxdb/cloud-dedicated/reference/cli/influxctl/token/create.md b/content/influxdb/cloud-dedicated/reference/cli/influxctl/token/create.md index cb77e5c79..041c83956 100644 --- a/content/influxdb/cloud-dedicated/reference/cli/influxctl/token/create.md +++ b/content/influxdb/cloud-dedicated/reference/cli/influxctl/token/create.md @@ -40,48 +40,65 @@ influxctl token create \ | Flag | | Description | | :--- | :----------------- | :------------------------------------ | | `-h` | `--help` | Output command help | -| | `--read-database` | Grant read permissions to a database | -| | `--write-database` | Grant write permissions to a database | +| | `--read-database` | Grant read permissions to a database. Repeatable. | +| | `--write-database` | Grant write permissions to a database. Repeatable. | ## Examples - [Create a token with read and write access to a database](#create-a-token-with-read-and-write-access-to-a-database) - [Create a token with read-only access to a database](#create-a-token-with-read-only-access-to-a-database) -- [Create a token with read-only access to multiple database](#create-a-token-with-read-only-access-to-multiple-database) -- [Create a token with mixed permissions on multiple database](#create-a-token-with-mixed-permissions-on-multiple-database) +- [Create a token with read-only access to multiple databases](#create-a-token-with-read-only-access-to-multiple-databases) +- [Create a token with mixed permissions to multiple databases](#create-a-token-with-mixed-permissions-on-multiple-databases) ##### Create a token with read and write access to a database +{{% code-placeholders "DATABASE_NAME" %}} ```sh influxctl token create \ - --read-database mydb \ - --write-database mydb \ - "Read/write token for mydb" + --read-database DATABASE_NAME \ + --write-database DATABASE_NAME \ + "Read/write token for DATABASE_NAME" ``` +{{% /code-placeholders %}} + +Replace the following: + +- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: your {{% cloud-name %}} database ##### Create a token with read-only access to a database +{{% code-placeholders "DATABASE_NAME" %}} ```sh influxctl token create \ - --read-database mydb \ - "Read-only token for mydb" + --read-database DATABASE_NAME \ + "Read-only token for DATABASE_NAME" ``` +{{% /code-placeholders %}} -##### Create a token with read-only access to multiple database +##### Create a token with read-only access to multiple databases +{{% code-placeholders "DATABASE_NAME|DATABASE2_NAME" %}} ```sh influxctl token create \ - --read-database mydb1 \ - --read-database mydb2 \ - "Read-only token for mydb1 and mydb2" + --read-database DATABASE_NAME \ + --read-database DATABASE2_NAME \ + "Read-only token for DATABASE_NAME and DATABASE2_NAME" ``` +{{% /code-placeholders %}} -##### Create a token with mixed permissions on multiple database +Replace the following: +- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: your {{% cloud-name %}} database +- {{% code-placeholder-key %}}`DATABASE2_NAME`{{% /code-placeholder-key %}}: your {{% cloud-name %}} database + +##### Create a token with mixed permissions to multiple databases + +{{% code-placeholders "DATABASE_NAME|DATABASE2_NAME" %}} ```sh influxctl token create \ - --read-database mydb1 \ - --read-database mydb2 \ - --write-database mydb2 \ - "Read-only on mydb1, Read/write on mydb2" + --read-database DATABASE_NAME \ + --read-database DATABASE2_NAME \ + --write-database DATABASE2_NAME \ + "Read-only on DATABASE_NAME, read/write on DATABASE2_NAME" ``` +{{% /code-placeholders %}} diff --git a/content/influxdb/cloud-serverless/admin/tokens/create-token.md b/content/influxdb/cloud-serverless/admin/tokens/create-token.md index ed379c9af..cc4d28a7c 100644 --- a/content/influxdb/cloud-serverless/admin/tokens/create-token.md +++ b/content/influxdb/cloud-serverless/admin/tokens/create-token.md @@ -7,6 +7,7 @@ menu: name: Create a token parent: Manage tokens weight: 201 +alt_engine: /influxdb/cloud/security/tokens/create-token/ --- Create API tokens using the InfluxDB user interface (UI), the `influx` diff --git a/content/influxdb/cloud/security/tokens/create-token.md b/content/influxdb/cloud/security/tokens/create-token.md index 82eb47bba..00d62c9e8 100644 --- a/content/influxdb/cloud/security/tokens/create-token.md +++ b/content/influxdb/cloud/security/tokens/create-token.md @@ -7,6 +7,7 @@ menu: name: Create a token parent: Manage tokens weight: 201 +alt_engine: /influxdb/cloud-serverless/admin/tokens/create-token --- {{< duplicate-oss >}}