PgBeam Docs
Databases

UpdateDatabase

Update a database

Partially updates a database connection. Only provided fields are modified.

Usage

result, err := client.Databases.UpdateDatabase(ctx, "prj_xxx", "db_xxx", &pgbeam.UpdateDatabaseRequest{

  })

Parameters

ParameterTypeRequiredDescription
ctxcontext.ContextYesRequest context
projectIDstringYesUnique project identifier (prefixed, e.g. prj_xxx).
databaseIDstringYesUnique database identifier (prefixed, e.g. db_xxx).
req*pgbeam.UpdateDatabaseRequestYesRequest body
req.Host*stringNoUpdated PostgreSQL host.
req.Port*intNoUpdated PostgreSQL port.
req.Name*stringNoUpdated PostgreSQL database name.
req.Username*stringNoUpdated PostgreSQL username.
req.Password*stringNoUpdated PostgreSQL password.
req.SSLMode*pgbeam.SSLModeNo
req.Role*pgbeam.DatabaseRoleNo
req.PoolRegion*stringNoRegion where the connection pool is maintained (near the database). When set and different from the client's edge region, queries are relayed through the pool region's data plane. Empty means direct connection.
req.QueryTimeoutMs*intNoQuery timeout in milliseconds. 0 means disabled.
req.AutoReadRouting*boolNoAuto-route SELECT queries to read replicas.
req.CacheConfig*pgbeam.CacheConfigNo
req.PoolConfig*pgbeam.PoolConfigNo

Response

(*pgbeam.Database, error) — database updated.

Example

import pgbeam "github.com/pgbeam/pgbeam-go"

client := pgbeam.NewClient(&pgbeam.ClientOptions{
  APIKey: "pgb_your_api_key",
})

result, err := client.Databases.UpdateDatabase(ctx, "prj_xxx", "db_xxx", &pgbeam.UpdateDatabaseRequest{
    Host: "db.example.com",
    Port: 5432,
    Name: "mydb",
    Username: "pgbeam",
    Password: "...",
    SSLMode: pgbeam.SSLMode{ /* ... */ },
  })
if err != nil {
  log.Fatal(err)
}
fmt.Println(result)

Errors

StatusDescription
400Invalid request parameters.
401Missing or invalid authentication.
403Operation not allowed by current plan limits.
404Resource not found.
429Rate limited. Try again later.

On this page