Updated on 2026-08-25 GMT+08:00

Modifying or Adding One or More Records in pg_hba.conf

Function

This API is used to modify or add one or more records in the pg_hba.conf file.

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, no identity policy-based permissions are required for calling this API.

URI

  • URI format

    PUT /v3/{project_id}/instances/{instance_id}/hba-info

  • 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.

    You can obtain the value of this parameter from id in Table 4 by calling the API for querying DB instances.

    Constraints

    N/A

    Range

    N/A

    Default Value

    N/A

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

Array elements

No

Array of objects

Definition

Parameters to be modified.

For details, see Table 3.

Constraints

N/A

Table 3 Parameters

Parameter

Mandatory

Type

Description

type

Yes

String

Definition

Connection type.

Constraints

N/A

Range

  • host: Access is controlled based on the client IP address or host name.
  • hostssl: It is similar to host, but the client must use SSL connections.
  • hostnossl: Access is controlled based on the client IP address or host name, but SSL connections are not allowed.

Default Value

N/A

database

Yes

String

Definition

Database name.

Constraints

N/A

Range

The value can be any name other than template0 and template1. Use commas (,) to separate multiple names.

You can obtain the value of this parameter from name in Table 3 by calling the API for querying databases.

Default Value

N/A

user

Yes

String

Definition

Name of a user other than rdsAdmin, rdsMetric, rdsBackup, rdsRepl, rdsProxy, rdsDdm, and rdsDisaster.

Constraints

N/A

Range

  • all indicates all database users of the DB instance.
  • Use commas (,) to separate multiple user names.

Default Value

N/A

address

Yes

String

Definition

Client IP address. 0.0.0.0/0 indicates that the user can access the database from any IP address.

Constraints

N/A

Range

N/A

Default Value

N/A

mask

No

String

Definition

Subnet mask.

Constraints

N/A

Range

N/A

Default Value

An empty string

method

Yes

String

Definition

Authentication mode.

Constraints

N/A

Range

Enumerated values: reject, md5, and scram-sha-256

Default Value

N/A

priority

Yes

Integer

Definition

Configuration priority.

Constraints

N/A

Range

The priority you specified determines whether to modify or add a record in the pg_hba.conf file.

  • If the priority you specified does not exist, a new record will be added to the pg_hba.conf file.
  • If the priority you specified already exists, the record will be modified in the pg_hba.conf file.

To obtain the existing priorities of the instance, see priority in Table 3 by calling the API for querying pg_hba.conf of a DB Instance.

Default Value

N/A

Example Request

PUT https://rds.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/e28979107ed04d3b8b2f1b819b8d2be3in03/hba-info

[ { 
   "type" : "host", 
   "database" : "all", 
   "user" : "all", 
   "address" : "0.0.0.0/0", 
   "mask" : "", 
   "method" : "md5", 
   "priority" : 0 
 } ]

Response

  • Normal response
    Table 4 Parameters

    Parameter

    Type

    Description

    code

    String

    Definition

    Result code.

    Range

    N/A

    message

    String

    Definition

    Result description.

    Range

    N/A

    • Example normal response
    { 
      "code" : 0, 
      "message" : "" 
    }

Status Code

Error Code

For details, see Error Codes.