Updated on 2025-12-09 GMT+08:00

Querying Roles

Function

This API is used to query roles of users.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
  • If you are using role/policy-based authorization, see Permissions and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

rds:databaseUser:list

-

-

g:EnterpriseProjectId

g:ResourceTag/<tag-key>

-

-

URI

  • URI format

    GET /v3/{project_id}/instances/{instance_id}/roles

  • Parameter description
    Table 1 Parameters

    Parameter

    Mandatory

    Description

    project_id

    Yes

    Definition

    Project ID of a tenant in a region.

    To obtain the value, see Obtaining a Project ID.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    instance_id

    Yes

    Definition

    Instance ID.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

    Table 2 Query parameters

    Parameter

    Mandatory

    Type

    Description

    user_name

    No

    String

    Definition

    Username.

    Constraints

    N/A

    Range

    If this parameter is specified, the set of roles that can be granted to the user is returned.

    Default Value

    N/A

Request

None

Example Request

Query roles of a user.

GET https://rds.ap-southeast-1.myhuaweicloud.com/v3/8b3d99b2fb1148c69be8fe37bb896f27/instances/51986c9a48df43839a3ba300d6c5e91fin03/roles?user_name=user1

Response

  • Normal response
    Table 3 Parameters

    Parameter

    Type

    Description

    roles

    Array of strings

    Definition

    Role information.

    Range

    N/A

  • Example normal response
    {
      "roles" : [ "user3", "user4" ] 
    }
  • Abnormal response

    For details, see Abnormal Request Results.

Status Code

Error Code

For details, see Error Codes.