Skip to content

Commit 03bb872

Browse files
authored
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
2 parents bc0430a + da0fde5 commit 03bb872

File tree

2 files changed

+58
-9
lines changed

2 files changed

+58
-9
lines changed

content/shared/v3-core-get-started/_index.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,34 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the
252252

253253
To create an admin token, use the `influxdb3 create token --admin` subcommand--for example:
254254

255+
{{< code-tabs-wrapper >}}
256+
257+
{{% code-tabs %}}
258+
[CLI](#)
259+
[Docker](#)
260+
{{% /code-tabs %}}
261+
{{% code-tab-content %}}
262+
255263
```bash
256264
influxdb3 create token --admin \
257-
--host http://{{< influxdb/host >}}
265+
--host http://INFLUXDB_HOST
258266
```
267+
268+
{{% /code-tab-content %}}
269+
{{% code-tab-content %}}
270+
271+
{{% code-placeholders "CONTAINER_NAME" %}}
259272
```bash
260-
# With Docker -- In a new terminal, run:
273+
# With Docker — in a new terminal:
261274
docker exec -it CONTAINER_NAME influxdb3 create token --admin
262275
```
276+
{{% /code-placeholders %}}
277+
278+
Replace {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}} with the name of your running Docker container.
279+
280+
{{% /code-tab-content %}}
281+
282+
{{< /code-tabs-wrapper >}}
263283

264284
The command returns a token string that you can use to authenticate CLI commands and API requests.
265285

content/shared/v3-enterprise-get-started/_index.md

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,34 @@ To have the `influxdb3` CLI use your admin token automatically, assign it to the
282282

283283
To create an admin token, use the `influxdb3 create token --admin` subcommand--for example:
284284

285+
{{< code-tabs-wrapper >}}
286+
287+
{{% code-tabs %}}
288+
[CLI](#)
289+
[Docker](#)
290+
{{% /code-tabs %}}
291+
{{% code-tab-content %}}
292+
285293
```bash
286294
influxdb3 create token --admin \
287-
--host http://{{< influxdb/host >}}
295+
--host http://INFLUXDB_HOST
288296
```
297+
298+
{{% /code-tab-content %}}
299+
{{% code-tab-content %}}
300+
301+
{{% code-placeholders "CONTAINER_NAME" %}}
289302
```bash
290-
# With Docker -- In a new terminal, run:
303+
# With Docker — in a new terminal:
291304
docker exec -it CONTAINER_NAME influxdb3 create token --admin
292305
```
306+
{{% /code-placeholders %}}
307+
308+
Replace {{% code-placeholder-key %}}`CONTAINER_NAME`{{% /code-placeholder-key %}} with the name of your running Docker container.
309+
310+
{{% /code-tab-content %}}
311+
312+
{{< /code-tabs-wrapper >}}
293313

294314
The command returns a token string that you can use to authenticate CLI commands and API requests.
295315

@@ -316,6 +336,7 @@ To create a database token, use the `influxdb3 create token` subcommand and pass
316336
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:
317337

318338
{{% code-placeholders "ADMIN_TOKEN" %}}
339+
319340
```bash
320341
influxdb3 create token \
321342
--permission \
@@ -327,8 +348,7 @@ influxdb3 create token \
327348
```
328349
{{% /code-placeholders %}}
329350

330-
In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}}
331-
with the admin token you created earlier.
351+
In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}} with the admin token you created earlier.
332352

333353
#### Create a system token
334354

@@ -355,6 +375,8 @@ To create a system token, use the `influxdb3 create token` subcommand and pass t
355375

356376
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:
357377

378+
{{% code-placeholders "ADMIN_TOKEN" %}}
379+
358380
```bash
359381
influxdb3 create token \
360382
--permission \
@@ -364,6 +386,9 @@ influxdb3 create token \
364386
--name "all system endpoints" \
365387
"system:*:read"
366388
```
389+
{{% /code-placeholders %}}
390+
391+
In your command, replace {{% code-placeholder-key %}} `ADMIN_TOKEN`{{% /code-placeholder-key %}} with the admin token you created earlier.
367392

368393
For more information, see how to [Manage resource tokens](/influxdb3/version/admin/tokens/resource/).
369394

@@ -372,14 +397,18 @@ For more information, see how to [Manage resource tokens](/influxdb3/version/adm
372397
- To authenticate `influxdb3` CLI commands, use the `--token` option or assign your
373398
token to the `INFLUXDB3_AUTH_TOKEN` environment variable for `influxdb3` to use it automatically.
374399
- To authenticate HTTP API requests, include `Bearer <TOKEN>` in the `Authorization` header value--for example:
375-
400+
401+
{{% code-placeholders "SYSTEM_TOKEN" %}}
402+
376403
```bash
377404
curl "http://{{< influxdb/host >}}/health" \
378405
--header "Authorization: Bearer SYSTEM_TOKEN"
379406
```
407+
{{% /code-placeholders %}}
408+
409+
Replace the following:
380410

381-
In your request, replace
382-
{{% code-placeholder-key %}}`SYSTEM_TOKEN`{{% /code-placeholder-key %}} with the system token you created earlier.
411+
In your command, replace {{% code-placeholder-key %}}`SYSTEM_TOKEN`{{% /code-placeholder-key %}}: System token that grants access to system endpoints (`/health`, `/metrics`, etc.)
383412

384413
### Data model
385414

0 commit comments

Comments
 (0)