Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion docs/generate_doc/ticloud.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ ticloud is a CLI library for communicating with TiDB Cloud's API.

### SEE ALSO

* [ticloud ai](ticloud_ai.md) - Chat with TiDB Bot
* [ticloud auth](ticloud_auth.md) - Login and logout via TiDB Cloud API
* [ticloud completion](ticloud_completion.md) - Generate the autocompletion script for the specified shell
* [ticloud config](ticloud_config.md) - Configure and manage your user profiles
Expand Down
2 changes: 1 addition & 1 deletion docs/generate_doc/ticloud_config_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Configure specific properties of the active profile
### Synopsis

Configure specific properties of the active profile.
Available properties : [public-key private-key api-url serverless-endpoint iam-endpoint oauth-endpoint oauth-client-id oauth-client-secret telemetry-enabled].
Available properties : [public-key private-key serverless-endpoint iam-endpoint oauth-endpoint oauth-client-id oauth-client-secret telemetry-enabled].

If using -P flag, the config in the specific profile will be set.
If not, the config in the active profile will be set
Expand Down
5 changes: 2 additions & 3 deletions docs/generate_doc/ticloud_serverless_audit-log.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ Manage TiDB Cloud Serverless database audit logging
### SEE ALSO

* [ticloud serverless](ticloud_serverless.md) - Manage TiDB Cloud Serverless clusters
* [ticloud serverless audit-log config](ticloud_serverless_audit-log_config.md) - Configure the database audit logging
* [ticloud serverless audit-log describe](ticloud_serverless_audit-log_describe.md) - Describe the database audit logging configuration
* [ticloud serverless audit-log download](ticloud_serverless_audit-log_download.md) - Download the database audit logs
* [ticloud serverless audit-log config](ticloud_serverless_audit-log_config.md) - Manage TiDB Cloud Serverless database audit logging configuration
* [ticloud serverless audit-log download](ticloud_serverless_audit-log_download.md) - Download the database audit log files
* [ticloud serverless audit-log filter-rule](ticloud_serverless_audit-log_filter-rule.md) - Manage TiDB Cloud Serverless database audit logging filter rules

29 changes: 4 additions & 25 deletions docs/generate_doc/ticloud_serverless_audit-log_config.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,11 @@
## ticloud serverless audit-log config

Configure the database audit logging

```
ticloud serverless audit-log config [flags]
```

### Examples

```
Conigure the database audit logging in interactive mode:
$ ticloud serverless audit-log config

Unredacted the database audit logging in non-interactive mode:
$ ticloud serverless audit-log config -c <cluster-id> --unredacted

Enable the database audit logging in non-interactive mode:
$ ticloud serverless audit-log config -c <cluster-id> --enabled

Disable the database audit logging in non-interactive mode:
$ ticloud serverless audit-log config -c <cluster-id> --enabled=false
```
Manage TiDB Cloud Serverless database audit logging configuration

### Options

```
-c, --cluster-id string The ID of the cluster to be updated.
--enabled enable or disable the database audit logging.
-h, --help help for config
--unredacted unredacted or redacted the database audit logging.
-h, --help help for config
```

### Options inherited from parent commands
Expand All @@ -42,4 +19,6 @@ ticloud serverless audit-log config [flags]
### SEE ALSO

* [ticloud serverless audit-log](ticloud_serverless_audit-log.md) - Manage TiDB Cloud Serverless database audit logging
* [ticloud serverless audit-log config describe](ticloud_serverless_audit-log_config_describe.md) - Describe the database audit logging configuration
* [ticloud serverless audit-log config update](ticloud_serverless_audit-log_config_update.md) - Update the database audit logging configuration

37 changes: 37 additions & 0 deletions docs/generate_doc/ticloud_serverless_audit-log_config_describe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## ticloud serverless audit-log config describe

Describe the database audit logging configuration

```
ticloud serverless audit-log config describe [flags]
```

### Examples

```
Get the database audit logging configuration in interactive mode:
$ ticloud serverless audit-log config describe

Get the database audit logging configuration in non-interactive mode:
$ ticloud serverless audit-log config describe -c <cluster-id>
```

### Options

```
-c, --cluster-id string The cluster ID.
-h, --help help for describe
```

### Options inherited from parent commands

```
-D, --debug Enable debug mode
--no-color Disable color output
-P, --profile string Profile to use from your configuration file
```

### SEE ALSO

* [ticloud serverless audit-log config](ticloud_serverless_audit-log_config.md) - Manage TiDB Cloud Serverless database audit logging configuration

59 changes: 59 additions & 0 deletions docs/generate_doc/ticloud_serverless_audit-log_config_update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## ticloud serverless audit-log config update

Update the database audit logging configuration

```
ticloud serverless audit-log config update [flags]
```

### Examples

```
Conigure database audit logging in interactive mode:
$ ticloud serverless audit-log config update

Unredact the database audit log in non-interactive mode:
$ ticloud serverless audit-log config update -c <cluster-id> --unredacted

Enable database audit logging in non-interactive mode:
$ ticloud serverless audit-log config update -c <cluster-id> --enabled

Disable database audit logging in non-interactive mode:
$ ticloud serverless audit-log config update -c <cluster-id> --enabled=false
```

### Options

```
--azblob.sas-token string The SAS token of Azure Blob.
--azblob.uri string The Azure Blob URI in azure://<account>.blob.core.windows.net/<container>/<path> format. Required when cloud storage is AZURE_BLOB.
--cloud-storage string The cloud storage. One of ["TIDB_CLOUD" "S3" "GCS" "AZURE_BLOB" "OSS"].
-c, --cluster-id string The ID of the cluster to be updated.
--enabled enable or disable database audit logging.
--gcs.service-account-key string The base64 encoded service account key of GCS.
--gcs.uri string The GCS URI in gs://<bucket>/<path> format. Required when cloud storage is GCS.
-h, --help help for update
--oss.access-key-id string The access key ID of the OSS.
--oss.access-key-secret string The access key secret of the OSS.
--oss.uri string The OSS URI in oss://<bucket>/<path> format. Required when cloud storage is OSS.
--rotation-interval-minutes int32 The rotation interval in minutes, range [10, 1440].
--rotation-size-mib int32 The rotation size in MiB, range [1, 1024].
--s3.access-key-id string The access key ID of the S3. You only need to set one of the s3.role-arn and [s3.access-key-id, s3.secret-access-key].
--s3.role-arn string The role arn of the S3. You only need to set one of the s3.role-arn and [s3.access-key-id, s3.secret-access-key].
--s3.secret-access-key string The secret access key of the S3. You only need to set one of the s3.role-arn and [s3.access-key-id, s3.secret-access-key].
--s3.uri string The S3 URI in s3://<bucket>/<path> format. Required when cloud storage is S3.
--unredacted unredact or redact the database audit log.
```

### Options inherited from parent commands

```
-D, --debug Enable debug mode
--no-color Disable color output
-P, --profile string Profile to use from your configuration file
```

### SEE ALSO

* [ticloud serverless audit-log config](ticloud_serverless_audit-log_config.md) - Manage TiDB Cloud Serverless database audit logging configuration

2 changes: 1 addition & 1 deletion docs/generate_doc/ticloud_serverless_audit-log_download.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## ticloud serverless audit-log download

Download the database audit logs
Download the database audit log files

```
ticloud serverless audit-log download [flags]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@ ticloud serverless audit-log filter-rule create [flags]
$ ticloud serverless audit-log filter create

Create a filter rule which filters all audit logs in non-interactive mode:
$ ticloud serverless audit-log filter create --cluster-id <cluster-id> --name <rule-name> --rule '{"users":["%@%"],"filters":[{}]}'
$ ticloud serverless audit-log filter create --cluster-id <cluster-id> --display-name <rule-name> --rule '{"users":["%@%"],"filters":[{}]}'

Create a filter rule which filters QUERY and EXECUTE for test.t and filter QUERY for all tables in non-interactive mode:
$ ticloud serverless audit-log filter create --cluster-id <cluster-id> --name <rule-name> --rule '{"users":["%@%"],"filters":[{"classes":["QUERY","EXECUTE"],"tables":["test.t"]},{"classes":["QUERY"]}]}'
$ ticloud serverless audit-log filter create --cluster-id <cluster-id> --display-name <rule-name> --rule '{"users":["%@%"],"filters":[{"classes":["QUERY","EXECUTE"],"tables":["test.t"]},{"classes":["QUERY"]}]}'

```

### Options

```
-c, --cluster-id string The ID of the cluster.
-h, --help help for create
--name string The name of the filter rule.
--rule string Filter rule expressions, use "ticloud serverless audit-log filter template" to see filter templates.
-c, --cluster-id string The ID of the cluster.
--display-name string The display name of the filter rule.
-h, --help help for create
--rule string Filter rule expressions, use "ticloud serverless audit-log filter template" to see filter templates.
```

### Options inherited from parent commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ ticloud serverless audit-log filter-rule delete [flags]
$ ticloud serverless audit-log filter delete

Delete an audit log filter rule in non-interactive mode:
$ ticloud serverless audit-log filter delete --cluster-id <cluster-id> --name <rule-name>
$ ticloud serverless audit-log filter delete --cluster-id <cluster-id> --filter-rule-id <rule-id>

```

### Options

```
-c, --cluster-id string The ID of the cluster.
--force Delete a cluster without confirmation.
-h, --help help for delete
--name string The name of the filter rule.
-c, --cluster-id string The ID of the cluster.
--filter-rule-id string The ID of the filter rule.
--force Delete a cluster without confirmation.
-h, --help help for delete
```

### Options inherited from parent commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ ticloud serverless audit-log filter-rule describe [flags]
$ ticloud serverless audit-log filter describe

Describe an audit log filter rule in non-interactive mode:
$ ticloud serverless audit-log filter describe --cluster-id <cluster-id> --name <rule-name>
$ ticloud serverless audit-log filter describe --cluster-id <cluster-id> --filter-rule-id <rule-id>

```

### Options

```
-c, --cluster-id string The ID of the cluster.
-h, --help help for describe
--name string The name of the filter rule.
-c, --cluster-id string The ID of the cluster.
--filter-rule-id string The ID of the filter rule.
-h, --help help for describe
```

### Options inherited from parent commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,25 @@ ticloud serverless audit-log filter-rule update [flags]
$ ticloud serverless audit-log filter update

Enable audit log filter rule in non-interactive mode:
$ ticloud serverless audit-log filter update --cluster-id <cluster-id> --name <rule-name> --enabled
$ ticloud serverless audit-log filter update --cluster-id <cluster-id> --filter-rule-id <rule-id> --enabled

Disable audit log filter rule in non-interactive mode:
$ ticloud serverless audit-log filter update --cluster-id <cluster-id> --name <rule-name> --enabled=false
$ ticloud serverless audit-log filter update --cluster-id <cluster-id> --filter-rule-id <rule-id> --enabled=false

Update filters of an audit log filter rule in non-interactive mode:
$ ticloud serverless audit-log filter update --cluster-id <cluster-id> --name <rule-name> --rule '{"users":["%@%"],"filters":[{"classes":["QUERY"],"tables":["test.t"]}]}'
$ ticloud serverless audit-log filter update --cluster-id <cluster-id> --filter-rule-id <rule-id> --rule '{"users":["%@%"],"filters":[{"classes":["QUERY"],"tables":["test.t"]}]}'

```

### Options

```
-c, --cluster-id string The ID of the cluster.
--enabled Enable or disable the filter rule.
-h, --help help for update
--name string The name of the filter rule to update.
--rule string Complete filter rule expressions, use "ticloud serverless audit-log filter template" to see filter templates.
-c, --cluster-id string The ID of the cluster.
--display-name string The display name of the filter rule.
--enabled Enable or disable the filter rule.
--filter-rule-id string The ID of the filter rule.
-h, --help help for update
--rule string Complete filter rule expressions, use "ticloud serverless audit-log filter template" to see filter templates.
```

### Options inherited from parent commands
Expand Down
4 changes: 2 additions & 2 deletions docs/generate_doc/ticloud_serverless_sql-user_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ ticloud serverless sql-user create [flags]
-c, --cluster-id string The ID of the cluster.
-h, --help help for create
--password string The password of the SQL user.
--role strings The role(s) of the SQL user.
-u, --user string The name of the SQL user.
--role strings The role(s) of the SQL user, supported roles ["role_admin" "role_readwrite" "role_readonly"]
-u, --user string The name of the SQL user, user prefix will be added automatically.
```

### Options inherited from parent commands
Expand Down
4 changes: 2 additions & 2 deletions docs/generate_doc/ticloud_serverless_sql-user_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ ticloud serverless sql-user update [flags]
--delete-role strings The role(s) to be deleted from the SQL user.
-h, --help help for update
--password string The new password of the SQL user.
--role strings The new role(s) of the SQL user. Passing this flag replaces preexisting data.
-u, --user string The name of the SQL user to be updated.
--role strings The new role(s) of the SQL user. Passing this flag replaces preexisting data, supported roles ["role_admin" "role_readwrite" "role_readonly"]
-u, --user string The name of the SQL user to be updated, user prefix will be added automatically.
```

### Options inherited from parent commands
Expand Down
10 changes: 8 additions & 2 deletions internal/cli/serverless/sqluser/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ var createSQLUserField = map[string]int{
flag.Password: 1,
}

var supportedRoles = []string{
util.ADMIN_ROLE,
util.READWRITE_ROLE,
util.READONLY_ROLE,
}

func (c CreateOpts) NonInteractiveFlags() []string {
return []string{
flag.ClusterID,
Expand Down Expand Up @@ -231,9 +237,9 @@ func CreateCmd(h *internal.Helper) *cobra.Command {
}

CreateCmd.Flags().StringP(flag.ClusterID, flag.ClusterIDShort, "", "The ID of the cluster.")
CreateCmd.Flags().StringP(flag.User, flag.UserShort, "", "The name of the SQL user.")
CreateCmd.Flags().StringP(flag.User, flag.UserShort, "", "The name of the SQL user, user prefix will be added automatically.")
CreateCmd.Flags().StringP(flag.Password, "", "", "The password of the SQL user.")
CreateCmd.Flags().StringSliceP(flag.UserRole, "", nil, "The role(s) of the SQL user.")
CreateCmd.Flags().StringSliceP(flag.UserRole, "", nil, fmt.Sprintf("The role(s) of the SQL user, supported roles %q", supportedRoles))

return CreateCmd
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/serverless/sqluser/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ func UpdateCmd(h *internal.Helper) *cobra.Command {
},
}

updateCmd.Flags().StringP(flag.User, flag.UserShort, "", "The name of the SQL user to be updated.")
updateCmd.Flags().StringP(flag.User, flag.UserShort, "", "The name of the SQL user to be updated, user prefix will be added automatically.")
updateCmd.Flags().StringP(flag.ClusterID, flag.ClusterIDShort, "", "The cluster ID of the SQL user to be updated.")
updateCmd.Flags().StringP(flag.Password, "", "", "The new password of the SQL user.")
updateCmd.Flags().StringSliceP(flag.UserRole, "", nil, "The new role(s) of the SQL user. Passing this flag replaces preexisting data.")
updateCmd.Flags().StringSliceP(flag.UserRole, "", nil, fmt.Sprintf("The new role(s) of the SQL user. Passing this flag replaces preexisting data, supported roles %q", supportedRoles))
updateCmd.Flags().StringSliceP(flag.AddRole, "", nil, "The role(s) to be added to the SQL user.")
updateCmd.Flags().StringSliceP(flag.DeleteRole, "", nil, "The role(s) to be deleted from the SQL user.")

Expand Down
Loading