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

Overwriting pg_hba.conf

Function

This API is used to overwrite the pg_hba.conf file with the input configurations. If the input parameters are left blank, the file is overwritten with the default configurations.

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

    POST /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.

    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

Enumerated values: host, hostssl, and hostnossl

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.

Default Value

N/A

user

Yes

String

Definition

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

Constraints

N/A

Range

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

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

N/A

Default Value

N/A

Example Request

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