Skip to content

Commit 2cd8687

Browse files
authored
Merge pull request #6002 from influxdata/5949-add-api-reference-examples-to-influxdb3
Adding adequate CLI examples for creating triggers
2 parents 03bb872 + 9da9b85 commit 2cd8687

File tree

15 files changed

+353
-212
lines changed

15 files changed

+353
-212
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
---
2+
title: Revoke a database token
3+
description: >
4+
Use the [`influxctl token revoke` command](/influxdb3/clustered/reference/cli/influxctl/token/revoke/)
5+
to revoke a token from your InfluxDB cluster and disable all
6+
permissions associated with the token.
7+
Provide the ID of the token you want to revoke.
8+
menu:
9+
influxdb3_clustered:
10+
parent: Database tokens
11+
weight: 203
12+
list_code_example: |
13+
```sh
14+
influxctl token revoke <TOKEN_ID>
15+
```
16+
aliases:
17+
- /influxdb3/clustered/admin/tokens/delete/
18+
- /influxdb3/clustered/admin/tokens/database/delete/
19+
---
20+
21+
Use the [`influxctl token revoke` command](/influxdb3/clustered/reference/cli/influxctl/token/revoke/)
22+
to revoke a database token from your {{< product-name omit=" Clustered" >}} cluster and disable
23+
all permissions associated with the token.
24+
25+
1. If you haven't already, [download and install the `influxctl` CLI](/influxdb3/clustered/reference/cli/influxctl/#download-and-install-influxctl).
26+
2. Run the [`influxctl token list` command](/influxdb3/clustered/reference/cli/influxctl/token/list)
27+
to output tokens with their IDs.
28+
Copy the **token ID** of the token you want to delete.
29+
30+
```sh
31+
influxctl token list
32+
```
33+
34+
3. Run the `influxctl token revoke` command and provide the following:
35+
36+
- Token ID to revoke
37+
38+
4. Confirm that you want to revoke the token.
39+
40+
{{% code-placeholders "TOKEN_ID" %}}
41+
```sh
42+
influxctl token revoke TOKEN_ID
43+
```
44+
{{% /code-placeholders %}}
45+
46+
> [!Warning]
47+
> #### Revoking a token is immediate and cannot be undone
48+
>
49+
> Revoking a database token is a destructive action that takes place immediately
50+
> and cannot be undone.
51+
>
52+
> #### Rotate revoked tokens
53+
>
54+
> After revoking a database token, any clients using the revoked token need to
55+
> be updated with a new database token to continue to interact with your
56+
> {{% product-name omit=" Clustered" %}} cluster.

content/influxdb3/core/reference/cli/influxdb3/create/plugin.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

content/influxdb3/core/reference/cli/influxdb3/delete/plugin.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

content/influxdb3/enterprise/reference/cli/influxdb3/create/plugin.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

content/influxdb3/enterprise/reference/cli/influxdb3/delete/plugin.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

content/shared/influxdb3-cli/create/_index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ influxdb3 create <SUBCOMMAND>
1818
| [file_index](/influxdb3/version/reference/cli/influxdb3/create/file_index/) | Create a new file index for a database or table |
1919
| [last_cache](/influxdb3/version/reference/cli/influxdb3/create/last_cache/) | Create a new last value cache |
2020
| [distinct_cache](/influxdb3/version/reference/cli/influxdb3/create/distinct_cache/) | Create a new distinct value cache |
21-
| [plugin](/influxdb3/version/reference/cli/influxdb3/create/plugin/) | Create a new processing engine plugin |
2221
| [table](/influxdb3/version/reference/cli/influxdb3/create/table/) | Create a new table in a database |
2322
| [token](/influxdb3/version/reference/cli/influxdb3/create/token/) | Create a new authentication token |
2423
| [trigger](/influxdb3/version/reference/cli/influxdb3/create/trigger/) | Create a new trigger for the processing engine |

content/shared/influxdb3-cli/create/database.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
The `influxdb3 create database` command creates a new database in your {{< product-name >}} instance.
12

2-
The `influxdb3 create database` command creates a new database.
3+
Provide a database name and, optionally, specify connection settings and authentication credentials using flags or environment variables.
34

45
## Usage
56

@@ -11,11 +12,10 @@ influxdb3 create database [OPTIONS] <DATABASE_NAME>
1112

1213
## Arguments
1314

14-
- **DATABASE_NAME**: The name of the database to create.
15-
Valid database names are alphanumeric and start with a letter or number.
16-
Dashes (`-`) and underscores (`_`) are allowed.
15+
16+
- **`DATABASE_NAME`**: The name of the database to create. Valid database names are alphanumeric and start with a letter or number. Dashes (-) and underscores (_) are allowed.
1717

18-
Environment variable: `INFLUXDB3_DATABASE_NAME`
18+
You can also set the database name using the `INFLUXDB3_DATABASE_NAME` environment variable.
1919

2020
## Options
2121

@@ -29,7 +29,7 @@ influxdb3 create database [OPTIONS] <DATABASE_NAME>
2929

3030
### Option environment variables
3131

32-
You can use the following environment variables to set command options:
32+
You can use the following environment variables instead of providing CLI options directly:
3333

3434
| Environment Variable | Option |
3535
| :------------------------ | :----------- |
@@ -38,27 +38,30 @@ You can use the following environment variables to set command options:
3838

3939
## Examples
4040

41-
- [Create a new database](#create-a-new-database)
42-
- [Create a new database while specifying the token inline](#create-a-new-database-while-specifying-the-token-inline)
43-
44-
In the examples below, replace the following:
41+
The following examples show how to create a database.
4542

43+
In your commands replace the following:
4644
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
4745
Database name
4846
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}:
4947
Authentication token
5048

5149
{{% code-placeholders "DATABASE_NAME|AUTH_TOKEN" %}}
5250

53-
### Create a new database
51+
### Create a database (default)
52+
53+
Creates a database using settings from environment variables and defaults.
5454

5555
<!--pytest.mark.skip-->
5656

5757
```bash
5858
influxdb3 create database DATABASE_NAME
5959
```
6060

61-
### Create a new database while specifying the token inline
61+
### Create a database with an authentication token
62+
63+
Creates a database using the specified arguments.
64+
Flags override their associated environment variables.
6265

6366
<!--pytest.mark.skip-->
6467

content/shared/influxdb3-cli/create/distinct_cache.md

Lines changed: 70 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
The `influxdb3 create distinct_cache` command creates a new distinct value cache for a specific table and column set in your {{< product-name >}} instance.
12

2-
The `influxdb3 create distinct_cache` command creates a new distinct value cache.
3+
Use this command to configure a cache that tracks unique values in specified columns. You must provide the database, token, table, and columns. Optionally, you can specify a name for the cache.
34

45
## Usage
56

@@ -16,10 +17,9 @@ influxdb3 create distinct_cache [OPTIONS] \
1617

1718
## Arguments
1819

19-
- **CACHE_NAME**: _(Optional)_ Name for the cache.
20-
If not provided, the command automatically generates a name.
20+
- **`CACHE_NAME`**: _(Optional)_ A name to assign to the cache. If omitted, the CLI generates a name automatically.
2121

22-
## Options
22+
## Options
2323

2424
| Option | | Description |
2525
| :----- | :------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -52,4 +52,69 @@ You can use the following environment variables to set command options:
5252
| `INFLUXDB3_DATABASE_NAME` | `--database` |
5353
| `INFLUXDB3_AUTH_TOKEN` | `--token` |
5454

55-
<!-- TODO: GET EXAMPLES -->
55+
56+
## Prerequisites
57+
58+
Before creating a distinct value cache, make sure you:
59+
60+
1. [Create a database](/influxdb3/version/reference/cli/influxdb3/create/database/)
61+
62+
2. [Create a table](/influxdb3/version/reference/cli/influxdb3/create/table/) that includes the columns you want to cache
63+
64+
3. Have a valid authentication token
65+
66+
## Examples
67+
68+
Before running the following commands, replace the placeholder values with your own:
69+
70+
- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
71+
The database name
72+
- {{% code-placeholder-key %}}`TABLE_NAME`{{% /code-placeholder-key %}}:
73+
The name of the table to cache values from
74+
- {{% code-placeholder-key %}}`CACHE_NAME`{{% /code-placeholder-key %}}:
75+
The name of the distinct value cache to create
76+
- {{% code-placeholder-key %}}`COLUMN_NAME`{{% /code-placeholder-key %}}: The column to
77+
cache distinct values from
78+
79+
You can also set environment variables (such as `INFLUXDB3_AUTH_TOKEN`) instead of passing options inline.
80+
81+
{{% code-placeholders "(DATABASE|TABLE|COLUMN|CACHE)_NAME" %}}
82+
83+
### Create a distinct cache for one column
84+
85+
Track unique values from a single column. This setup is useful for testing or simple use cases.
86+
87+
<!--pytest.mark.skip-->
88+
89+
```bash
90+
influxdb3 create distinct_cache \
91+
--database DATABASE_NAME \
92+
--table TABLE_NAME \
93+
--column COLUMN_NAME \
94+
CACHE_NAME
95+
```
96+
97+
### Create a hierarchical cache with constraints
98+
99+
Create a distinct value cache for multiple columns. The following example tracks unique combinations of `room` and `sensor_id`, and sets limits on the number of entries and their maximum age.
100+
101+
<!--pytest.mark.skip-->
102+
103+
```bash
104+
influxdb3 create distinct_cache \
105+
--database my_test_db \
106+
--table my_sensor_table \
107+
--columns room,sensor_id \
108+
--max-cardinality 1000 \
109+
--max-age 30d \
110+
my_sensor_distinct_cache
111+
```
112+
113+
{{% /code-placeholders %}}
114+
115+
## Common pitfalls
116+
117+
- `--column` is not valid. Use `--columns`.
118+
- Tokens must be included explicitly unless set via `INFLUXDB3_AUTH_TOKEN`
119+
- Table and column names must already exist or be recognized by the engine
120+

content/shared/influxdb3-cli/create/last_cache.md

Lines changed: 67 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
1-
2-
The `influxdb3 create last_cache` command creates a new last value cache.
1+
The `influxdb3 create last_cache` command creates a last value cache, which stores the most recent values for specified columns in a table. Use this to efficiently retrieve the latest values based on key column combinations.
32

43
## Usage
54

5+
{{% code-placeholders "DATABASE_NAME|TABLE_NAME|AUTH_TOKEN|CACHE_NAME" %}}
6+
67
<!--pytest.mark.skip-->
78

89
```bash
9-
influxdb3 create last_cache [OPTIONS] --database <DATABASE_NAME> --table <TABLE> [CACHE_NAME]
10+
influxdb3 create last_cache [OPTIONS] \
11+
--database DATABASE_NAME \
12+
--table TABLE_NAME \
13+
--token AUTH_TOKEN \
14+
CACHE_NAME
1015
```
16+
{{% /code-placeholders %}}
1117

1218
## Arguments
1319

14-
- **CACHE_NAME**: _(Optional)_ Name for the cache.
15-
If not provided, the command automatically generates a name.
20+
- **CACHE_NAME**: _(Optional)_ Name for the cache. If omitted, InfluxDB automatically generates one.
1621

1722
## Options
1823

@@ -32,12 +37,67 @@ influxdb3 create last_cache [OPTIONS] --database <DATABASE_NAME> --table <TABLE>
3237

3338
### Option environment variables
3439

35-
You can use the following environment variables to set command options:
40+
You can use the following environment variables as substitutes for CLI options:
3641

3742
| Environment Variable | Option |
3843
| :------------------------ | :----------- |
3944
| `INFLUXDB3_HOST_URL` | `--host` |
4045
| `INFLUXDB3_DATABASE_NAME` | `--database` |
4146
| `INFLUXDB3_AUTH_TOKEN` | `--token` |
4247

43-
<!-- TODO: GET EXAMPLES -->
48+
## Prerequisites
49+
50+
Before creating a last value cache, ensure you’ve done the following:
51+
52+
- Create a [database](/influxdb3/version/reference/cli/influxdb3/create/database/).
53+
- Create a [table](/influxdb3/version/reference/cli/influxdb3/create/table/) with the columns you want to cache.
54+
- Have a valid authentication token.
55+
56+
## Examples
57+
58+
A last value cache stores the most recent values from specified columns in a table.
59+
60+
### Create a basic last value cache for one column
61+
62+
The following example shows how to track the most recent value for a single key (the last temperature for each room):
63+
64+
<!--pytest.mark.skip-->
65+
66+
```bash
67+
influxdb3 create last_cache \
68+
--database DATABASE_NAME \
69+
--table my_sensor_table \
70+
--token AUTH_TOKEN \
71+
--key-columns room \
72+
--value-columns temp \
73+
my_temp_cache
74+
```
75+
76+
### Create a last value cache with multiple keys and values
77+
78+
The following example shows how to:
79+
80+
- Use multiple columns as a composite key
81+
- Track several values per key combination
82+
- Set a cache entry limit with `--count`
83+
- Configure automatic expiry with `--ttl`
84+
85+
<!--pytest.mark.skip-->
86+
87+
```bash
88+
influxdb3 create last_cache \
89+
--database DATABASE_NAME \
90+
--table my_sensor_table \
91+
--token AUTH_TOKEN \
92+
--key-columns room,sensor_id \
93+
--value-columns temp,hum \
94+
--count 10 \
95+
--ttl 1h \
96+
my_sensor_cache
97+
```
98+
99+
## Usage notes
100+
101+
- Define the table schema to include all specified key and value columns.
102+
- Pass tokens using `--token`, unless you've set one through an environment variable.
103+
- Specify `--count` and `--ttl` to override the defaults; otherwise, the system uses default values.

0 commit comments

Comments
 (0)