Skip to content

Update Database

POST
/dbaas/{managed_db_id}/update/
curl --request POST \
--url 'https://api.e2enetworks.com/myaccount/api/v1/gpu/dbaas/{managed_db_id}/update/?project_id=<PROJECT_ID>&location=<LOCATION>&apikey=<API_KEY>' \
--header 'Authorization: Bearer <API_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"extensions": [
"pg_trgm"
],
"ip_allowlist": [
{
"cidr": "203.0.113.0/24",
"label": "office VPN"
}
]
}'

Changes several settings in one call. Send the fields to change: extensions, pg_id (or parameter_group_id), ip_allowlist, vpc_id and disk_size. They are applied in that order, each on its own, and results holds each one’s own response. The call answers 200 when all succeed, otherwise with the status of the first that failed; the others are still applied. pg_id: null detaches the parameter group and vpc_id: null detaches the VPC, when one is attached.

To make a single change instead, send action with that action’s fields; the response is then that change’s own response.

  • Extensions install only while the database is Running. Adding only extensions that are already installed is refused with “Already installed: ”.
  • A parameter group attaches while the database is Running or Scaling, and its values are set on the database at once. Values set by an earlier group stay unless the new group sets the same parameter. Detaching only removes the link; the values already applied stay.
  • The IP allowlist replaces the whole list, as in Update Database IP Allowlist.
  • A VPC attaches or detaches while the database is Running or Scaling, and the database restarts to take the change. Attaching a different VPC moves the database to it. On detach, the database moves onto the project’s default VPC, which is created then if the project has none. The default VPC itself cannot be detached.
  • The disk grows only while the database is Running, as in Resize Database Storage.

Needs the Update permission on DBaaS.

managed_db_id
required
integer

Database ID

project_id
required
integer

Project ID

active_iam
integer

Active IAM ID (To access contact person account) Find your Active IAM ID here

location
required
string
Allowed values: Delhi Chennai

Location

Media typeapplication/json
object
action

Make only this change. extensions uses extensions; attach_pg uses pg_id; detach_pg takes nothing more; allowlist uses ip_allowlist; vpc uses vpc_id, subnet_id and vpc_action; scale uses disk_size.

string
Allowed values: extensions attach_pg detach_pg allowlist vpc scale
extensions

Extensions to install, from List Database Extensions.

Array<string>
Allowed values: pg_stat_statements vector pg_trgm uuid-ossp pgcrypto hstore citext btree_gin btree_gist ltree unaccent

Example

[
"pg_trgm",
"citext"
]
pg_id

Parameter group to attach; null detaches.

integer
nullable

Example

8
parameter_group_id

Same as pg_id.

integer
nullable

Example

8
ip_allowlist

The whole new allowlist. Each entry is an IPv4 address or CIDR range, as a string or as an object with cidr and an optional label. A bare address becomes a /32 range, host bits are cleared (10.0.0.5/24 becomes 10.0.0.0/24), and a repeated range is kept once. Up to 50 entries. 0.0.0.0/0 allows any address.

Array
One of:
string

Example

[
{
"cidr": "203.0.113.0/24",
"label": "office VPN"
},
"198.51.100.7"
]
vpc_id

VPC to attach; null detaches.

integer
nullable

Example

17
subnet_id

Subnet of the VPC. Optional; without it the VPC’s subnet is used.

integer

Example

23
vpc_action

With action: vpc. Without it, the VPC attaches when vpc_id is sent and detaches otherwise.

string
Allowed values: attach detach
disk_size

New disk size in GB, at least the current size.

integer
>= 20 <= 2000

Example

200

Example

{
"extensions": [
"pg_trgm"
],
"ip_allowlist": [
{
"cidr": "203.0.113.0/24",
"label": "office VPN"
}
]
}

Every change was applied or started. Without action, the body below; with action, that change’s own response.

Media typeapplication/json
object
code
integer
updated

The fields that were applied, in order.

Array<string>
results

Each field’s own response, with its code, message, data and errors.

object

Example

{
"code": 200,
"updated": [
"extensions",
"ip_allowlist"
],
"results": {
"extensions": {
"code": 200,
"data": {
"installed": [
"pg_trgm"
],
"already_installed": [],
"failed": {},
"extensions": [
"pg_stat_statements",
"pg_trgm",
"plpgsql",
"vector"
]
},
"errors": {},
"message": "Success"
},
"ip_allowlist": {
"code": 200,
"data": {
"ip_allowlist": [
{
"cidr": "203.0.113.0/24",
"label": "office VPN"
}
]
},
"errors": {},
"message": "Success"
}
}
}

No field to change was sent (“No updatable fields provided. Send one or more of: disk_size, ip_allowlist, vpc_id, pg_id, extensions (or an explicit ‘action’).”) or action is not one this call accepts; these two come back as {"error": "..."}. Otherwise a change was refused, for example “Already installed: ”, “Extension ‘’ is not available for postgresql.”, “Parameter group ‘’ is already attached.”, “No parameter group attached.”, “No VPC attached.”, “This resource is already attached to a VPC.” or an allowlist or disk size error. A missing or invalid project ID also gives 400 with errors “Project ID is missing or invalid”.

Media typeapplication/json
object
error
string

Example

{
"error": "No updatable fields provided. Send one or more of: disk_size, ip_allowlist, vpc_id, pg_id, extensions (or an explicit 'action')."
}

The caller lacks the permission the call needs on the project, or the region is not allowed.

Media typeapplication/json
object
code
integer
message
string
data
object
errors
string

Example

{
"code": 403,
"message": "Forbidden",
"data": {},
"errors": "You don't have permission to access this service. Please verify your policy or project."
}

No database with that ID in the project and region (“Invalid request! Database Not Found”), or the parameter group, VPC or subnet was not found (“Parameter group not found.”, “VPC not found.”, “Subnet not found in this VPC.”).

Media typeapplication/json
object
code
integer
message
string
data
object
errors
string

Example

{
"code": 404,
"message": "Bad Request",
"data": {},
"errors": "Invalid request! Database Not Found"
}

The database is not Running (“Database NOT in RUNNING state. Please try again later.”) for a change that needs it, or a change could not be made (“Error occurred at backend! Please try after sometime.”, “Could not attach the VPC. Please try again.”, “Could not detach the VPC. Please try again.”, “This VPC cannot be detached. Attach another VPC instead.”).

Media typeapplication/json
object
code
integer
message
string
data
object
errors
string

Example

{
"code": 412,
"message": "Precondition Failed",
"data": {},
"errors": "Database NOT in RUNNING state. Please try again later."
}