You can call the DescribePGHbaConfig operation to query the configuration of the pg_hba.conf file of an ApsaraDB RDS for PostgreSQL instance.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String No DescribePGHbaConfig

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

ClientToken String No 1

This parameter is reserved. You do not need to specify this parameter.

DBInstanceId String Yes pgm-bp1lymyn1v3i****

The ID of the instance. You can call the DescribeDBInstances operation to query the IDs of instances.

Response parameters

Parameter Type Example Description
HbaModifyTime String 2021-11-25T06:00:40Z

The time when the previous modification was made to the pg_hba.conf file.

ModifyStatusReason String The specified users (testuser) is not exist.

The reason why the previous modification was made to the pg_hba.conf file.

RequestId String A147A124-A147-5CCF-9609-B73C028848DF

The ID of the request.

LastModifyStatus String success

The status of the previous modification to the pg_hba.conf file.

Valid values:

  • success: The modification is successful.
  • setting: The modification is being applied.
  • failed: The modification failed.
DefaultHbaItems Array of HbaItem

An array that consists of the default configuration items in the pg_hba.conf file.

HbaItem
Type String host

The type of connection to the instance. The value is fixed as host.

Mask String null

The mask of the instance. The value is fixed as none.

Database String all

The names of the databases that the specified users are allowed to access. The value is fixed as all or replication.

PriorityId Integer 0

The priority of the AD domain controller in the pg_hba.conf file. This value is automatically generated.

Address String 0.0.0.0/0

The IP addresses from which the specified users can access the specified databases. The value is fixed as 0.0.0.0/0.

Option String null

The value of this parameter is based on the value of the METHOD parameter. The value is fixed as none.

Method String md5

The authentication method of Lightweight Directory Access Protocol (LDAP). The value is fixed as md5.

User String all

The user that is allowed to access the instance. The value is fixed as all.

RunningHbaItems Array of HbaItem

An array that consists of the current configuration items in the pg_hba.conf file.

HbaItem
Type String host

The type of connection to the instance.

  • host: specifies to verify TCP/IP connections, including SSL connections and non-SSL connections.
  • hostssl: specifies to verify only TCP/IP connections that are established over SSL connections.
  • hostnossl: specifies to verify only TCP/IP connections that are established over non-SSL connections.
Mask String null

The mask of the instance.

Database String all

The names of the databases that the specified users are allowed to access.

PriorityId Integer 3

The priority of the configuration item.

Address String 0.0.0.0/0

The IP addresses from which the specified users can access the specified databases.

Option String null

The value of this parameter is based on the value of the METHOD parameter. If this parameter is not required, leave this parameter empty.

Method String md5

The the authentication method of LDAP.

User String all

The user that is allowed to access the instance.

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=DescribePGHbaConfig
&DBInstanceId=pgm-bp1lymyn1v3i****
&<Common request parameters>

Sample success responses

XML format

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

<DescribePGHbaConfigResponse>
    <HbaModifyTime>2021-11-25T06:00:40Z</HbaModifyTime>
    <ModifyStatusReason/>
    <RequestId>A147A124-A147-5CCF-9609-B73C028848DF</RequestId>
    <LastModifyStatus>success</LastModifyStatus>
    <DefaultHbaItems>
        <Type>host</Type>
        <Database>all</Database>
        <PriorityId>0</PriorityId>
        <Address>0.0.0.0/0</Address>
        <Method>md5</Method>
        <User>all</User>
    </DefaultHbaItems>
    <RunningHbaItems>
        <Type>host</Type>
        <Database>all</Database>
        <PriorityId>3</PriorityId>
        <Address>0.0.0.0/0</Address>
        <Method>md5</Method>
        <User>all</User>
    </RunningHbaItems>
</DescribePGHbaConfigResponse>

JSON format

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

{
  "HbaModifyTime" : "2021-11-25T06:00:40Z",
  "ModifyStatusReason" : "",
  "RequestId" : "A147A124-A147-5CCF-9609-B73C028848DF",
  "LastModifyStatus" : "success",
  "DefaultHbaItems" : {
    "Type" : "host",
    "Database" : "all",
    "PriorityId" : 0,
    "Address" : "0.0.0.0/0",
    "Method" : "md5",
    "User" : "all"
  },
  "RunningHbaItems" : {
    "Type" : "host",
    "Database" : "all",
    "PriorityId" : 3,
    "Address" : "0.0.0.0/0",
    "Method" : "md5",
    "User" : "all"
  }
}

Error codes

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