PgBeam Docs
Policies

UpdatePolicyProfile

Update a policy profile

Updates a policy profile. Changes hot-reload to active agent sessions.

Usage

result, err := client.Policies.UpdatePolicyProfile(ctx, "prj_xxx", "pol_xxx", pgbeam.PolicyProfileInput{
    Name: "...",
  })

Parameters

ParameterTypeRequiredDescription
ctxcontext.ContextYesRequest context
projectIDstringYesUnique project identifier (prefixed, e.g. prj_xxx).
policyIDstringYesUnique policy profile identifier (prefixed, e.g. pol_xxx).
reqpgbeam.PolicyProfileInputYesRequest body
req.NamestringYesHuman-readable name for the policy profile.
req.AccessMode*stringNoread_only blocks all data and schema mutations.
req.StatementRules*pgbeam.StatementRulesNo
req.TableAllowlist*[]stringNoIf non-empty, only these relations are reachable.
req.TableDenylist*[]stringNoRelations explicitly blocked.
req.MaskingRules*[]pgbeam.MaskingRuleNoColumn masking rules applied to query results.
req.BudgetQueriesPerHour*intNoMax queries per rolling hour window. 0 means unlimited.
req.BudgetQueriesPerDay*intNoMax queries per day window. 0 means unlimited.
req.MaxRows*intNoMax rows returned per query. 0 means unlimited.
req.StatementTimeoutMs*intNoUpstream statement timeout for agent sessions. 0 uses the project default.
req.RowFilters*[]pgbeam.RowFilterNoPer-relation row filters ANDed into agent reads.
req.WriteMode*stringNoHow writes are handled. normal commits, rollback auto-rolls back, sandbox routes to an ephemeral branch.
req.ApprovalMode*stringNoWhich statement classes require human approval before execution.
req.ApprovalAutoMaxRows*intNoStatements touching at most this many rows are auto-approved. 0 means none.
req.ApprovalTimeoutSeconds*intNoHow long a held statement waits for a decision before expiring.
req.MigrationSafety*stringNoMigration safety mode. warn surfaces findings, block refuses unsafe DDL.
req.EgressBytesPerDay*intNoPer-day egress budget in bytes. 0 means unlimited.

Response

(*pgbeam.PolicyProfile, error) — updated policy profile.

Example

import pgbeam "go.pgbeam.com/sdk"

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

result, err := client.Policies.UpdatePolicyProfile(ctx, "prj_xxx", "pol_xxx", pgbeam.PolicyProfileInput{
    Name: "...",
    AccessMode: "read_only",
    StatementRules: pgbeam.StatementRules{ /* ... */ },
    TableAllowlist: nil,
    TableDenylist: nil,
    MaskingRules: nil,
  })
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