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

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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

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
31 changes: 30 additions & 1 deletion content/shared/influxdb3-cli/create/distinct_cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,33 @@ You can use the following environment variables to set command options:
| `INFLUXDB3_DATABASE_NAME` | `--database` |
| `INFLUXDB3_AUTH_TOKEN` | `--token` |

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

### Create a distinct value cache

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

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

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

{{% /code-placeholders %}}

In the example above, replace the following:

- {{% 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



27 changes: 26 additions & 1 deletion content/shared/influxdb3-cli/create/last_cache.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,29 @@ You can use the following environment variables to set command options:
| `INFLUXDB3_DATABASE_NAME` | `--database` |
| `INFLUXDB3_AUTH_TOKEN` | `--token` |

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

### Create a last value cache

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

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

```bash
influxdb3 create last_cache \
--database DATABASE_NAME \
--table TABLE_NAME \
--key-columns TAG_COLUMN \
--value-columns FIELD_COLUMN \
CACHE_NAME
```

{{% /code-placeholders %}}

In the example above, replace the following:

- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: Database name
- {{% code-placeholder-key %}}`TABLE_NAME`{{% /code-placeholder-key %}}: Table name
- {{% code-placeholder-key %}}`TAG_COLUMN`{{% /code-placeholder-key %}}: Column to use as the key in the cache
- {{% code-placeholder-key %}}`FIELD_COLUMN`{{% /code-placeholder-key %}}: Column to store as the value in the cache
- {{% code-placeholder-key %}}`CACHE_NAME`{{% /code-placeholder-key %}}: Optional name for the last value cache
45 changes: 0 additions & 45 deletions content/shared/influxdb3-cli/create/plugin.md

This file was deleted.

15 changes: 9 additions & 6 deletions content/shared/influxdb3-cli/create/token.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The `influxdb3 create token` command creates a new authentication token.
<!--pytest.mark.skip-->

```bash
influxdb3 create token <COMMAND> [OPTIONS]
influxdb3 create token <SUBCOMMAND>
```

## Commands
Expand All @@ -18,15 +18,18 @@ influxdb3 create token <COMMAND> [OPTIONS]

## Options

| Option | | Description |
| :----- | :----------- | :------------------------------ |
| `-h` | `--help` | Print help information |
| | `--help-all` | Print detailed help information |
| Option | | Description |
| :----- | :------- | :--------------------- |
| |`--admin`| Create an admin token |
| `-h` | `--help` | Print help information |


## Examples

### Create an admin token

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

```bash
influxdb3 create token --admin
```
```
65 changes: 62 additions & 3 deletions content/shared/influxdb3-cli/create/trigger.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ processing engine.
influxdb3 create trigger [OPTIONS] \
--database <DATABASE_NAME> \
--token <AUTH_TOKEN> \
--plugin <PLUGIN_NAME> \
--trigger-spec <TRIGGER_SPECIFICATION> \
<TRIGGER_NAME>
```
Expand All @@ -26,7 +25,6 @@ influxdb3 create trigger [OPTIONS] \
| `-H` | `--host` | Host URL of the running {{< product-name >}} server (default is `http://127.0.0.1:8181`) |
| `-d` | `--database` | _({{< req >}})_ Name of the database to operate on |
| | `--token` | _({{< req >}})_ Authentication token |
| | `--plugin` | Plugin to execute when the trigger fires |
| | `--trigger-spec` | Trigger specification--for example `table:<TABLE_NAME>` or `all_tables` |
| | `--disabled` | Create the trigger in disabled state |
| | `--tls-ca` | Path to a custom TLS certificate authority (for testing or self-signed certificates) |
Expand All @@ -43,4 +41,65 @@ You can use the following environment variables to set command options:
| `INFLUXDB3_DATABASE_NAME` | `--database` |
| `INFLUXDB3_AUTH_TOKEN` | `--token` |

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

The following examples show how to use the `influxdb3 create trigger` command to create triggers in different scenarios.


- {{% code-placeholder-key %}}`DATABASE_NAME`{{% /code-placeholder-key %}}: Database name
- {{% code-placeholder-key %}}`AUTH_TOKEN`{{% /code-placeholder-key %}}:
Authentication token
- {{% code-placeholder-key %}}`TRIGGER_NAME`{{% /code-placeholder-key %}}:
Name of the trigger to create
- {{% code-placeholder-key %}}`TABLE_NAME`{{% /code-placeholder-key %}}:
Name of the table to trigger on

{{% code-placeholders "(DATABASE|TRIGGER)_NAME|AUTH_TOKEN|TABLE_NAME" %}}

### Create a trigger for a specific table

Use this command to create a trigger that processes data from a specific table.

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

```bash
influxdb3 create trigger \
--database DATABASE_NAME \
--token AUTH_TOKEN \
--trigger-spec table:TABLE_NAME \
TRIGGER_NAME
```

### Create a trigger for all tables

Use this command to create a trigger that applies to all tables in the specified database.

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

```bash
influxdb3 create trigger \
--database DATABASE_NAME \
--token AUTH_TOKEN \
--trigger-spec all_tables \
TRIGGER_NAME
```

This is useful when you want a trigger to apply to any table in the database, regardless of name.

### Create a disabled trigger

Use this command to create a trigger in a disabled state.

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

```bash
influxdb3 create trigger \
--disabled \
--database DATABASE_NAME \
--token AUTH_TOKEN \
--trigger-spec table:TABLE_NAME \
TRIGGER_NAME
```
Creating a trigger in a disabled state prevents it from running immediately. You can enable it later when you're ready to activate it.

{{% /code-placeholders %}}
2 changes: 1 addition & 1 deletion content/shared/influxdb3-cli/delete/database.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ influxdb3 delete database [OPTIONS] <DATABASE_NAME>

## Arguments

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

Environment variable: `INFLUXDB3_DATABASE_NAME`

Expand Down
61 changes: 0 additions & 61 deletions content/shared/influxdb3-cli/delete/plugin.md

This file was deleted.