Merge pull request #1125 from influxdata/cli-misc-updates

Miscellaneous CLI updates
pull/1149/head
Scott Anderson 2020-06-22 14:18:45 -06:00 committed by GitHub
commit d1fc31cdd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 97 additions and 31 deletions

View File

@ -30,7 +30,8 @@ influx apply [flags]
| | `--disable-table-borders` | Disable table borders | | | | | `--disable-table-borders` | Disable table borders | | |
| `-e` | `--encoding` | Encoding of the input stream | string | | | `-e` | `--encoding` | Encoding of the input stream | string | |
| | `--env-ref` | Environment references to provide with the template (format: `--env-ref=REF_KEY=REF_VALUE`) | string | | | | `--env-ref` | Environment references to provide with the template (format: `--env-ref=REF_KEY=REF_VALUE`) | string | |
| `-f` | `--file` | Path to template file | string | | | `-f` | `--file` | Path to template file (supports HTTP(S) URLs or file paths) | string | |
| | `--filter` | Resources to skip when applying the template (filter by `kind` or `resource`) | string | |
| | `--force` | Ignore warnings about destructive changes | | | | | `--force` | Ignore warnings about destructive changes | | |
| `-h` | `--help` | Help for the `apply` command | | | | `-h` | `--help` | Help for the `apply` command | | |
| | `--json` | Output data as JSON | | `INFLUX_OUTPUT_JSON` | | | `--json` | Output data as JSON | | `INFLUX_OUTPUT_JSON` |
@ -40,7 +41,6 @@ influx apply [flags]
| `-R` | `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | | | | `-R` | `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | | |
| | `--secret` | Secrets to provide with the template (format: `--secret=SECRET_KEY=SECRET_VALUE`) | string | | | | `--secret` | Secrets to provide with the template (format: `--secret=SECRET_KEY=SECRET_VALUE`) | string | |
| | `--stack-id` | Stack ID to associate when applying the template | string | | | | `--stack-id` | Stack ID to associate when applying the template | string | |
| `-u` | `--template-url` | URL of template file | string | |
{{% cli/influx-global-flags %}} {{% cli/influx-global-flags %}}
@ -49,6 +49,9 @@ influx apply [flags]
# Apply a template from a file. # Apply a template from a file.
influx apply -f path/to/template.json influx apply -f path/to/template.json
# Apply a template from a URL.
influx apply -f https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml
# Apply a stack that has associated templates. # Apply a stack that has associated templates.
influx apply --stack-id $STACK_ID influx apply --stack-id $STACK_ID
@ -61,9 +64,6 @@ influx apply \
-f path/to/template_1.json \ -f path/to/template_1.json \
-f path/to/template_2.yml -f path/to/template_2.yml
# Apply a template from a URL.
influx apply -u https://raw.githubusercontent.com/influxdata/community-templates/master/docker/docker.yml
# Apply a template from STDIN. # Apply a template from STDIN.
cat template.json | influx apply --encoding json cat template.json | influx apply --encoding json
@ -78,4 +78,16 @@ influx apply \
-f path/to/template.yml -f path/to/template.yml
-f path/to/templates_directory -f path/to/templates_directory
-u https://example.com/template.json -u https://example.com/template.json
# Apply a template, but skip resources. The following example skips all buckets
# and the dashboard whose metadata.name field matches "example-dashboard".
# Filter format:
# --filter=kind=Bucket
# --filter=resource=Label:$Label_TMPL_NAME
influx apply \
-f path/to/template.yml \
--filter kind=Bucket \
--filter resource=Dashboard:example-dashboard
``` ```

View File

@ -9,8 +9,8 @@ weight: 101
v2.0/tags: [config] v2.0/tags: [config]
--- ---
The `influx config` command manages multiple InfluxDB connection configurations The `influx config` command displays the active InfluxDB connection configuration
file (by default, stored at `~/.influxdbv2/configs`). and manages multiple connection configurations stored, by default, in `~/.influxdbv2/configs`.
Each connection includes a URL, token, associated organization, and active setting. Each connection includes a URL, token, associated organization, and active setting.
InfluxDB reads the token from the active connection configuration, so you don't InfluxDB reads the token from the active connection configuration, so you don't
have to manually enter a token to log into InfluxDB. have to manually enter a token to log into InfluxDB.
@ -19,6 +19,7 @@ have to manually enter a token to log into InfluxDB.
``` ```
influx config [flags] influx config [flags]
influx config [command] influx config [command]
influx config <config-name>
``` ```
##### Quickly switch between configurations ##### Quickly switch between configurations
@ -36,6 +37,15 @@ To quickly switch back to the previous configuration, use the following command:
influx config - influx config -
``` ```
## Examples
```sh
# Show the active connection configuration
influx config
# Set a connection configuration as active
influx config local-config
```
## Subcommands ## Subcommands
| Subcommand | Description | | Subcommand | Description |
|:---- |:----------- | |:---- |:----------- |

View File

@ -28,3 +28,20 @@ influx config create [flags]
| `-u` | `--url` | (**Required**) Connection URL for the new configuration. | string | | | `-u` | `--url` | (**Required**) Connection URL for the new configuration. | string | |
{{% cli/influx-global-flags %}} {{% cli/influx-global-flags %}}
## Examples
```sh
# Create a connection configuration and set it active
influx config create --active \
-n config-name \
-u http://localhost:9999 \
-t mySuP3rS3cr3tT0keN \
-o example-org
# Create a connection configuration without setting it active
influx config create \
-n config-name \
-u http://localhost:9999 \
-t mySuP3rS3cr3tT0keN \
-o example-org
```

View File

@ -1,27 +1,41 @@
--- ---
title: influx config delete title: influx config rm
description: The 'influx config delete' command deletes an InfluxDB connection configuration. description: The 'influx config rm' command removes an InfluxDB connection configuration.
menu: menu:
v2_0_ref: v2_0_ref:
name: influx config delete name: influx config rm
parent: influx config parent: influx config
weight: 201 weight: 201
aliases:
- /v2.0/reference/cli/influx/config/delete/
--- ---
The `influx config delete` command deletes an InfluxDB connection configuration The `influx config rm` command removes an InfluxDB connection configuration
from the `configs` file (by default, stored at `~/.influxdbv2/configs`). from the `configs` file (by default, stored at `~/.influxdbv2/configs`).
## Usage ## Usage
``` ```
influx config delete [flags] influx config rm <config-name> [flags]
``` ```
#### Aliases
`rm`, `remove`, `delete`
## Flags ## Flags
| Flag | | Description | Input type | {{< cli/mapped >}} | | Flag | | Description | Input type | {{< cli/mapped >}} |
|:---- |:--- |:----------- |:----------: |:------------------ | |:---- |:--- |:----------- |:----------: |:------------------ |
| `-h` | `--help` | Help for the `delete` command | | | | `-h` | `--help` | Help for the `delete` command | | |
| | `--hide-headers` | Hide table headers (default `false`) | | `INFLUX_HIDE_HEADERS` | | | `--hide-headers` | Hide table headers (default `false`) | | `INFLUX_HIDE_HEADERS` |
| | `--json` | Output data as JSON (default `false`) | | `INFLUX_OUTPUT_JSON` | | | `--json` | Output data as JSON (default `false`) | | `INFLUX_OUTPUT_JSON` |
| `-n` | `--name` | (**Required**) Name of InfluxDB connection configuration to delete | string | |
{{% cli/influx-global-flags %}} {{% cli/influx-global-flags %}}
## Examples
```sh
# Delete a connection configuration
influx config rm local-config
# Delete multiple connection configurations
influx config rm config-1 config-2
```

View File

@ -28,6 +28,21 @@ influx config set [flags]
| | `--json` | Output data as JSON (default `false`) | | `INFLUX_OUTPUT_JSON` | | | `--json` | Output data as JSON (default `false`) | | `INFLUX_OUTPUT_JSON` |
| `-n` | --name` | Name for the InfluxDB connection configuration to set or update | string | | | `-n` | --name` | Name for the InfluxDB connection configuration to set or update | string | |
| `-o` | `--org` | Organization name for the connection configuration | string | | | `-o` | `--org` | Organization name for the connection configuration | string | |
| `-u` | --url` | (**Required**) URL for InfluxDB connection configuration to set or update | string | | | `-u` | --url` | URL for InfluxDB connection configuration to set or update | string | |
{{% cli/influx-global-flags %}} {{% cli/influx-global-flags %}}
## Examples
```sh
# Update a connection configuration and set it to active
influx config set --active \
-n config-name \
-t mySuP3rS3cr3tT0keN \
-o example-org
# Update a connection configuration and do not set it to active
influx config set \
-n config-name \
-t mySuP3rS3cr3tT0keN \
-o example-org
```

View File

@ -30,10 +30,9 @@ influx template [command]
| `-c` | `--disable-color` | Disable color in output | | | | `-c` | `--disable-color` | Disable color in output | | |
| | `--disable-table-borders` | Disable table borders | | | | | `--disable-table-borders` | Disable table borders | | |
| `-e` | `--encoding` | Encoding of the input stream | string | | | `-e` | `--encoding` | Encoding of the input stream | string | |
| `-f` | `--file` | Template file to summarize | string | | | `-f` | `--file` | Path to template file (supports HTTP(S) URLs or file paths) | string | |
| `-h` | `--help` | Help for the `template` command | | | | `-h` | `--help` | Help for the `template` command | | |
| | `--json` | Output data as JSON (default `false`) | | `INFLUX_OUTPUT_JSON` | | | `--json` | Output data as JSON (default `false`) | | `INFLUX_OUTPUT_JSON` |
| `-R` | `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | | | | `-R` | `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | | |
| `-u` | `--template-url` | URL of template file to summarize | string | |
{{% cli/influx-global-flags %}} {{% cli/influx-global-flags %}}

View File

@ -22,7 +22,7 @@ influx template validate [flags]
| Flag | | Description | Input Type | | Flag | | Description | Input Type |
|:---- |:--- |:----------- |:---------- | |:---- |:--- |:----------- |:---------- |
| `-e` | `--encoding` | Encoding of the input stream | string | | `-e` | `--encoding` | Encoding of the input stream | string |
| `-f` | `--file` | Template file to validate | string | | `-f` | `--file` | Path to template file (supports HTTP(S) URLs or file paths) | string |
| `-h` | `--help` | Help for the `validate` command | | | `-h` | `--help` | Help for the `validate` command | |
| `-R` | `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | | | `-R` | `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | |
| `-u` | `--template-url` | URL of template file to validate | string | | `-u` | `--template-url` | URL of template file to validate | string |

View File

@ -6,6 +6,5 @@
| Flag | | Description | Input type | Maps to <a class ="q-link" href ="{{ $link }}">?</a> | | Flag | | Description | Input type | Maps to <a class ="q-link" href ="{{ $link }}">?</a> |
|:---- |:--- |:----------- |:----------:|:---------------------------------------------------- | |:---- |:--- |:----------- |:----------:|:---------------------------------------------------- |
| | `--host` | HTTP address of InfluxDB (default `http://localhost:9999`) | string | `INFLUX_HOST` | | | `--host` | HTTP address of InfluxDB (default `http://localhost:9999`) | string | `INFLUX_HOST` |
| | `--local` | Run commands against the local filesystem | | | | | `--skip-verify` | Skip TLS certificate verification | | |
| | `--skip-verify` | Skip certificate verification (use when connecting over TLS with a self-signed certificate) | | |
| `-t` | `--token` | API token to use in client calls | string | `INFLUX_TOKEN` | | `-t` | `--token` | API token to use in client calls | string | `INFLUX_TOKEN` |