Merge pull request #6055 from influxdata/6020-add-code-placeholders-core-ent-examples

Add code-placeholders and tabbed examples for admin in Core and Enterprise
restructure-processing-engine-docs
Jameelah Mercer 2025-05-16 10:56:38 -07:00 committed by GitHub
commit 03bb8724ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 58 additions and 9 deletions

View File

@ -252,14 +252,34 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the
To create an admin token, use the `influxdb3 create token --admin` subcommand--for example:
{{< code-tabs-wrapper >}}
{{% code-tabs %}}
[CLI](#)
[Docker](#)
{{% /code-tabs %}}
{{% code-tab-content %}}
```bash
influxdb3 create token --admin \
--host http://{{< influxdb/host >}}
--host http://INFLUXDB_HOST
```
{{% /code-tab-content %}}
{{% code-tab-content %}}
{{% code-placeholders "CONTAINER_NAME" %}}
```bash
# With Docker -- In a new terminal, run:
# With Docker — in a new terminal:
docker exec -it CONTAINER_NAME influxdb3 create token --admin
```
{{% /code-placeholders %}}
Replace {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}} with the name of your running Docker container.
{{% /code-tab-content %}}
{{< /code-tabs-wrapper >}}
The command returns a token string that you can use to authenticate CLI commands and API requests.

View File

@ -282,14 +282,34 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the
To create an admin token, use the `influxdb3 create token --admin` subcommand--for example:
{{< code-tabs-wrapper >}}
{{% code-tabs %}}
[CLI](#)
[Docker](#)
{{% /code-tabs %}}
{{% code-tab-content %}}
```bash
influxdb3 create token --admin \
--host http://{{< influxdb/host >}}
--host http://INFLUXDB_HOST
```
{{% /code-tab-content %}}
{{% code-tab-content %}}
{{% code-placeholders "CONTAINER_NAME" %}}
```bash
# With Docker -- In a new terminal, run:
# With Docker — in a new terminal:
docker exec -it CONTAINER_NAME influxdb3 create token --admin
```
{{% /code-placeholders %}}
Replace {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}} with the name of your running Docker container.
{{% /code-tab-content %}}
{{< /code-tabs-wrapper >}}
The command returns a token string that you can use to authenticate CLI commands and API requests.
@ -316,6 +336,7 @@ To create a database token, use the `influxdb3 create token` subcommand and pass
The following example shows how to create a database token that expires in 90 days and has read and write permissions for all databases on the server:
{{% code-placeholders "ADMIN_TOKEN" %}}
```bash
influxdb3 create token \
--permission \
@ -327,8 +348,7 @@ influxdb3 create token \
```
{{% /code-placeholders %}}
In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}}
with the admin token you created earlier.
In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}} with the admin token you created earlier.
#### Create a system token
@ -355,6 +375,8 @@ To create a system token, use the `influxdb3 create token` subcommand and pass t
The following example shows how to create a system token that expires in 1 year and has read permissions for all system endpoints on the server:
{{% code-placeholders "ADMIN_TOKEN" %}}
```bash
influxdb3 create token \
--permission \
@ -364,6 +386,9 @@ influxdb3 create token \
--name "all system endpoints" \
"system:*:read"
```
{{% /code-placeholders %}}
In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}} with the admin token you created earlier.
For more information, see how to [Manage resource tokens](/influxdb3/version/admin/tokens/resource/).
@ -372,14 +397,18 @@ For more information, see how to [Manage resource tokens](/influxdb3/version/adm
- To authenticate `influxdb3` CLI commands, use the `--token` option or assign your
token to the `INFLUXDB3_AUTH_TOKEN` environment variable for `influxdb3` to use it automatically.
- To authenticate HTTP API requests, include `Bearer <TOKEN>` in the `Authorization` header value--for example:
{{% code-placeholders "SYSTEM_TOKEN" %}}
```bash
curl "http://{{< influxdb/host >}}/health" \
--header "Authorization: Bearer SYSTEM_TOKEN"
```
{{% /code-placeholders %}}
In your request, replace
{{% code-placeholder-key %}}`SYSTEM_TOKEN`{{% /code-placeholder-key %}} with the system token you created earlier.
Replace the following:
In your command, replace {{% code-placeholder-key %}}`SYSTEM_TOKEN`{{% /code-placeholder-key %}}: System token that grants access to system endpoints (`/health`, `/metrics`, etc.)
### Data model