You can call the DescribeModifyPGHbaConfigLog operation to query the modification history 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 Yes DescribeModifyPGHbaConfigLog

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

ClientToken String No 1

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

DBInstanceId String Yes pgm-bp1lymyn1v3i****

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

StartTime String No 2021-11-25T05:00:40Z

The beginning of the time range to query. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

EndTime String No 2021-11-25T06:00:40Z

The end of the time range to query. Specify the time in the yyyy-MM-ddTHH:mmZ format. The time must be in UTC.

ResourceGroupId String No rg-acfmy*****

The ID of the resource group.

Response parameters

Parameter Type Example Description
DBInstanceId String pgm-bp1lymyn1v3i****

The ID of the instance.

RequestId String 6D797E6B-E157-510C-A27F-6F9E6DA40633

The ID of the request.

LogItemCount Integer 1

The number of modification records.

HbaLogItems Array of HbaLogItem

An array that consists of the modifications to the pg_hba.conf file.

HbaLogItem
ModifyStatus String success

The status of the modification.

  • success: The modification is successful.
  • failed: The modification failed.
  • setting: The modification is being applied.
StatusReason String null

The reason why the modification failed.

ModifyTime String 2021-11-25T06:00:40Z

The time when the pg_hba.conf file was modified. The time is displayed in UTC.

BeforeHbaItems Array of HbaItem

The configuration of the pg_hba.conf file before the modification was made.

HbaItem
Type String host

The type of the connection.

Mask String null

The mask of the instance.

Database String all

The name of the database.

PriorityId Integer 0

The priority of the configuration item in the pg_hba.conf file.

Address String 0.0.0.0/0

The IP address of the instance.

Option String null

The value of this parameter was set based on the value of the Method parameter.

Method String md5

The authentication method.

User String all

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

AfterHbaItems Array of HbaItem

The configuration of the pg_hba.conf file after the modification was made.

HbaItem
Type String host

The type of the connection.

Mask String null

The mask of the instance.

Database String all

The name of the database.

PriorityId Integer 0

The priority of the configuration item in the pg_hba.conf file.

Address String 0.0.0.0/0

The IP address of the instance.

Option String ldapserver=Private IP address of the ECS instance ldapbasedn="CN=Users,DC=pgsqldomain,DC=net" ldapbinddn="CN=Username of the administrator user of the AD domain controller,CN=Users,DC=pgsqldomain,DC=net" ldapbindpasswd="Password of the administrator user of the AD domain controller" ldapsearchattribute="sAMAccountName"

The value of this parameter was set based on the value of the Method parameter.

Method String ldap

The authentication method.

User String ldapuser

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

Examples

Sample requests

http(s)://rds.aliyuncs.com/?Action=DescribeModifyPGHbaConfigLog
&DBInstanceId=pgm-bp1lymyn1v3i****
&StartTime=2021-11-25T05:00:40Z
&EndTime=2021-11-25T06:00:40Z
&<Common request parameters>

Sample success responses

XML format

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

<DescribeModifyPGHbaConfigLogResponse>
    <DBInstanceId>pgm-bp1lymyn1v3i****</DBInstanceId>
    <RequestId>6D797E6B-E157-510C-A27F-6F9E6DA40633</RequestId>
    <LogItemCount>1</LogItemCount>
    <HbaLogItems>
        <ModifyStatus>success</ModifyStatus>
        <StatusReason/>
        <ModifyTime>2021-11-25T06:00:40Z</ModifyTime>
        <BeforeHbaItems>
            <Type>host</Type>
            <Database>all</Database>
            <PriorityId>0</PriorityId>
            <Address>0.0.0.0/0</Address>
            <Method>md5</Method>
            <User>all</User>
        </BeforeHbaItems>
        <AfterHbaItems>
            <Type>host</Type>
            <Database>all</Database>
            <PriorityId>0</PriorityId>
            <Address>0.0.0.0/0</Address>
            <Option>ldapserver=The private IP address of the ECS instance ldapbasedn="CN=Users,DC=pgsqldomain,DC=net" ldapbinddn="CN=The username of the administrator user of the AD domain controller, CN=Users,DC=pgsqldomain,DC=net" ldapbindpasswd="The password of the administrator user of the AD domain controller" ldapsearchattribute="sAMAccountName"</Option>
            <Method>ldap</Method>
            <User>ldapuser</User>
        </AfterHbaItems>
    </HbaLogItems>
</DescribeModifyPGHbaConfigLogResponse>

JSON format

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

{
  "DBInstanceId" : "pgm-bp1lymyn1v3i****",
  "RequestId" : "6D797E6B-E157-510C-A27F-6F9E6DA40633",
  "LogItemCount" : 1,
  "HbaLogItems" : {
    "ModifyStatus" : "success",
    "StatusReason" : "",
    "ModifyTime" : "2021-11-25T06:00:40Z",
    "BeforeHbaItems" : {
      "Type" : "host",
      "Database" : "all",
      "PriorityId" : 0,
      "Address" : "0.0.0.0/0",
      "Method" : "md5",
      "User" : "all"
    },
    "AfterHbaItems" : {
      "Type" : "host",
      "Database" : "all",
      "PriorityId" : 0,
      "Address" : "0.0.0.0/0",
      "Option" : "ldapserver=The private IP address of the ECS instance ldapbasedn=\"CN=Users,DC=pgsqldomain,DC=net\" ldapbinddn=\"CN=The username of the administrator user of the AD domain controller, CN=Users,DC=pgsqldomain,DC=net\" ldapbindpasswd=\" The password of the administrator user of the AD domain controller\" ldapsearchattribute=\"sAMAccountName\",
      "Method" : "ldap",
      "User" : "ldapuser"
    }
  }
}

Error codes

HTTP status code Error code Error message Description
400 InvalidStartTime.Format Specified start time is not valid. The error message returned because the specified start time is invalid.
400 InvalidEndTime.Format Specified end time is not valid. The error message returned because the specified end time is invalid. Check and enter the valid value.
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.