Skip to content
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

TiDB Cloud CLI New #17056

Merged
merged 22 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 11 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
45 changes: 28 additions & 17 deletions TOC-tidb-cloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -620,18 +620,37 @@
- [Spill to Disk](/tiflash/tiflash-spill-disk.md)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- CLI
- [Overview](/tidb-cloud/cli-reference.md)
- cluster
- auth
- [login](/tidb-cloud/ticloud-auth-login.md)
- [logout](/tidb-cloud/ticloud-auth-logout.md)
- serverless
- [create](/tidb-cloud/ticloud-cluster-create.md)
- [delete](/tidb-cloud/ticloud-cluster-delete.md)
- [describe](/tidb-cloud/ticloud-cluster-describe.md)
- [list](/tidb-cloud/ticloud-cluster-list.md)
- [connect-info](/tidb-cloud/ticloud-cluster-connect-info.md)
- branch
- [create](/tidb-cloud/ticloud-branch-create.md)
- [delete](/tidb-cloud/ticloud-branch-delete.md)
- [describe](/tidb-cloud/ticloud-branch-describe.md)
- [list](/tidb-cloud/ticloud-branch-list.md)
- [connect-info](/tidb-cloud/ticloud-branch-connect-info.md)
- [update](/tidb-cloud/ticloud-serverless-update.md)
- [spending-limit](/tidb-cloud/ticloud-serverless-spending-limit.md)
- [regions](/tidb-cloud/ticloud-serverless-regions.md)
- [shell](/tidb-cloud/ticloud-serverless-shell.md)
- branch
- [create](/tidb-cloud/ticloud-branch-create.md)
- [delete](/tidb-cloud/ticloud-branch-delete.md)
- [describe](/tidb-cloud/ticloud-branch-describe.md)
- [list](/tidb-cloud/ticloud-branch-list.md)
- [shell](/tidb-cloud/ticloud-branch-shell.md)
- import
- [cancel](/tidb-cloud/ticloud-import-cancel.md)
- [describe](/tidb-cloud/ticloud-import-describe.md)
- [list](/tidb-cloud/ticloud-import-list.md)
- [start](/tidb-cloud/ticloud-import-start.md)
- export
- [create](/tidb-cloud/ticloud-serverless-export-create.md)
- [describe](/tidb-cloud/ticloud-serverless-export-describe.md)
- [list](/tidb-cloud/ticloud-serverless-export-list.md)
- [cancel](/tidb-cloud/ticloud-serverless-export-cancel.md)
- [download](/tidb-cloud/ticloud-serverless-export-download.md)
- [ai](/tidb-cloud/ticloud-ai.md)
- [completion](/tidb-cloud/ticloud-completion.md)
- config
- [create](/tidb-cloud/ticloud-config-create.md)
- [delete](/tidb-cloud/ticloud-config-delete.md)
Expand All @@ -640,18 +659,10 @@
- [list](/tidb-cloud/ticloud-config-list.md)
- [set](/tidb-cloud/ticloud-config-set.md)
- [use](/tidb-cloud/ticloud-config-use.md)
- [connect](/tidb-cloud/ticloud-connect.md)
- import
- [cancel](/tidb-cloud/ticloud-import-cancel.md)
- [describe](/tidb-cloud/ticloud-import-describe.md)
- [list](/tidb-cloud/ticloud-import-list.md)
- start
- [local](/tidb-cloud/ticloud-import-start-local.md)
- [s3](/tidb-cloud/ticloud-import-start-s3.md)
- [mysql](/tidb-cloud/ticloud-import-start-mysql.md)
- project
- [list](/tidb-cloud/ticloud-project-list.md)
- [update](/tidb-cloud/ticloud-update.md)
- [help](/tidb-cloud/ticloud-help.md)
- [Table Filter](/table-filter.md)
- [Resource Control](/tidb-resource-control.md)
- [URI Formats of External Storage Services](/external-storage-uri.md)
Expand Down
32 changes: 17 additions & 15 deletions tidb-cloud/cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@ The following table lists the commands available for the TiDB Cloud CLI.

To use the `ticloud` CLI in your terminal, run `ticloud [command] [subcommand]`. If you are using [TiUP](https://docs.pingcap.com/tidb/stable/tiup-overview), use `tiup cloud [command] [subcommand]` instead.

| Command | Subcommand | Description |
|------------|------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| cluster | create, delete, describe, list, connect-info | Manage clusters |
| branch | create, delete, describe, list, connect-info | Manage branches |
| completion | bash, fish, powershell, zsh | Generate completion script for specified shell |
| config | create, delete, describe, edit, list, set, use | Configure user profiles |
| connect | - | Connect to a TiDB cluster |
| help | cluster, completion, config, help, import, project, update | View help for any command |
| import | cancel, describe, list, start | Manage [import](/tidb-cloud/tidb-cloud-migration-overview.md#import-data-from-files-to-tidb-cloud) tasks |
| project | list | Manage projects |
| update | - | Update the CLI to the latest version |
| Command | Subcommand | Description |
|--------------------|--------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
| auth | login, logout | Login and logout |
| serverless | create, delete, describe, list, update, spending-limit, regions, shell | Manage TiDB Serverless clusters |
qiancai marked this conversation as resolved.
Show resolved Hide resolved
shiyuhang0 marked this conversation as resolved.
Show resolved Hide resolved
| serverless branch | create, delete, describe, list, shell | Manage TiDB Serverless branches |
| serverless import | cancel, describe, list, start | Manage TiDB Serverless [import](/tidb-cloud/tidb-cloud-migration-overview.md#import-data-from-files-to-tidb-cloud) tasks |
shiyuhang0 marked this conversation as resolved.
Show resolved Hide resolved
| serverless export | create, describe, list, cancel, download | Manage TiDB Serverless export tasks |
| ai | - | Chat with TiDB Bot |
| completion | bash, fish, powershell, zsh | Generate completion script for specified shell |
shiyuhang0 marked this conversation as resolved.
Show resolved Hide resolved
| config | create, delete, describe, edit, list, set, use | Configure user profiles |
| project | list | Manage projects |
| update | - | Update the CLI to the latest version |
| help | cluster, completion, config, help, import, project, update | View help for any command |

## Command modes

Expand Down Expand Up @@ -103,10 +105,10 @@ Use [`ticloud config delete`](/tidb-cloud/ticloud-config-delete.md) to delete a

The following table lists the global flags for the TiDB Cloud CLI.

| Flag | Description | Required | Note |
|----------------------|-----------------------------------------------|----------|--------------------------------------------------------------------------------------------------------------------------|
| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. |
| -P, --profile string | Specifies the active user profile used in this command. | No | Works in both non-interactive and interactive modes. |
| Flag | Description | Required | Note |
|----------------------|---------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------|
| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. |
shiyuhang0 marked this conversation as resolved.
Show resolved Hide resolved
| -P, --profile string | Specifies the active user profile used in this command. | No | Works in both non-interactive and interactive modes. |

## Feedback

Expand Down
23 changes: 10 additions & 13 deletions tidb-cloud/get-started-with-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ summary: Learn how to manage TiDB Cloud resources through the TiDB Cloud CLI.
TiDB Cloud provides a command-line interface (CLI) [`ticloud`](https://github.com/tidbcloud/tidbcloud-cli) for you to interact with TiDB Cloud from your terminal with a few lines of commands. For example, you can easily perform the following operations using `ticloud`:

- Create, delete, and list your clusters.
- Import data from Amazon S3 or local files to your clusters.
- Import data to your clusters.
- Export data from your clusters.

## Before you begin

Expand Down Expand Up @@ -114,7 +115,7 @@ tiup cloud --help
Run commands with `tiup cloud <command>`. For example:

```shell
tiup cloud cluster create
tiup cloud serverless create
```

Update to the latest version by TiUP:
Expand All @@ -127,7 +128,7 @@ tiup update cloud

[TiDB Serverless](/tidb-cloud/select-cluster-tier.md#tidb-serverless) is the best way to get started with TiDB Cloud. In this section, you will learn how to create a TiDB Serverless cluster with TiDB Cloud CLI.

### Create a user profile
### Create a user profile or log into TiDB Cloud

Before creating a cluster, you need to create a user profile with your TiDB Cloud API Key:

Expand All @@ -139,24 +140,20 @@ ticloud config create
>
> The profile name **MUST NOT** contain `.`.

### Create a TiDB Serverless cluster

To create a TiDB Serverless cluster, enter the following command, and then follow the CLI prompts to provide the required information and set the password:
You can also log into TiDB Cloud with OAuth:

```shell
ticloud cluster create
```
ticloud auth login
```

### Connect to the cluster
### Create a TiDB Serverless cluster

After the cluster is created, you can connect to the cluster:
To create a TiDB Serverless cluster, enter the following command, and then follow the CLI prompts to provide the required information:

```shell
ticloud connect
ticloud serverless create
```

When you are prompted about whether to use the default user, choose `Y` and enter the password that you set when creating the cluster.

## What's next

Check out [CLI reference](/tidb-cloud/cli-reference.md) to explore more features of TiDB Cloud CLI.
Expand Down
47 changes: 47 additions & 0 deletions tidb-cloud/ticloud-ai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: ticloud ai
summary: The reference of `ticloud ai`.
---

# ticloud ai

Chat with TiDB Bot:

```shell
ticloud ai [flags]
```

## Examples

Chat with TiDB Bot in interactive mode:

```shell
ticloud serverless delete
```

Chat with TiDB Bot in non-interactive mode:

```shell
ticloud ai -q "How to create a cluster?"
```

## Flags

In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in.

| Flag | Description | Required | Note |
|--------------------|-----------------------------------|----------|------------------------------------------------------|
| -q, --query string | Specifies your query to TiDB Bot. | Yes | Only works in non-interactive mode. |
| -h, --help | Shows help information for this command. | No | Works in both non-interactive and interactive modes. |

## Inherited flags

| Flag | Description | Required | Note |
|----------------------|--------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------|
| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. |
| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. |
| -D, --debug | Enables debug mode. | No | Works in both non-interactive and interactive modes. |

## Feedback

If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions.
47 changes: 47 additions & 0 deletions tidb-cloud/ticloud-auth-login.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: ticloud auth login
summary: The reference of `ticloud auth login`.
---

# ticloud auth login

Authenticate with TiDB Cloud:

```shell
ticloud auth login [flags]
```

## Examples

To log into TiDB Cloud:

```shell
ticloud auth login
```

To log into TiDB Cloud with insecure storage:

```shell
ticloud auth login --insecure-storage
```

## Flags

In non-interactive mode, you need to manually enter the required flags. In interactive mode, you can just follow CLI prompts to fill them in.

| Flag | Description | Required | Note |
|--------------------|---------------------------------------------------------------------------|----------|------------------------------------------------------|
| --insecure-storage | Saves authentication credentials in plain text instead of credential store. | No | Works in both non-interactive and interactive modes. |
| -h, --help | Shows help information for this command. | No | Works in both non-interactive and interactive modes. |

## Inherited flags

| Flag | Description | Required | Note |
|----------------------|--------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------|
| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. |
| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. |
| -D, --debug | Enables debug mode. | No | Works in both non-interactive and interactive modes. |

## Feedback

If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions.
32 changes: 32 additions & 0 deletions tidb-cloud/ticloud-auth-logout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: ticloud auth logout
summary: The reference of `ticloud auth logout`.
---

# ticloud auth logout

Log out of TiDB Cloud:

```shell
ticloud auth logout [flags]
```

## Examples

To log out of TiDB Cloud:

```shell
ticloud auth logout
```

## Inherited flags

| Flag | Description | Required | Note |
|----------------------|--------------------------------------------------------------------------------------------|----------|------------------------------------------------------------------------------------------------------------------|
| --no-color | Disables color in output. | No | Only works in non-interactive mode. In interactive mode, disabling color might not work with some UI components. |
| -P, --profile string | Specifies the active [user profile](/tidb-cloud/cli-reference.md#user-profile) used in this command. | No | Works in both non-interactive and interactive modes. |
| -D, --debug | Enables debug mode. | No | Works in both non-interactive and interactive modes. |

## Feedback

If you have any questions or suggestions on the TiDB Cloud CLI, feel free to create an [issue](https://github.com/tidbcloud/tidbcloud-cli/issues/new/choose). Also, we welcome any contributions.
Loading
Loading