Creates a database account for an ApsaraDB for ClickHouse cluster and grants permissions to the database account.

Request parameters

Parameter Type Required Example Description
Action String Yes CreateAccountAndAuthority

The operation that you want to perform. Set the value to CreateAccountAndAuthority.

RegionId String Yes cn-hangzhou

The region ID. You can call the DescribeRegions operation to query the most recent region list.

DBClusterId String Yes cc-bp1p816075e21****

The ID of the cluster.

AccountName String Yes test

The username of the database account.

Note
  • The name must be unique in the cluster.
  • The name can contain lowercase letters, digits, and underscores (_).
  • The name must start with a lowercase letter and end with a lowercase letter or a digit.
  • The name must be 2 to 64 characters in length.
AccountPassword String Yes 123456Aa

The password of the database account.

Note
  • The password must contain at least three types of the following characters: uppercase letters, lowercase letters, digits, and special characters.
  • The following special characters are supported: !@#$%^&*()_+-=
  • The password must be 8 to 32 characters in length.
AccountDescription String Yes ceshi

The description of the database account.

Note
  • The description cannot contain the prefix http:// or https://.
  • The description can be up to 256 characters in length or be an empty string.
DmlAuthority String Yes all

Specifies whether to grant DML permissions to the database account. Valid values:

  • all
  • readOnly,modify
DdlAuthority Boolean Yes true

Specifies whether to grant DDL permissions to the database account. Valid values:

  • true: grants DDL permissions to the database account.
  • false: does not grant DDL permissions to the database account.
AllowDatabases String Yes db1

The list of databases to which you want to grant permissions. Separate databases with commas (,).

TotalDatabases String No db1,db2

The list of all databases. Separate databases with commas (,).

AllowDictionaries String Yes dt1

The list of dictionaries to which you want to grant permissions. Separate dictionaries with commas (,).

TotalDictionaries String No dt1,dt2

A list of all dictionaries. Separate dictionaries with commas (,).

Response parameters

Parameter Type Example Description
RequestId String F5178C10-1407-4987-9133-DE4DC9119F75

The ID of the request.

Examples

Sample requests

http(s)://clickhouse.aliyuncs.com/?Action=CreateAccountAndAuthority
&RegionId=cn-hangzhou
&DBClusterId=cc-bp1p816075e21****
&AccountName=test
&AccountPassword=123456Aa
&AccountDescription=ceshi
&DmlAuthority=all
&DdlAuthority=true
&AllowDatabases=db1
&TotalDatabases=db1,db2
&AllowDictionaries=dt1
&TotalDictionaries=dt1,dt2
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<CreateAccountAndAuthorityResponse>
    <RequestId>F5178C10-1407-4987-9133-DE4DC9119F75</RequestId>
</CreateAccountAndAuthorityResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "F5178C10-1407-4987-9133-DE4DC9119F75"
}

Error codes

HttpCode Error code Error message Description
404 InvalidDBCluster.NotFound The DBClusterId provided does not exist in our records. The error message returned because the specified DBClusterId parameter does not exist. Check whether the cluster ID is valid.
500 InternalError An error occurred while processing your request. The error message returned because an internal error has occurred. Try again later.
503 ServiceUnavailable An error occurred while processing your request. The error message returned because the service is unavailable. Try again later.

For a list of error codes, visit the API Error Center.