Merge pull request #5434 from influxdata/jstirnaman/5433

feat(v3): Add influxctl cluster list and get task-based, and use them…
pull/5438/head
Jason Stirnaman 2024-04-23 09:18:06 -05:00 committed by GitHub
commit 72d3edb065
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 216 additions and 39 deletions

View File

@ -28,9 +28,17 @@ tags:
- name: Authentication
x-traitTag: true
description: |
InfluxDB Management API endpoints require the `Authorization` header with a [management token](/influxdb/cloud-dedicated/admin/tokens/management/).
The InfluxDB Management API endpoints require the following credentials:
- `ACCOUNT_ID`: The ID of the [account](/influxdb/cloud-dedicated/get-started/setup/#request-an-influxdb-cloud-dedicated-cluster) that the cluster belongs to. To view account ID and cluster ID, [list cluster details](/influxdb/cloud-dedicated/admin/clusters/list/#detailed-output-in-json).
- `CLUSTER_ID`: The ID of the [cluster](/influxdb/cloud-dedicated/get-started/setup/#request-an-influxdb-cloud-dedicated-cluster) that you want to manage. To view account ID and cluster ID, [list cluster details](/influxdb/cloud-dedicated/admin/clusters/list/#detailed-output-in-json).
- `Authorization MANAGEMENT_TOKEN`: the `Authorization` HTTP header with a [management token](/influxdb/cloud-dedicated/admin/tokens/management/).
See how to [create a management token](/influxdb/cloud-dedicated/admin/tokens/management/).
By default, management tokens in InfluxDB v3 are short-lived tokens issued by an OAuth2 identity provider that grant a specific user administrative access to your InfluxDB cluster. However, for automation purposes, you can manually create management tokens that authenticate directly with your InfluxDB cluster and do not require human interaction with your identity provider.
By default, management tokens in InfluxDB v3 are short-lived tokens issued by an OAuth2 identity provider that grant a specific user administrative access to your InfluxDB cluster. However, for automation purposes, you can manually create management tokens that authenticate directly with your InfluxDB cluster and do not require human interaction with your identity provider.
- name: Database tokens
description: Manage database read/write tokens for a cluster
- name: Databases
@ -47,7 +55,7 @@ tags:
# Note the leading space in the command below to keep secrets out of the shell history
#
# ```
# MANAGEMENT_TOKEN=<management api token> ACCOUNT_ID=<account id> CLUSTER_ID=<cluster id> ./scripts/test_http_api_v0_endpoints.sh
# MANAGEMENT_TOKEN=<MANAGEMENT_TOKEN> ACCOUNT_ID=<ACCOUNT_ID> CLUSTER_ID=<CLUSTER_ID> ./scripts/test_http_api_v0_endpoints.sh
# ```
# Env var validation
@ -75,13 +83,13 @@ tags:
exit 1
fi
domain="https://console.influxdata.com"
HOST="https://console.influxdata.com"
# Database request functions
list_databases () {
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases" \
--header "Accept: application/json" \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
)
@ -92,7 +100,7 @@ tags:
local databaseName=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases" \
--header "Accept: application/json" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
@ -123,7 +131,7 @@ tags:
local databaseName=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases/$databaseName" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases/$databaseName" \
--request PATCH \
--header "Accept: application/json" \
--header 'Content-Type: application/json' \
@ -141,7 +149,7 @@ tags:
local databaseName=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases/$databaseName" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases/$databaseName" \
--request DELETE \
--header "Accept: application/json" \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
@ -153,7 +161,7 @@ tags:
list_tokens () {
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens" \
--header "Accept: application/json" \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
)
@ -163,7 +171,7 @@ tags:
create_token () {
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens" \
--header "Accept: application/json" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
@ -188,7 +196,7 @@ tags:
local token_id=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens/$tokenId" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens/$tokenId" \
--header "Accept: application/json" \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
)
@ -199,7 +207,7 @@ tags:
local token_id=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens/$tokenId" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens/$tokenId" \
--request PATCH \
--header "Accept: application/json" \
--header 'Content-Type: application/json' \
@ -221,7 +229,7 @@ tags:
local token_id=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens/$tokenId" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens/$tokenId" \
--request DELETE \
--header "Accept: application/json" \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
@ -372,12 +380,12 @@ paths:
- label: ''
lang: Shell
source: |
domain="https://console.influxdata.com"
HOST="https://console.influxdata.com"
list_databases () {
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases" \
--header "Accept: application/json" \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
)
@ -522,13 +530,13 @@ paths:
- label: cURL
lang: Shell
source: |
domain="https://console.influxdata.com"
HOST="https://console.influxdata.com"
create_database () {
local databaseName=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases" \
--header "Accept: application/json" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
@ -692,13 +700,13 @@ paths:
- label: cURL
lang: Shell
source: |
domain="https://console.influxdata.com"
HOST="https://console.influxdata.com"
update_database () {
local databaseName=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases/$databaseName" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases/$databaseName" \
--request PATCH \
--header "Accept: application/json" \
--header 'Content-Type: application/json' \
@ -753,13 +761,13 @@ paths:
- label: cURL
lang: Shell
source: |
domain="https://console.influxdata.com"
HOST="https://console.influxdata.com"
delete_database () {
local databaseName=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases/$databaseName" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/databases/$databaseName" \
--request DELETE \
--header "Accept: application/json" \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
@ -979,12 +987,12 @@ paths:
- label: cURL
lang: Shell
source: |
domain="https://console.influxdata.com"
HOST="https://console.influxdata.com"
list_tokens () {
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens" \
--header "Accept: application/json" \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
)
@ -1135,13 +1143,13 @@ paths:
- label: cURL
lang: Shell
source: |
domain="https://console.influxdata.com"
HOST="https://console.influxdata.com"
create_token () {
local description=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens" \
--header "Accept: application/json" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
@ -1264,13 +1272,13 @@ paths:
- label: cURL
lang: Shell
source: |
domain="https://console.influxdata.com"
HOST="https://console.influxdata.com"
get_token () {
local tokenId=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens/$tokenId" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens/$tokenId" \
--header "Accept: application/json" \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
)
@ -1441,13 +1449,13 @@ paths:
- label: cURL
lang: Shell
source: |
domain="https://console.influxdata.com"
HOST="https://console.influxdata.com"
update_token () {
local tokenId=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens/$tokenId" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens/$tokenId" \
--request PATCH \
--header "Accept: application/json" \
--header 'Content-Type: application/json' \
@ -1514,13 +1522,13 @@ paths:
- label: cURL
lang: Shell
source: |
domain="https://console.influxdata.com"
HOST="https://console.influxdata.com"
delete_token () {
local tokenId=$1
local response=$( \
curl \
--location "$domain/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens/$tokenId" \
--location "$HOST/api/v0/accounts/$ACCOUNT_ID/clusters/$CLUSTER_ID/tokens/$tokenId" \
--request DELETE \
--header "Accept: application/json" \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \

View File

@ -12,4 +12,4 @@ weight: 6
The following articles provide information about managing your InfluxDB Cloud
Dedicated resources:
{{< children >}}
{{< children >}}

View File

@ -0,0 +1,16 @@
---
title: Manage clusters
seotitle: Manage clusters in InfluxDB Cloud Dedicated
description: >
Manage InfluxDB Cloud Dedicated clusters.
An InfluxDB Cloud Dedicated cluster is a collection of InfluxDB servers dedicated to the workload of a single customer and associated with an InfluxDB account.
menu:
influxdb_cloud_dedicated:
parent: Administer InfluxDB Cloud
weight: 101
influxdb/cloud-dedicated/tags: [clusters]
---
An InfluxDB Cloud Dedicated cluster is a collection of InfluxDB servers dedicated to the workload of a single customer and associated with an InfluxDB account.
{{< children >}}

View File

@ -0,0 +1,76 @@
---
title: Get cluster information
description: >
Use the
[`influxctl cluster get <CLUSTER_ID>` command](/influxdb/cloud-dedicated/reference/cli/influxctl/cluster/get/) to view information about your InfluxDB Cloud Dedicated cluster.
menu:
influxdb_cloud_dedicated:
parent: Manage clusters
weight: 202
list_code_example: |
```sh
influxctl cluster get 0x000000-xy00-0xy-x00-0x00y0000000
```
---
Use the [`influxctl cluster get` CLI command](/influxdb/cloud-dedicated/reference/cli/influxctl/get/)
to view information about your {{< product-name omit=" Clustered" >}} cluster.
1. If you haven't already, [download and install the `influxctl` CLI](/influxdb/cloud-dedicated/reference/cli/influxctl/#download-and-install-influxctl), and then [configure a connection profile](/influxdb/cloud-dedicated/reference/cli/influxctl/#configure-connection-profiles) for your cluster.
2. Run `influxctl cluster get` with the following:
- Cluster ID
- _Optional_: [Output format](#output-formats)
{{% code-placeholders "CLUSTER_ID" %}}
```sh
influxctl cluster get --format table CLUSTER_ID
```
{{% /code-placeholders %}}
Replace {{% code-placeholder-key %}}`CLUSTER_ID` {{% /code-placeholder-key %}} with the
ID of the cluster you want to view information about.
### Output formats
The `influxctl cluster get` command supports two output formats: `table` and `json`.
By default, the output is formatted as a table.
For additional cluster details and easier programmatic access to the command output, include `--format json`
with your command to format the cluster as a JSON object.
#### Example output
```sh
+-------+----------------------------------------------------+
| id | X0x0xxx0-0XXx-000x-00x0-0X000Xx00000 |
| name | Internal - Cluster 1 |
| state | ready |
| url | X0x0xxx0-0XXx-000x-00x0-0X000Xx00000.a.influxdb.io |
+-------+----------------------------------------------------+
```
#### Detailed output in JSON
For additional cluster details and easier programmatic access to the command output, include `--format json`
with your command--for example:
```sh
influxctl cluster get --format json X0x0xxx0-0XXx-000x-00x0-0X000Xx00000
```
The output is the cluster as a JSON object that includes additional fields such as account ID and created date.
```json
{
"account_id": "0x0x0x00-0Xx0-00x0-x0X0-00x00XX0Xx0X",
"cluster_id": "X0x0xxx0-0XXx-000x-00x0-0X000Xx00000",
"name": "Internal - Cluster 1",
"url": "X0x0xxx0-0XXx-000x-00x0-0X000Xx00000.a.influxdb.io",
"state": "ready",
"created_at": {
"seconds": 1686670941,
"nanos": 520023000
},
"category": 1
}
```

View File

@ -0,0 +1,71 @@
---
title: List clusters
description: >
Use the [`influxctl cluster list` command](/influxdb/cloud-dedicated/reference/cli/influxctl/cluster/list/)
to view information about InfluxDB Cloud Dedicated clusters associated with your account ID.
menu:
influxdb_cloud_dedicated:
parent: Manage clusters
weight: 202
list_code_example: |
```sh
influxctl cluster list
```
aliases:
- /influxdb/cloud-dedicated/admin/clusters/list/
---
Use the [`influxctl cluster list` CLI command](/influxdb/cloud-dedicated/reference/cli/influxctl/list/)
view information about all {{< product-name omit=" Clustered" >}} clusters associated with your account ID.
1. If you haven't already, [download and install the `influxctl` CLI](/influxdb/cloud-dedicated/reference/cli/influxctl/#download-and-install-influxctl), and then [configure a connection profile](/influxdb/cloud-dedicated/reference/cli/influxctl/#configure-connection-profiles) for your cluster.
2. Run `influxctl cluster list` with the following:
- _Optional_: [Output format](#output-formats)
```sh
influxctl cluster list --format table
```
### Output formats
The `influxctl cluster list` command supports two output formats: `table` and `json`.
By default, the output is formatted as a table.
#### Example table
```sh
+--------------------------------------+------------------+-------+----------------------------------------------------+
| ID | NAME | STATE | URL |
+--------------------------------------+------------------+-------+----------------------------------------------------+
| X0x0xxx0-0XXx-000x-00x0-0X000Xx00000 | Internal - Cluster 1 | ready | X0x0xxx0-0XXx-000x-00x0-0X000Xx00000.a.influxdb.io |
+--------------------------------------+------------------+-------+----------------------------------------------------+
```
#### Detailed output in JSON
For additional cluster details and easier programmatic access to the command output, include `--format json`
with your command--for example:
```sh
influxctl cluster list --format json
```
The output is a JSON array of cluster objects that include additional fields such as account ID and created date.
```json
[
{
"account_id": "0x0x0x00-0Xx0-00x0-x0X0-00x00XX0Xx0X",
"cluster_id": "X0x0xxx0-0XXx-000x-00x0-0X000Xx00000",
"name": "Internal - Cluster 1",
"url": "X0x0xxx0-0XXx-000x-00x0-0X000Xx00000.a.influxdb.io",
"state": "ready",
"created_at": {
"seconds": 1686670941,
"nanos": 520023000
},
"category": 1
}
]
```

View File

@ -12,9 +12,12 @@ weight: 301
The `influxctl cluster get` command returns information about an InfluxDB
Cloud Dedicated cluster.
The `--format` flag lets you print the output in other formats.
The `json` format is available for programmatic parsing by other tooling.
Default: `table`.
The `--format` flag lets you print the output in other formats. Default: `table`.
The `json` format:
- outputs additional fields not included in `table`
- is available for easier programmatic parsing by other tooling
## Usage
@ -45,4 +48,4 @@ _Also see [`influxctl` global flags](/influxdb/cloud-dedicated/reference/cli/inf
```sh
influxctl cluster get 000xX0Xx-00xX-XXx0-x00X-00xxX0xXX00x
```
```

View File

@ -12,9 +12,12 @@ weight: 301
The `influxctl cluster list` command returns information about all InfluxDB
Cloud Dedicated clusters associated with your account ID.
The `--format` flag lets you print the output in other formats.
The `json` format is available for programmatic parsing by other tooling.
Default: `table`.
The `--format` flag lets you print the output in other formats. Default: `table`.
The `json` format:
- outputs additional fields not included in `table`
- is available for easier programmatic parsing by other tooling
## Usage