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 for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes 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 ID of instance.

ResourceGroupId String No rg-acfmy*****

The ID of the resource group.

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 fails.
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 null.

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 configuration items 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 null.

Method String md5

The authentication method. 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 the connection.

  • host: The record matches TCP/IP connections, including SSL connections and non-SSL connections.
  • hostssl: The record matches only TCP/IP connections that are established over SSL.
  • hostnossl: The record matches only TCP/IP connections that are not established over SSL.
Mask String null

The mask of the instance.

Database String all

The name of the database that the specified users are allowed to access.

PriorityId Integer 3

The priority of the instance.

Address String 0.0.0.0/0

The IP address of the client.

Option String null

The value of this parameter varies based on the value of the Method parameter. The value is fixed as null.

Method String md5

The authentication method.

User String all

The username of the account that is used to connect to the instance.

DBInstanceId String rm-bp1*****

The ID of 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

HTTP status code Error code Error message Description
400 IncorrectDBInstanceType Current DB instance type does not support this operation. The error message returned because this operation is not supported when the instance is in the current state.
400 InvalidDBInstanceName.NotFound The specified DB instance name does not exist. The error message returned because the name of the instance cannot be found.

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