Merge pull request #806 from influxdata/pkg/export-filter

Pkg export filter
pull/810/head
Scott Anderson 2020-03-10 08:30:25 -06:00 committed by GitHub
commit edc0a0edeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 83 additions and 54 deletions

View File

@ -79,6 +79,34 @@ influx pkg export all \
-t $INFLUX_TOKEN
```
#### Export resources filtered by labelName or resourceKind
The `influx pkg export all` command has an optional `--filter` flag that exports
only resources that match specified label names or resource kinds.
Provide multiple filters for both `labelName` and `resourceKind`
###### Export only dashboards and buckets with specific labels
The following example exports resources that match this predicate logic:
```js
(resourceKind == "Bucket" or resourceKind == "Dashboard")
and
(labelName == "Example1" or labelName == "Example2")
```
```sh
influx pkg export all \
-o my-org \
-f ~/templates/awesome-template.yml \
-t $INFLUX_TOKEN \
--filter=resourceKind=Bucket \
--filter=resourceKind=Dashboard \
--filter=labelName=Example1 \
--filter=labelName=Example2
```
For information about flags, see the
[`influx pkg export all` documentation](/v2.0/reference/cli/influx/pkg/export/all/).

View File

@ -1,6 +1,6 @@
---
title: influx pkg
description: The 'influx pkg' command and its subcommands manage packages in InfluxDB.
description: The 'influx pkg' command and its subcommands manage InfluxDB templates.
menu:
v2_0_ref:
name: influx pkg
@ -9,7 +9,7 @@ weight: 101
v2.0/tags: [templates]
---
The `influx pkg` command manages packages in InfluxDB.
The `influx pkg` command manages InfluxDB templates.
## Usage
```
@ -20,26 +20,26 @@ influx pkg [command]
## Available commands
| Command | Description |
|:------- |:----------- |
| [export](/v2.0/reference/cli/influx/pkg/export/) | Export existing resources as a package |
| [summary](/v2.0/reference/cli/influx/pkg/summary/) | Summarize the provided package |
| [validate](/v2.0/reference/cli/influx/pkg/validate/) | Validate the provided package |
| [export](/v2.0/reference/cli/influx/pkg/export/) | Export existing resources as a template |
| [summary](/v2.0/reference/cli/influx/pkg/summary/) | Summarize the provided template |
| [validate](/v2.0/reference/cli/influx/pkg/validate/) | Validate the provided template |
## Flags
| Flag | Description | Input Type | {{< cli/mapped >}} |
|:---- |:----------------------------- |:---------- |:------------------ |
| `-c`, `--disable-color` | Disable color in output | | |
| `--disable-table-borders` | Disable table borders | | |
| `-e`, `--encoding` | Encoding of the input stream | string | |
| `--env-ref` | Environment references to provide with the package (format: `--env-ref=REF_KEY=REF_VALUE`) | string | |
| `-f`, `--file` | Path to package file | string | |
| `--force` | Ignore warnings about destructive changes | | |
| `-h`, `--help` | Help for the `pkg` command | | |
| `-o`, `--org` | The name of the organization that owns the bucket | string | `INFLUX_ORG` |
| `--org-id` | The ID of the organization that owns the bucket | string | `INFLUX_ORG_ID` |
| `-q`, `--quiet` | Disable output printing | | |
| `-R`, `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | | |
| `--secret` | Secrets to provide with the package (format: `--secret=SECRET_KEY=SECRET_VALUE`) | string | |
| `-u`, `--url` | URL of package file | string | |
| Flag | Description | Input Type | {{< cli/mapped >}} |
|:---- |:----------------------------- |:---------- |:------------------ |
| `-c`, `--disable-color` | Disable color in output | | |
| `--disable-table-borders` | Disable table borders | | |
| `-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 | |
| `-f`, `--file` | Path to template file | string | |
| `--force` | Ignore warnings about destructive changes | | |
| `-h`, `--help` | Help for the `pkg` command | | |
| `-o`, `--org` | Organization name that owns the bucket | string | `INFLUX_ORG` |
| `--org-id` | Organization ID that owns the bucket | string | `INFLUX_ORG_ID` |
| `-q`, `--quiet` | Disable output printing | | |
| `-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 | |
| `-u`, `--url` | URL of template file | string | |
{{% cli/influx-global-flags %}}

View File

@ -1,13 +1,13 @@
---
title: influx pkg export
description: The 'influx pkg' command exports existing resources as a package.
description: The 'influx pkg' command exports existing resources as an InfluxDB template.
menu:
v2_0_ref:
parent: influx pkg
weight: 101
---
The `influx pkg export` command exports existing resources as a package.
The `influx pkg export` command exports existing resources as an InfluxDB template.
## Usage
```
@ -16,25 +16,25 @@ influx pkg export [command]
```
## Available subcommands
| Subcommand | Description |
|:---------- |----------------------------------------------------------------|
| [all](/v2.0/reference/cli/influx/pkg/export/all/) | Export all existing resources for an organization as a package |
| Subcommand | Description |
|:---------- |:----------- |
| [all](/v2.0/reference/cli/influx/pkg/export/all/) | Export all resources in an organization as a template |
## Flags
| Flag | Description | Input Type |
|:---- |:----------- |:---------- |
| `--buckets` | Comma-separated list of bucket IDs | string |
| `--checks` | Comma-separated list of check IDs | string |
| `--dashboards` | Comma-separated list of dashboard IDs | string |
| `--endpoints` | Comma-separated list of notification endpoint IDs | string |
| `-f`, `--file` | Package output file. Defaults to stdout. Use `.yml` or `.json` file extensions. | string |
| `-h`, `--help` | Help for the `export` command | |
| `--labels` | Comma-separated list of label IDs | string |
| `--resource-type` | Resource type associated with all IDs via stdin | string |
| `--rules` | Comma-separated list of notification rule IDs | string |
| `--tasks` | Comma-separated list of task IDs | string |
| `--telegraf-configs` | Comma-separated list of Telegraf configuration IDs | string |
| `--variables` | Comma-separated list of variable IDs | string |
| Flag | Description | Input Type |
|:---- |:----------- |:---------- |
| `--buckets` | Comma-separated list of bucket IDs | string |
| `--checks` | Comma-separated list of check IDs | string |
| `--dashboards` | Comma-separated list of dashboard IDs | string |
| `--endpoints` | Comma-separated list of notification endpoint IDs | string |
| `-f`, `--file` | Template output file. Defaults to stdout. Use `.yml` or `.json` file extensions. | string |
| `-h`, `--help` | Help for the `export` command | |
| `--labels` | Comma-separated list of label IDs | string |
| `--resource-type` | Resource type associated with all IDs via stdin | string |
| `--rules` | Comma-separated list of notification rule IDs | string |
| `--tasks` | Comma-separated list of task IDs | string |
| `--telegraf-configs` | Comma-separated list of Telegraf configuration IDs | string |
| `--variables` | Comma-separated list of variable IDs | string |
{{% cli/influx-global-flags %}}

View File

@ -1,15 +1,15 @@
---
title: influx pkg export all
description: >
The 'influx pkg' command exports all existing resources for an organization as a package.
The 'influx pkg' command exports all resources in an organization as an InfluxDB template.
menu:
v2_0_ref:
parent: influx pkg export
weight: 201
---
The `influx pkg export all` command exports all existing resources for an
organization as a package.
The `influx pkg export all` command exports all resources in an
organization as an InfluxDB template.
## Usage
```
@ -17,11 +17,12 @@ influx pkg export all [flags]
```
## Flags
| Flag | Description | Input Type | {{< cli/mapped >}} |
|:---- |:----------- |:---------- |:------------------ |
| `-f`, `--file` | Package output file. Defaults to stdout. Use `.yml` or `.json` file extensions. | string | |
| `-h`, `--help` | Help for the `export` command | | |
| `-o`, `--org` | The name of the organization that owns the resources | string | `INFLUX_ORG` |
| `--org-id` | The ID of the organization that owns the resources | string | `INFLUX_ORG_ID` |
| Flag | Description | Input Type | {{< cli/mapped >}} |
|:---- |:----------- |:---------- |:------------------ |
| `-f`, `--file` | Template output file. Defaults to stdout. Use `.yml` or `.json` file extensions. | string | |
| `--filter` | Specify resources to export by labelName or resourceKind (format: `--filter=labelName=example`) | list of strings |
| `-h`, `--help` | Help for the `export` command | | |
| `-o`, `--org` | Organization name that owns the resources | string | `INFLUX_ORG` |
| `--org-id` | Organization ID that owns the resources | string | `INFLUX_ORG_ID` |
{{% cli/influx-global-flags %}}

View File

@ -1,14 +1,14 @@
---
title: influx pkg summary
description: >
The 'influx pkg summary' command summarizes the provided package.
The 'influx pkg summary' command summarizes the provided InfluxDB template.
menu:
v2_0_ref:
parent: influx pkg
weight: 101
---
The `influx pkg summary` command summarizes the provided package.
The `influx pkg summary` command summarizes the provided InfluxDB template.
## Usage
```
@ -25,7 +25,7 @@ influx pkg summary [flags]
| `-f`, `--file` | Package file to summarize | string |
| `-h`, `--help` | Help for the `summary` command | |
| `-R`, `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | |
| `-u`, `--url` | URL of package file to summarize | string |
| `-u`, `--url` | URL of template file to summarize | string |
{{% cli/influx-global-flags %}}

View File

@ -1,14 +1,14 @@
---
title: influx pkg validate
description: >
The 'influx pkg validate' command validates the provided package.
The 'influx pkg validate' command validates the provided InfluxDB template.
menu:
v2_0_ref:
parent: influx pkg
weight: 101
---
The `influx pkg validate` command validates the provided package.
The `influx pkg validate` command validates the provided InfluxDB template.
## Usage
```
@ -23,6 +23,6 @@ influx pkg validate [flags]
| `-f`, `--file` | Package file to validate | string |
| `-h`, `--help` | Help for the `validate` command | |
| `-R`, `--recurse` | Recurse through files in the directory specified in `-f`, `--file` | |
| `-u`, `--url` | URL of package file to validate | string |
| `-u`, `--url` | URL of template file to validate | string |
{{% cli/influx-global-flags %}}