All Products
Search
Document Center

PolarDB:DescribeAccounts

Last Updated:Jan 22, 2025

Queries information about a database account of a PolarDB cluster.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • For mandatory resource types, indicate with a prefix of * .
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
polardb:DescribeAccountsget
*dbcluster
acs:polardb:{#regionId}:{#accountId}:dbcluster/{#dbclusterId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DBClusterIdstringYes

The cluster ID.

pc-***************
AccountNamestringNo

The name of the account.

test_acc
PageNumberintegerNo

The page number of the page to return. Set this parameter to an integer that is larger than 0. Default value: 1.

1
PageSizeintegerNo

The number of entries to return on each page. Valid values:

  • 30
  • 50
  • 100

Default value: 30.

30

Response parameters

ParameterTypeDescriptionExample
object
PageRecordCountinteger

The number of entries returned per page.

1
RequestIdstring

The request ID.

155462B9-205F-4FFC-BB43-4855FE******
PageNumberinteger

The page number of the page returned.

1
Accountsarray<object>

The details of the account.

DBAccountobject
AccountStatusstring

The state of the account. Valid values:

  • Creating: The account is being created.
  • Available: The account is available.
  • Deleting: The account is being deleted
Available
DatabasePrivilegesarray<object>

The list of database permissions that are granted to the account.

DatabasePrivilegeobject
DBNamestring

The name of the database.

DBtest
AccountPrivilegestring

The permissions that the account is granted on the database. Valid values:

ReadOnly
AccountDescriptionstring

The description of the account.

test
AccountPasswordValidTimestring

The validity period of the password.

undefined
AccountTypestring

The type of the account. Valid values:

  • Normal: a standard account
  • Super: a privileged account
Normal
AccountLockStatestring

The locking state of the account. Valid values:

  • UnLock
  • Lock
UnLock
AccountNamestring

The name of the account.

test_acc
AccountPasswordstring

The password of the account that is used to log on to the database.

Test1111

Examples

Sample success responses

JSONformat

{
  "PageRecordCount": 1,
  "RequestId": "155462B9-205F-4FFC-BB43-4855FE******",
  "PageNumber": 1,
  "Accounts": [
    {
      "AccountStatus": "Available",
      "DatabasePrivileges": [
        {
          "DBName": "DBtest",
          "AccountPrivilege": "ReadOnly"
        }
      ],
      "AccountDescription": "test",
      "AccountPasswordValidTime": "undefined",
      "AccountType": "Normal",
      "AccountLockState": "UnLock",
      "AccountName": "test_acc",
      "AccountPassword": "Test1111"
    }
  ]
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidPageSize.MalformedThe specified parameter PageSize is not valid.The specified PageSize parameter is invalid.
400InvalidPageNumber.MalformedThe specified parameter PageNumber is not valid.The specified PageNumber parameter is invalid.
400Database.ConnectErrordb instance %s connect failed, please check instance status and database processlistFailed to connect to the database cluster. Check the cluster status and database process list.
400Account.QueryErrorInstance %s query account errorFailed to query accounts for cluster %s.
400Connect.TimeoutService can not connect to instance temporarily.Failed to connect to the cluster.
404InvalidDBCluster.NotFoundThe DBClusterId provided does not exist in our records.The specified DBClusterId parameter does not exist in the current record.
404InvalidDBClusterId.MalformedThe specified parameter DBClusterId is not valid.The specified DBClusterId parameter is invalid.
404InvalidDBClusterId.NotFoundThe DBInstanceId provided does not exist in our records.The specified DBClusterId parameter does not exist in the current record.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-11-03The Error code has changed. The response structure of the API has changedView Change Details
2023-06-12The Error code has changedView Change Details
2023-04-24The Error code has changedView Change Details