feat(dedicated): add Management API list databases to task-based docs
parent
bbecfcba71
commit
ea8d5eb5af
|
|
@ -15,31 +15,90 @@ related:
|
|||
- /influxdb/cloud-dedicated/reference/cli/influxctl/database/list/
|
||||
---
|
||||
|
||||
Use the [`influxctl` CLI](/influxdb/cloud-dedicated/reference/cli/influxctl/database/create/)
|
||||
or the [Management HTTP API](influxdb/cloud-dedicated/api/management/) to create a database in your {{< product-name omit=" Clustered" >}} cluster.
|
||||
|
||||
{{< tabs-wrapper >}}
|
||||
{{% tabs %}}
|
||||
[influxctl](#)
|
||||
[Management API](#)
|
||||
{{% /tabs %}}
|
||||
{{% tab-content %}}
|
||||
|
||||
<!------------------------------- BEGIN INFLUXCTL ----------------------------->
|
||||
|
||||
Use the [`influxctl database list` command](/influxdb/cloud-dedicated/reference/cli/influxctl/database/list/)
|
||||
to list databases in your InfluxDB Cloud Dedicated cluster.
|
||||
|
||||
1. If you haven't already, [download and install the `influxctl` CLI](/influxdb/cloud-dedicated/reference/cli/influxctl/#download-and-install-influxctl).
|
||||
2. Run `influxctl database list` with the following:
|
||||
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 an `influxctl` connection profile](/influxdb/cloud-dedicated/reference/cli/influxctl/#configure-connection-profiles) for your cluster.
|
||||
2. Run the `influxctl database list` command and provide the following:
|
||||
|
||||
- _(Optional)_ [Output format](#output-formats)
|
||||
- _Optional_: [Output format](#output-formats)
|
||||
|
||||
```sh
|
||||
influxctl database list --format table
|
||||
```
|
||||
|
||||
### Output formats
|
||||
<!-------------------------------- END INFLUXCTL ------------------------------>
|
||||
{{% /tab-content %}}
|
||||
{{% tab-content %}}
|
||||
<!------------------------------- BEGIN cURL ---------------------------------->
|
||||
_This example uses [cURL](https://curl.se/) to send a Management HTTP API request, but you can use any HTTP client._
|
||||
|
||||
1. If you haven't already, follow the instructions to [install cURL](https://everything.curl.dev/install/index.html) for your system.
|
||||
2. In your terminal, use cURL to send a request to the following endpoint:
|
||||
|
||||
{{% api-endpoint endpoint="https://{{< influxdb/host >}}/api/v0/accounts/ACCOUNT_ID/clusters/CLUSTER_ID/databases" method="get" api-ref="/influxdb/cloud-dedicated/api/management/#operation/CreateClusterDatabase" %}}
|
||||
|
||||
In the URL, provide the following credentials:
|
||||
|
||||
- Your {{% product-name omit="Clustered" %}} cluster URL.
|
||||
- `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).
|
||||
|
||||
In request headers, provide the following:
|
||||
|
||||
- `Accept: application/json` to ensure the response body is JSON content
|
||||
- `Content-Type: application/json` to indicate the request body is JSON content
|
||||
- `Authorization: Bearer` and a [Management API token](/influxdb/cloud-dedicated/admin/tokens/management/) for your cluster _(see how to [create a management token](/influxdb/cloud-dedicated/admin/tokens/management/) for Management API requests)_.
|
||||
|
||||
The following example shows how to use the Management API to list databases in a cluster:
|
||||
|
||||
```sh
|
||||
curl \
|
||||
--location "https://{{< influxdb/host >}}/api/v0/accounts/ACCOUNT_ID/clusters/CLUSTER_ID/databases" \
|
||||
--header "Accept: application/json" \
|
||||
--header "Authorization: Bearer MANAGEMENT_TOKEN" \
|
||||
```
|
||||
|
||||
<!------------------------------- END cURL ------------------------------------>
|
||||
{{% /tab-content %}}
|
||||
{{< /tabs-wrapper >}}
|
||||
|
||||
### Output format
|
||||
|
||||
The `influxctl database list` command supports two output formats: `table` and `json`.
|
||||
By default, the command outputs the list of databases formatted as a table.
|
||||
For easier programmatic access to the command output, include `--format json`
|
||||
with your command to format the database list as JSON.
|
||||
with your command to format the output as JSON.
|
||||
|
||||
The Management API outputs JSON format in the response body.
|
||||
|
||||
#### Retention period syntax
|
||||
|
||||
In table format, a retention period is a time duration value made up of a numeric value
|
||||
plus a duration unit--for example, `30d` means 30 days.
|
||||
An `infinite` retention period means data won't expire.
|
||||
|
||||
In JSON format, a retention period value is an integer (`<int32>`) that represents the number of nanoseconds--for example, `2592000000000` means 30 days.
|
||||
A zero (`0`) retention period means data won't expire.
|
||||
|
||||
#### Example output
|
||||
|
||||
{{< code-tabs-wrapper >}}
|
||||
{{% code-tabs %}}
|
||||
[table](#)
|
||||
[json](#)
|
||||
[JSON](#)
|
||||
{{% /code-tabs %}}
|
||||
{{% code-tab-content %}}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue