Skip to content

Adding adequate CLI examples for creating triggers #6002

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
e481e68
updating database create for consistency
MeelahMe Apr 18, 2025
0c85184
Adding distinct cache value example
MeelahMe Apr 18, 2025
4746e6e
Adding a create last value cache example
MeelahMe Apr 18, 2025
22c9fc4
Adding a create plugin example
MeelahMe Apr 18, 2025
4f11fc1
adding a creating token example
MeelahMe Apr 18, 2025
4199554
Update content/shared/influxdb3-cli/create/token.md
MeelahMe Apr 18, 2025
d72eccd
Update content/shared/influxdb3-cli/create/token.md
MeelahMe Apr 18, 2025
7d6d7f1
Merge branch 'master' into 5949-add-api-reference-examples-to-influxdb3
MeelahMe Apr 30, 2025
07aded0
Remove plugin.md from create CLI commands
MeelahMe Apr 30, 2025
481575e
Remove plugin.md from delete CLI commands
MeelahMe Apr 30, 2025
98d8d6e
chore(cli): remove plugin.md files and references from create/delete …
MeelahMe Apr 30, 2025
dfd1a9c
chore(cli): remove create plugin.md from enterprise CLI reference
MeelahMe Apr 30, 2025
b16ea65
chore(cli): remove delete plugin.md from enterprise CLI reference
MeelahMe Apr 30, 2025
958e0a8
docs: revise create trigger examples for clarity and accuracy
MeelahMe May 1, 2025
289c24e
docs(cli): fix last_cache example flags and clarify placeholder keys
MeelahMe May 1, 2025
81d8863
docs(cli): correcting trigger disable example
MeelahMe May 1, 2025
1569829
Update content/shared/influxdb3-cli/create/distinct_cache.md
MeelahMe May 1, 2025
87cb056
docs(cli): updated and add tested examples and setup guidance for cr…
MeelahMe May 1, 2025
88ec6af
docs(cli): update table guide with query verification example
MeelahMe May 1, 2025
85310e1
docs: add examples and clarify usage for token, distinct_cache, and l…
MeelahMe May 1, 2025
b3be9de
docs(cli): minor updates to examples
MeelahMe May 1, 2025
f592009
Update content/shared/influxdb3-cli/create/distinct_cache.md
MeelahMe May 1, 2025
e659a0b
Update content/shared/influxdb3-cli/create/distinct_cache.md
MeelahMe May 1, 2025
b71dd9a
chore(cli): remove deprecated delete plugin reference
MeelahMe May 1, 2025
46a4d35
Merge branch '5949-add-api-reference-examples-to-influxdb3' of github…
MeelahMe May 1, 2025
e9bcb06
Update content/shared/influxdb3-cli/create/last_cache.md
MeelahMe May 1, 2025
dedf9ca
chore(cli): removing numbered list
MeelahMe May 2, 2025
eecde07
Merge branch '5949-add-api-reference-examples-to-influxdb3' of github…
MeelahMe May 2, 2025
38a9aaf
Merge branch 'master' into 5949-add-api-reference-examples-to-influxdb3
MeelahMe May 2, 2025
0f853d0
Merge branch 'master' into 5949-add-api-reference-examples-to-influxdb3
MeelahMe May 5, 2025
5ee9686
Merge branch 'master' into 5949-add-api-reference-examples-to-influxdb3
MeelahMe May 6, 2025
8988fb6
Merge branch 'master' into 5949-add-api-reference-examples-to-influxdb3
MeelahMe May 12, 2025
07c8b95
Merge branch 'master' into 5949-add-api-reference-examples-to-influxdb3
MeelahMe May 13, 2025
386cfc2
docs(cli): improve create database docs for clarity and style to data…
MeelahMe May 13, 2025
8f8bf55
Merge branch '5949-add-api-reference-examples-to-influxdb3' of github…
MeelahMe May 13, 2025
e6d8838
docs(cli): improve distinct_cache example section and placeholder gui…
MeelahMe May 13, 2025
994e848
WIP: update format
MeelahMe May 15, 2025
663cfc9
Merge branch 'master' into 5949-add-api-reference-examples-to-influxdb3
MeelahMe May 15, 2025
0cbfade
revising structure
MeelahMe May 15, 2025
5a843f5
docs(cli): improve distinct_cache structure
MeelahMe May 15, 2025
18a4413
docs(cli): add editable placeholders for database, table, and token i…
MeelahMe May 15, 2025
94b4228
Merge branch 'master' into 5949-add-api-reference-examples-to-influxdb3
MeelahMe May 16, 2025
0f8945f
Merge branch 'master' into 5949-add-api-reference-examples-to-influxdb3
MeelahMe May 16, 2025
8847d67
Update database.md
MeelahMe May 16, 2025
02c3a8b
Update revoke 2.md
MeelahMe May 16, 2025
b460338
Update database.md
MeelahMe May 16, 2025
21588fe
Update database.md
MeelahMe May 16, 2025
3edf4e7
Update database.md
MeelahMe May 16, 2025
9834fab
Update distinct_cache.md
MeelahMe May 16, 2025
dd8369b
Update last_cache.md
MeelahMe May 16, 2025
df24a22
Update last_cache.md
MeelahMe May 16, 2025
2ae9d67
Update table.md
MeelahMe May 16, 2025
af99904
Update table.md
MeelahMe May 16, 2025
2c3b3f8
Update table.md
MeelahMe May 16, 2025
7a39062
Update table.md
MeelahMe May 16, 2025
3a39a92
Update token.md
MeelahMe May 16, 2025
ef239ef
Update token.md
MeelahMe May 16, 2025
a2145f0
Update trigger.md
MeelahMe May 16, 2025
cf87936
Update trigger.md
MeelahMe May 16, 2025
6917097
Update trigger.md
MeelahMe May 16, 2025
7f1a3b6
Update trigger.md
MeelahMe May 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions content/influxdb3/clustered/admin/tokens/database/revoke 2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
---
title: Revoke a database token
description: >
Use the [`influxctl token revoke` command](/influxdb3/clustered/reference/cli/influxctl/token/revoke/)
to revoke a token from your InfluxDB cluster and disable all
permissions associated with the token.
Provide the ID of the token you want to revoke.
menu:
influxdb3_clustered:
parent: Database tokens
weight: 203
list_code_example: |
```sh
influxctl token revoke <TOKEN_ID>
```
aliases:
- /influxdb3/clustered/admin/tokens/delete/
- /influxdb3/clustered/admin/tokens/database/delete/
---

Use the [`influxctl token revoke` command](/influxdb3/clustered/reference/cli/influxctl/token/revoke/)
to revoke a database token from your {{< product-name omit=" Clustered" >}} cluster and disable
all permissions associated with the token.

1. If you haven't already, [download and install the `influxctl` CLI](/influxdb3/clustered/reference/cli/influxctl/#download-and-install-influxctl).
2. Run the [`influxctl token list` command](/influxdb3/clustered/reference/cli/influxctl/token/list)
to output tokens with their IDs.
Copy the **token ID** of the token you want to delete.

```sh
influxctl token list
```

3. Run the `influxctl token revoke` command and provide the following:

- Token ID to revoke

4. Confirm that you want to revoke the token.

{{% code-placeholders "TOKEN_ID" %}}
```sh
influxctl token revoke TOKEN_ID
```
{{% /code-placeholders %}}

> [!Warning]
> #### Revoking a token is immediate and cannot be undone
>
> Revoking a database token is a destructive action that takes place immediately
> and cannot be undone.
>
> #### Rotate revoked tokens
>
> After revoking a database token, any clients using the revoked token need to
> be updated with a new database token to continue to interact with your
> {{% product-name omit=" Clustered" %}} cluster.
15 changes: 0 additions & 15 deletions content/influxdb3/core/reference/cli/influxdb3/create/plugin.md

This file was deleted.

15 changes: 0 additions & 15 deletions content/influxdb3/core/reference/cli/influxdb3/delete/plugin.md

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion content/shared/influxdb3-cli/create/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ influxdb3 create <SUBCOMMAND>
| [file_index](/influxdb3/version/reference/cli/influxdb3/create/file_index/) | Create a new file index for a database or table |
| [last_cache](/influxdb3/version/reference/cli/influxdb3/create/last_cache/) | Create a new last value cache |
| [distinct_cache](/influxdb3/version/reference/cli/influxdb3/create/distinct_cache/) | Create a new distinct value cache |
| [plugin](/influxdb3/version/reference/cli/influxdb3/create/plugin/) | Create a new processing engine plugin |
| [table](/influxdb3/version/reference/cli/influxdb3/create/table/) | Create a new table in a database |
| [token](/influxdb3/version/reference/cli/influxdb3/create/token/) | Create a new authentication token |
| [trigger](/influxdb3/version/reference/cli/influxdb3/create/trigger/) | Create a new trigger for the processing engine |
Expand Down
26 changes: 14 additions & 12 deletions content/shared/influxdb3-cli/create/database.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
The `influxdb3 create database` command creates a new database in your {{< product-name >}} instance.

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

## Usage

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

## Arguments

- **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.

- **`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.

Environment variable: `INFLUXDB3_DATABASE_NAME`
You can also set the database name using the `INFLUXDB3_DATABASE_NAME` environment variable.

## Options

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

### Option environment variables

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

| Environment Variable | Option |
| :------------------------ | :----------- |
Expand All @@ -38,10 +38,7 @@ You can use the following environment variables to set command options:

## Examples

- [Create a new database](#create-a-new-database)
- [Create a new database while specifying the token inline](#create-a-new-database-while-specifying-the-token-inline)

In the examples below, replace the following:
Use the following examples to create a database. Replace the placeholders with your actual values:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reference docs are generally terse and 3rd person--we don't usually include "Use the..." like we do in the guides.
You could do

The following examples show to....

In your commands replace the following:
- {{% code-placeholder-key %}}
...


- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
Database name
Expand All @@ -50,15 +47,20 @@ In the examples below, replace the following:

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

### Create a new database
### Create a database (default)

Creates a database using settings from environment variables and defaults.

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

```bash
influxdb3 create database DATABASE_NAME
```

### Create a new database while specifying the token inline
### Create a database with an authentication token

Creates a database using the specified arguments.
Flags override their associated environment variables.

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

Expand Down
75 changes: 70 additions & 5 deletions content/shared/influxdb3-cli/create/distinct_cache.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
The `influxdb3 create distinct_cache` command creates a new distinct value cache for a specific table and column set in your {{< product-name >}} instance.

The `influxdb3 create distinct_cache` command creates a new distinct value cache.
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.

## Usage

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

## Arguments

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

## Options
## Options

| Option | | Description |
| :----- | :------------------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand Down Expand Up @@ -52,4 +52,69 @@ You can use the following environment variables to set command options:
| `INFLUXDB3_DATABASE_NAME` | `--database` |
| `INFLUXDB3_AUTH_TOKEN` | `--token` |

<!-- TODO: GET EXAMPLES -->

## Prerequisites

Before creating a distinct value cache, make sure you:

1. [Create a database](/influxdb3/version/reference/cli/influxdb3/create/database/)

2. [Create a table](/influxdb3/version/reference/cli/influxdb3/create/table/) that includes the columns you want to cache

3. Have a valid authentication token

## Examples

Before running the following commands, replace the placeholder values with your own:

- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}:
Database name
- {{% code-placeholder-key %}}`TABLE_NAME`{{% /code-placeholder-key %}}:
Table name
- {{% code-placeholder-key %}}`CACHE_NAME`{{% /code-placeholder-key %}}:
Name of the distinct value cache to create
- {{% code-placeholder-key %}}`COLUMN_NAME`{{% /code-placeholder-key %}}: Column to
cache distinct values from

You can also set environment variables (such as `INFLUXDB3_AUTH_TOKEN`) instead of passing options inline.

{{% code-placeholders "(DATABASE|TABLE|COLUMN|CACHE)_NAME" %}}

### Create a distinct cache for one column

Track unique values from a single column. This setup is useful for testing or simple use cases.

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

```bash
influxdb3 create distinct_cache \
--database DATABASE_NAME \
--table TABLE_NAME \
--column COLUMN_NAME \
CACHE_NAME
```

### Create a hierarchical cache with constraints

Create a distinct value cache for multiple columns. This configuration tracks unique combinations of `room` and `sensor_id`, and sets limits on the number of entries and their maximum age.

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

```bash
influxdb3 create distinct_cache \
--database my_test_db \
--table my_sensor_table \
--columns room,sensor_id \
--max-cardinality 1000 \
--max-age 30d \
my_sensor_distinct_cache
```

{{% /code-placeholders %}}

## Common pitfalls

- `--column` is not valid. Use `--columns`.
- Tokens must be included explicitly unless set via `INFLUXDB3_AUTH_TOKEN`
- Table and column names must already exist or be recognized by the engine

74 changes: 67 additions & 7 deletions content/shared/influxdb3-cli/create/last_cache.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@

The `influxdb3 create last_cache` command creates a new last value cache.
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.

## Usage

{{% code-placeholders "DATABASE_NAME|TABLE_NAME|AUTH_TOKEN|CACHE_NAME" %}}

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

```bash
influxdb3 create last_cache [OPTIONS] --database <DATABASE_NAME> --table <TABLE> [CACHE_NAME]
influxdb3 create last_cache [OPTIONS] \
--database DATABASE_NAME \
--table TABLE_NAME \
--token AUTH_TOKEN \
CACHE_NAME
```
{{% /code-placeholders %}}

## Arguments

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

## Options

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

### Option environment variables

You can use the following environment variables to set command options:
You can use the following environment variables as substitutes for CLI options:

| Environment Variable | Option |
| :------------------------ | :----------- |
| `INFLUXDB3_HOST_URL` | `--host` |
| `INFLUXDB3_DATABASE_NAME` | `--database` |
| `INFLUXDB3_AUTH_TOKEN` | `--token` |

<!-- TODO: GET EXAMPLES -->
## Prerequisites

Before creating a last value cache, ensure you’ve done the following:

- Create a [database](/influxdb3/version/reference/cli/influxdb3/create/database/).
- Create a [table](/influxdb3/version/reference/cli/influxdb3/create/table/) with the columns you want to cache.
- Have a valid authentication token.

## Examples

A last value cache stores the most recent values from specified columns in a table.

### Create a basic last value cache for one column

The following example shows how to track the most recent value for a single key (the last temperature for each room):

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

```bash
influxdb3 create last_cache \
--database DATABASE_NAME \
--table my_sensor_table \
--token AUTH_TOKEN \
--key-columns room \
--value-columns temp \
my_temp_cache
```

### Create a last value cache with multiple keys and values

The following example shows how to:

- Use multiple columns as a composite key
- Track several values per key combination
- Set a cache entry limit with `--count`
- Configure automatic expiry with `--ttl`

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

```bash
influxdb3 create last_cache \
--database DATABASE_NAME \
--table my_sensor_table \
--token AUTH_TOKEN \
--key-columns room,sensor_id \
--value-columns temp,hum \
--count 10 \
--ttl 1h \
my_sensor_cache
```
Comment on lines +80 to +97
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


## Usage notes

- All specified key and value columns must exist in the table schema.
- Tokens must be passed with `--token` unless set via environment variable.
- If not specified, default values are used for `--count` and `--ttl`.
Comment on lines +101 to +103
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer active voice.

Loading