postgres

package
v0.98.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Use the Postgres API to create and manage Lakebase Autoscaling Postgres infrastructure, including projects, branches, compute endpoints, and roles.

This API manages database infrastructure only. To query or modify data, use the Data API or direct SQL connections.

**About resource IDs and names**

Lakebase APIs use hierarchical resource names in API paths to identify resources, such as `projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id}`.

When creating a resource, you may optionally provide the final ID component (for example, `project_id`, `branch_id`, or `endpoint_id`). If you do not, the system generates an identifier and uses it as the ID component.

The `name` field is output-only and represents the full resource path. Note: The term *resource name* in this API refers to this full, hierarchical identifier (for example, `projects/{project_id}`), not the `display_name` field. The `display_name` is a separate, user-visible label shown in the UI.

The `uid` field is a system-generated, immutable identifier intended for internal reference and should not be used to address or locate resources.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Branch

type Branch struct {
	// A timestamp indicating when the branch was created.
	CreateTime *time.Time `json:"create_time,omitempty"`
	// The resource name of the branch. This field is output-only and
	// constructed by the system. Format:
	// `projects/{project_id}/branches/{branch_id}`
	Name string `json:"name,omitempty"`
	// The project containing this branch (API resource hierarchy). Format:
	// projects/{project_id}
	//
	// Note: This field indicates where the branch exists in the resource
	// hierarchy. For point-in-time branching from another branch, see
	// `spec.source_branch`.
	Parent string `json:"parent,omitempty"`
	// The spec contains the branch configuration.
	Spec *BranchSpec `json:"spec,omitempty"`
	// The current status of a Branch.
	Status *BranchStatus `json:"status,omitempty"`
	// System-generated unique ID for the branch.
	Uid string `json:"uid,omitempty"`
	// A timestamp indicating when the branch was last updated.
	UpdateTime *time.Time `json:"update_time,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (Branch) MarshalJSON

func (s Branch) MarshalJSON() ([]byte, error)

func (*Branch) UnmarshalJSON

func (s *Branch) UnmarshalJSON(b []byte) error

type BranchOperationMetadata

type BranchOperationMetadata struct {
}

type BranchSpec added in v0.96.0

type BranchSpec struct {
	// Absolute expiration timestamp. When set, the branch will expire at this
	// time.
	ExpireTime *time.Time `json:"expire_time,omitempty"`
	// When set to true, protects the branch from deletion and reset. Associated
	// compute endpoints and the project cannot be deleted while the branch is
	// protected.
	IsProtected bool `json:"is_protected,omitempty"`
	// Explicitly disable expiration. When set to true, the branch will not
	// expire. If set to false, the request is invalid; provide either ttl or
	// expire_time instead.
	NoExpiry bool `json:"no_expiry,omitempty"`
	// The name of the source branch from which this branch was created (data
	// lineage for point-in-time recovery). If not specified, defaults to the
	// project's default branch. Format:
	// projects/{project_id}/branches/{branch_id}
	SourceBranch string `json:"source_branch,omitempty"`
	// The Log Sequence Number (LSN) on the source branch from which this branch
	// was created.
	SourceBranchLsn string `json:"source_branch_lsn,omitempty"`
	// The point in time on the source branch from which this branch was
	// created.
	SourceBranchTime *time.Time `json:"source_branch_time,omitempty"`
	// Relative time-to-live duration. When set, the branch will expire at
	// creation_time + ttl.
	Ttl *duration.Duration `json:"ttl,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (BranchSpec) MarshalJSON added in v0.96.0

func (s BranchSpec) MarshalJSON() ([]byte, error)

func (*BranchSpec) UnmarshalJSON added in v0.96.0

func (s *BranchSpec) UnmarshalJSON(b []byte) error

type BranchStatus added in v0.96.0

type BranchStatus struct {
	// The branch's state, indicating if it is initializing, ready for use, or
	// archived.
	CurrentState BranchStatusState `json:"current_state,omitempty"`
	// Whether the branch is the project's default branch.
	Default bool `json:"default,omitempty"`
	// Absolute expiration time for the branch. Empty if expiration is disabled.
	ExpireTime *time.Time `json:"expire_time,omitempty"`
	// Whether the branch is protected.
	IsProtected bool `json:"is_protected,omitempty"`
	// The logical size of the branch.
	LogicalSizeBytes int64 `json:"logical_size_bytes,omitempty"`
	// The pending state of the branch, if a state transition is in progress.
	PendingState BranchStatusState `json:"pending_state,omitempty"`
	// The name of the source branch from which this branch was created. Format:
	// projects/{project_id}/branches/{branch_id}
	SourceBranch string `json:"source_branch,omitempty"`
	// The Log Sequence Number (LSN) on the source branch from which this branch
	// was created.
	SourceBranchLsn string `json:"source_branch_lsn,omitempty"`
	// The point in time on the source branch from which this branch was
	// created.
	SourceBranchTime *time.Time `json:"source_branch_time,omitempty"`
	// A timestamp indicating when the `current_state` began.
	StateChangeTime *time.Time `json:"state_change_time,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (BranchStatus) MarshalJSON added in v0.96.0

func (s BranchStatus) MarshalJSON() ([]byte, error)

func (*BranchStatus) UnmarshalJSON added in v0.96.0

func (s *BranchStatus) UnmarshalJSON(b []byte) error

type BranchStatusState added in v0.96.0

type BranchStatusState string

The state of the database branch.

const BranchStatusStateArchived BranchStatusState = `ARCHIVED`
const BranchStatusStateImporting BranchStatusState = `IMPORTING`
const BranchStatusStateInit BranchStatusState = `INIT`
const BranchStatusStateReady BranchStatusState = `READY`
const BranchStatusStateResetting BranchStatusState = `RESETTING`

func (*BranchStatusState) Set added in v0.96.0

func (f *BranchStatusState) Set(v string) error

Set raw string value and validate it against allowed values

func (*BranchStatusState) String added in v0.96.0

func (f *BranchStatusState) String() string

String representation for fmt.Print

func (*BranchStatusState) Type added in v0.96.0

func (f *BranchStatusState) Type() string

Type always returns BranchStatusState to satisfy [pflag.Value] interface

func (*BranchStatusState) Values added in v0.96.0

func (f *BranchStatusState) Values() []BranchStatusState

Values returns all possible values for BranchStatusState.

There is no guarantee on the order of the values in the slice.

type CreateBranchOperationInterface

type CreateBranchOperationInterface interface {

	// Wait blocks until the long-running operation is completed. If no timeout is
	// specified, this will poll indefinitely. If a timeout is provided and the operation
	// didn't finish within the timeout, this function will return an error, otherwise
	// returns successful response and any errors encountered.
	Wait(ctx context.Context, opts ...api.Option) (*Branch, error)

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*BranchOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type CreateBranchRequest

type CreateBranchRequest struct {
	// The Branch to create.
	Branch Branch `json:"branch"`
	// The ID to use for the Branch. This becomes the final component of the
	// branch's resource name. The ID must be 1-63 characters long, start with a
	// lowercase letter, and contain only lowercase letters, numbers, and
	// hyphens (RFC 1123). Examples: - With custom ID: `staging` → name
	// becomes `projects/{project_id}/branches/staging` - Without custom ID:
	// system generates slug → name becomes
	// `projects/{project_id}/branches/br-example-name-x1y2z3a4`
	BranchId string `json:"-" url:"branch_id"`
	// The Project where this Branch will be created. Format:
	// projects/{project_id}
	Parent string `json:"-" url:"-"`
}

type CreateEndpointOperationInterface

type CreateEndpointOperationInterface interface {

	// Wait blocks until the long-running operation is completed. If no timeout is
	// specified, this will poll indefinitely. If a timeout is provided and the operation
	// didn't finish within the timeout, this function will return an error, otherwise
	// returns successful response and any errors encountered.
	Wait(ctx context.Context, opts ...api.Option) (*Endpoint, error)

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*EndpointOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type CreateEndpointRequest

type CreateEndpointRequest struct {
	// The Endpoint to create.
	Endpoint Endpoint `json:"endpoint"`
	// The ID to use for the Endpoint. This becomes the final component of the
	// endpoint's resource name. The ID must be 1-63 characters long, start with
	// a lowercase letter, and contain only lowercase letters, numbers, and
	// hyphens (RFC 1123). Examples: - With custom ID: `primary` → name
	// becomes `projects/{project_id}/branches/{branch_id}/endpoints/primary` -
	// Without custom ID: system generates slug → name becomes
	// `projects/{project_id}/branches/{branch_id}/endpoints/ep-example-name-x1y2z3a4`
	EndpointId string `json:"-" url:"endpoint_id"`
	// The Branch where this Endpoint will be created. Format:
	// projects/{project_id}/branches/{branch_id}
	Parent string `json:"-" url:"-"`
}

type CreateProjectOperationInterface

type CreateProjectOperationInterface interface {

	// Wait blocks until the long-running operation is completed. If no timeout is
	// specified, this will poll indefinitely. If a timeout is provided and the operation
	// didn't finish within the timeout, this function will return an error, otherwise
	// returns successful response and any errors encountered.
	Wait(ctx context.Context, opts ...api.Option) (*Project, error)

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*ProjectOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type CreateProjectRequest

type CreateProjectRequest struct {
	// The Project to create.
	Project Project `json:"project"`
	// The ID to use for the Project. This becomes the final component of the
	// project's resource name. The ID must be 1-63 characters long, start with
	// a lowercase letter, and contain only lowercase letters, numbers, and
	// hyphens (RFC 1123). Examples: - With custom ID: `production` → name
	// becomes `projects/production` - Without custom ID: system generates UUID
	// → name becomes `projects/a7f89b2c-3d4e-5f6g-7h8i-9j0k1l2m3n4o`
	ProjectId string `json:"-" url:"project_id"`
}

type CreateRoleOperationInterface added in v0.96.0

type CreateRoleOperationInterface interface {

	// Wait blocks until the long-running operation is completed. If no timeout is
	// specified, this will poll indefinitely. If a timeout is provided and the operation
	// didn't finish within the timeout, this function will return an error, otherwise
	// returns successful response and any errors encountered.
	Wait(ctx context.Context, opts ...api.Option) (*Role, error)

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*RoleOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type CreateRoleRequest added in v0.96.0

type CreateRoleRequest struct {
	// The Branch where this Role is created. Format:
	// projects/{project_id}/branches/{branch_id}
	Parent string `json:"-" url:"-"`
	// The desired specification of a Role.
	Role Role `json:"role"`
	// The ID to use for the Role, which will become the final component of the
	// role's resource name. This ID becomes the role in Postgres.
	//
	// This value should be 4-63 characters, and valid characters are lowercase
	// letters, numbers, and hyphens, as defined by RFC 1123.
	RoleId string `json:"-" url:"role_id"`
}

type DatabaseCredential added in v0.98.0

type DatabaseCredential struct {
	// Timestamp in UTC of when this credential expires.
	ExpireTime *time.Time `json:"expire_time,omitempty"`
	// The OAuth token that can be used as a password when connecting to a
	// database.
	Token string `json:"token,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (DatabaseCredential) MarshalJSON added in v0.98.0

func (s DatabaseCredential) MarshalJSON() ([]byte, error)

func (*DatabaseCredential) UnmarshalJSON added in v0.98.0

func (s *DatabaseCredential) UnmarshalJSON(b []byte) error

type DatabricksServiceExceptionWithDetailsProto

type DatabricksServiceExceptionWithDetailsProto struct {
	Details []json.RawMessage `json:"details,omitempty"`

	ErrorCode ErrorCode `json:"error_code,omitempty"`

	Message string `json:"message,omitempty"`

	StackTrace string `json:"stack_trace,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

Databricks Error that is returned by all Databricks APIs.

func (DatabricksServiceExceptionWithDetailsProto) MarshalJSON

func (*DatabricksServiceExceptionWithDetailsProto) UnmarshalJSON

type DeleteBranchOperationInterface added in v0.97.0

type DeleteBranchOperationInterface interface {

	// Wait blocks until the long-running operation is completed. If no timeout is
	// specified, this will poll indefinitely. If a timeout is provided and the operation
	// didn't finish within the timeout, this function will return an error, otherwise
	// returns successful response and any errors encountered.
	Wait(ctx context.Context, opts ...api.Option) error

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*BranchOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type DeleteBranchRequest

type DeleteBranchRequest struct {
	// The name of the Branch to delete. Format:
	// projects/{project_id}/branches/{branch_id}
	Name string `json:"-" url:"-"`
}

type DeleteEndpointOperationInterface added in v0.97.0

type DeleteEndpointOperationInterface interface {

	// Wait blocks until the long-running operation is completed. If no timeout is
	// specified, this will poll indefinitely. If a timeout is provided and the operation
	// didn't finish within the timeout, this function will return an error, otherwise
	// returns successful response and any errors encountered.
	Wait(ctx context.Context, opts ...api.Option) error

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*EndpointOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type DeleteEndpointRequest

type DeleteEndpointRequest struct {
	// The name of the Endpoint to delete. Format:
	// projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id}
	Name string `json:"-" url:"-"`
}

type DeleteProjectOperationInterface added in v0.97.0

type DeleteProjectOperationInterface interface {

	// Wait blocks until the long-running operation is completed. If no timeout is
	// specified, this will poll indefinitely. If a timeout is provided and the operation
	// didn't finish within the timeout, this function will return an error, otherwise
	// returns successful response and any errors encountered.
	Wait(ctx context.Context, opts ...api.Option) error

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*ProjectOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type DeleteProjectRequest

type DeleteProjectRequest struct {
	// The name of the Project to delete. Format: projects/{project_id}
	Name string `json:"-" url:"-"`
}

type DeleteRoleOperationInterface added in v0.96.0

type DeleteRoleOperationInterface interface {

	// Wait blocks until the long-running operation is completed. If no timeout is
	// specified, this will poll indefinitely. If a timeout is provided and the operation
	// didn't finish within the timeout, this function will return an error, otherwise
	// returns successful response and any errors encountered.
	Wait(ctx context.Context, opts ...api.Option) error

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*RoleOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type DeleteRoleRequest added in v0.96.0

type DeleteRoleRequest struct {
	// The resource name of the postgres role. Format:
	// projects/{project_id}/branches/{branch_id}/roles/{role_id}
	Name string `json:"-" url:"-"`
	// Reassign objects. If this is set, all objects owned by the role are
	// reassigned to the role specified in this parameter.
	//
	// NOTE: setting this requires spinning up a compute to succeed, since it
	// involves running SQL queries.
	//
	// TODO: #LKB-7187 implement reassign_owned_to on LBM side. This might
	// end-up being a synchronous query when this parameter is used.
	ReassignOwnedTo string `json:"-" url:"reassign_owned_to,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (DeleteRoleRequest) MarshalJSON added in v0.96.0

func (s DeleteRoleRequest) MarshalJSON() ([]byte, error)

func (*DeleteRoleRequest) UnmarshalJSON added in v0.96.0

func (s *DeleteRoleRequest) UnmarshalJSON(b []byte) error

type Endpoint

type Endpoint struct {
	// A timestamp indicating when the compute endpoint was created.
	CreateTime *time.Time `json:"create_time,omitempty"`
	// The resource name of the endpoint. This field is output-only and
	// constructed by the system. Format:
	// `projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id}`
	Name string `json:"name,omitempty"`
	// The branch containing this endpoint (API resource hierarchy). Format:
	// projects/{project_id}/branches/{branch_id}
	Parent string `json:"parent,omitempty"`
	// The spec contains the compute endpoint configuration, including
	// autoscaling limits, suspend timeout, and disabled state.
	Spec *EndpointSpec `json:"spec,omitempty"`
	// Current operational status of the compute endpoint.
	Status *EndpointStatus `json:"status,omitempty"`
	// System-generated unique ID for the endpoint.
	Uid string `json:"uid,omitempty"`
	// A timestamp indicating when the compute endpoint was last updated.
	UpdateTime *time.Time `json:"update_time,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (Endpoint) MarshalJSON

func (s Endpoint) MarshalJSON() ([]byte, error)

func (*Endpoint) UnmarshalJSON

func (s *Endpoint) UnmarshalJSON(b []byte) error

type EndpointHosts added in v0.98.0

type EndpointHosts struct {
	// The hostname to connect to this endpoint. For read-write endpoints, this
	// is a read-write hostname which connects to the primary compute. For
	// read-only endpoints, this is a read-only hostname which allows read-only
	// operations.
	Host string `json:"host,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

Encapsulates various hostnames (r/w or r/o, pooled or not) for an endpoint.

func (EndpointHosts) MarshalJSON added in v0.98.0

func (s EndpointHosts) MarshalJSON() ([]byte, error)

func (*EndpointHosts) UnmarshalJSON added in v0.98.0

func (s *EndpointHosts) UnmarshalJSON(b []byte) error

type EndpointOperationMetadata

type EndpointOperationMetadata struct {
}

type EndpointSettings

type EndpointSettings struct {
	// A raw representation of Postgres settings.
	PgSettings map[string]string `json:"pg_settings,omitempty"`
}

A collection of settings for a compute endpoint.

type EndpointSpec added in v0.96.0

type EndpointSpec struct {
	// The maximum number of Compute Units. Minimum value is 0.5.
	AutoscalingLimitMaxCu float64 `json:"autoscaling_limit_max_cu,omitempty"`
	// The minimum number of Compute Units. Minimum value is 0.5.
	AutoscalingLimitMinCu float64 `json:"autoscaling_limit_min_cu,omitempty"`
	// Whether to restrict connections to the compute endpoint. Enabling this
	// option schedules a suspend compute operation. A disabled compute endpoint
	// cannot be enabled by a connection or console action.
	Disabled bool `json:"disabled,omitempty"`
	// The endpoint type. A branch can only have one READ_WRITE endpoint.
	EndpointType EndpointType `json:"endpoint_type"`

	Settings *EndpointSettings `json:"settings,omitempty"`
	// Duration of inactivity after which the compute endpoint is automatically
	// suspended. Supported values: -1s (never suspend), 0s (use default), or
	// value should be between 60s and 604800s (1 minute to 1 week).
	SuspendTimeoutDuration *duration.Duration `json:"suspend_timeout_duration,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (EndpointSpec) MarshalJSON added in v0.96.0

func (s EndpointSpec) MarshalJSON() ([]byte, error)

func (*EndpointSpec) UnmarshalJSON added in v0.96.0

func (s *EndpointSpec) UnmarshalJSON(b []byte) error

type EndpointStatus added in v0.96.0

type EndpointStatus struct {
	// The maximum number of Compute Units.
	AutoscalingLimitMaxCu float64 `json:"autoscaling_limit_max_cu,omitempty"`
	// The minimum number of Compute Units.
	AutoscalingLimitMinCu float64 `json:"autoscaling_limit_min_cu,omitempty"`

	CurrentState EndpointStatusState `json:"current_state,omitempty"`
	// Whether to restrict connections to the compute endpoint. Enabling this
	// option schedules a suspend compute operation. A disabled compute endpoint
	// cannot be enabled by a connection or console action.
	Disabled bool `json:"disabled,omitempty"`
	// The endpoint type. A branch can only have one READ_WRITE endpoint.
	EndpointType EndpointType `json:"endpoint_type,omitempty"`
	// Contains host information for connecting to the endpoint.
	Hosts *EndpointHosts `json:"hosts,omitempty"`

	PendingState EndpointStatusState `json:"pending_state,omitempty"`

	Settings *EndpointSettings `json:"settings,omitempty"`
	// Duration of inactivity after which the compute endpoint is automatically
	// suspended.
	SuspendTimeoutDuration *duration.Duration `json:"suspend_timeout_duration,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (EndpointStatus) MarshalJSON added in v0.96.0

func (s EndpointStatus) MarshalJSON() ([]byte, error)

func (*EndpointStatus) UnmarshalJSON added in v0.96.0

func (s *EndpointStatus) UnmarshalJSON(b []byte) error

type EndpointStatusState added in v0.96.0

type EndpointStatusState string

The state of the compute endpoint.

const EndpointStatusStateActive EndpointStatusState = `ACTIVE`
const EndpointStatusStateIdle EndpointStatusState = `IDLE`
const EndpointStatusStateInit EndpointStatusState = `INIT`

func (*EndpointStatusState) Set added in v0.96.0

func (f *EndpointStatusState) Set(v string) error

Set raw string value and validate it against allowed values

func (*EndpointStatusState) String added in v0.96.0

func (f *EndpointStatusState) String() string

String representation for fmt.Print

func (*EndpointStatusState) Type added in v0.96.0

func (f *EndpointStatusState) Type() string

Type always returns EndpointStatusState to satisfy [pflag.Value] interface

func (*EndpointStatusState) Values added in v0.96.0

Values returns all possible values for EndpointStatusState.

There is no guarantee on the order of the values in the slice.

type EndpointType

type EndpointType string

The compute endpoint type. Either `read_write` or `read_only`.

const EndpointTypeEndpointTypeReadOnly EndpointType = `ENDPOINT_TYPE_READ_ONLY`
const EndpointTypeEndpointTypeReadWrite EndpointType = `ENDPOINT_TYPE_READ_WRITE`

func (*EndpointType) Set

func (f *EndpointType) Set(v string) error

Set raw string value and validate it against allowed values

func (*EndpointType) String

func (f *EndpointType) String() string

String representation for fmt.Print

func (*EndpointType) Type

func (f *EndpointType) Type() string

Type always returns EndpointType to satisfy [pflag.Value] interface

func (*EndpointType) Values

func (f *EndpointType) Values() []EndpointType

Values returns all possible values for EndpointType.

There is no guarantee on the order of the values in the slice.

type ErrorCode

type ErrorCode string

Legacy definition of the ErrorCode enum. Please keep in sync with api-base/proto/error_code.proto (except status code mapping annotations as this file doesn't have them). Will be removed eventually, pending the ScalaPB 0.4 cleanup.

const ErrorCodeAborted ErrorCode = `ABORTED`
const ErrorCodeAlreadyExists ErrorCode = `ALREADY_EXISTS`
const ErrorCodeBadRequest ErrorCode = `BAD_REQUEST`
const ErrorCodeCancelled ErrorCode = `CANCELLED`
const ErrorCodeCatalogAlreadyExists ErrorCode = `CATALOG_ALREADY_EXISTS`
const ErrorCodeCatalogDoesNotExist ErrorCode = `CATALOG_DOES_NOT_EXIST`
const ErrorCodeCatalogNotEmpty ErrorCode = `CATALOG_NOT_EMPTY`
const ErrorCodeCouldNotAcquireLock ErrorCode = `COULD_NOT_ACQUIRE_LOCK`
const ErrorCodeCustomerUnauthorized ErrorCode = `CUSTOMER_UNAUTHORIZED`
const ErrorCodeDacAlreadyExists ErrorCode = `DAC_ALREADY_EXISTS`
const ErrorCodeDacDoesNotExist ErrorCode = `DAC_DOES_NOT_EXIST`
const ErrorCodeDataLoss ErrorCode = `DATA_LOSS`
const ErrorCodeDeadlineExceeded ErrorCode = `DEADLINE_EXCEEDED`
const ErrorCodeDeploymentTimeout ErrorCode = `DEPLOYMENT_TIMEOUT`
const ErrorCodeDirectoryNotEmpty ErrorCode = `DIRECTORY_NOT_EMPTY`
const ErrorCodeDirectoryProtected ErrorCode = `DIRECTORY_PROTECTED`
const ErrorCodeDryRunFailed ErrorCode = `DRY_RUN_FAILED`
const ErrorCodeEndpointNotFound ErrorCode = `ENDPOINT_NOT_FOUND`
const ErrorCodeExternalLocationAlreadyExists ErrorCode = `EXTERNAL_LOCATION_ALREADY_EXISTS`
const ErrorCodeExternalLocationDoesNotExist ErrorCode = `EXTERNAL_LOCATION_DOES_NOT_EXIST`
const ErrorCodeFeatureDisabled ErrorCode = `FEATURE_DISABLED`
const ErrorCodeGitConflict ErrorCode = `GIT_CONFLICT`
const ErrorCodeGitRemoteError ErrorCode = `GIT_REMOTE_ERROR`
const ErrorCodeGitSensitiveTokenDetected ErrorCode = `GIT_SENSITIVE_TOKEN_DETECTED`
const ErrorCodeGitUnknownRef ErrorCode = `GIT_UNKNOWN_REF`
const ErrorCodeGitUrlNotOnAllowList ErrorCode = `GIT_URL_NOT_ON_ALLOW_LIST`
const ErrorCodeInsecurePartnerResponse ErrorCode = `INSECURE_PARTNER_RESPONSE`
const ErrorCodeInternalError ErrorCode = `INTERNAL_ERROR`
const ErrorCodeInvalidParameterValue ErrorCode = `INVALID_PARAMETER_VALUE`
const ErrorCodeInvalidState ErrorCode = `INVALID_STATE`
const ErrorCodeInvalidStateTransition ErrorCode = `INVALID_STATE_TRANSITION`
const ErrorCodeIoError ErrorCode = `IO_ERROR`
const ErrorCodeIpynbFileInRepo ErrorCode = `IPYNB_FILE_IN_REPO`
const ErrorCodeMalformedPartnerResponse ErrorCode = `MALFORMED_PARTNER_RESPONSE`
const ErrorCodeMalformedRequest ErrorCode = `MALFORMED_REQUEST`
const ErrorCodeManagedResourceGroupDoesNotExist ErrorCode = `MANAGED_RESOURCE_GROUP_DOES_NOT_EXIST`
const ErrorCodeMaxBlockSizeExceeded ErrorCode = `MAX_BLOCK_SIZE_EXCEEDED`
const ErrorCodeMaxChildNodeSizeExceeded ErrorCode = `MAX_CHILD_NODE_SIZE_EXCEEDED`
const ErrorCodeMaxListSizeExceeded ErrorCode = `MAX_LIST_SIZE_EXCEEDED`
const ErrorCodeMaxNotebookSizeExceeded ErrorCode = `MAX_NOTEBOOK_SIZE_EXCEEDED`
const ErrorCodeMaxReadSizeExceeded ErrorCode = `MAX_READ_SIZE_EXCEEDED`
const ErrorCodeMetastoreAlreadyExists ErrorCode = `METASTORE_ALREADY_EXISTS`
const ErrorCodeMetastoreDoesNotExist ErrorCode = `METASTORE_DOES_NOT_EXIST`
const ErrorCodeMetastoreNotEmpty ErrorCode = `METASTORE_NOT_EMPTY`
const ErrorCodeNotFound ErrorCode = `NOT_FOUND`
const ErrorCodeNotImplemented ErrorCode = `NOT_IMPLEMENTED`
const ErrorCodePartialDelete ErrorCode = `PARTIAL_DELETE`
const ErrorCodePermissionDenied ErrorCode = `PERMISSION_DENIED`
const ErrorCodePermissionNotPropagated ErrorCode = `PERMISSION_NOT_PROPAGATED`
const ErrorCodePrincipalDoesNotExist ErrorCode = `PRINCIPAL_DOES_NOT_EXIST`
const ErrorCodeProjectsOperationTimeout ErrorCode = `PROJECTS_OPERATION_TIMEOUT`
const ErrorCodeProviderAlreadyExists ErrorCode = `PROVIDER_ALREADY_EXISTS`
const ErrorCodeProviderDoesNotExist ErrorCode = `PROVIDER_DOES_NOT_EXIST`
const ErrorCodeProviderShareNotAccessible ErrorCode = `PROVIDER_SHARE_NOT_ACCESSIBLE`
const ErrorCodeQuotaExceeded ErrorCode = `QUOTA_EXCEEDED`
const ErrorCodeRecipientAlreadyExists ErrorCode = `RECIPIENT_ALREADY_EXISTS`
const ErrorCodeRecipientDoesNotExist ErrorCode = `RECIPIENT_DOES_NOT_EXIST`
const ErrorCodeRequestLimitExceeded ErrorCode = `REQUEST_LIMIT_EXCEEDED`
const ErrorCodeResourceAlreadyExists ErrorCode = `RESOURCE_ALREADY_EXISTS`
const ErrorCodeResourceConflict ErrorCode = `RESOURCE_CONFLICT`
const ErrorCodeResourceDoesNotExist ErrorCode = `RESOURCE_DOES_NOT_EXIST`
const ErrorCodeResourceExhausted ErrorCode = `RESOURCE_EXHAUSTED`
const ErrorCodeResourceLimitExceeded ErrorCode = `RESOURCE_LIMIT_EXCEEDED`
const ErrorCodeSchemaAlreadyExists ErrorCode = `SCHEMA_ALREADY_EXISTS`
const ErrorCodeSchemaDoesNotExist ErrorCode = `SCHEMA_DOES_NOT_EXIST`
const ErrorCodeSchemaNotEmpty ErrorCode = `SCHEMA_NOT_EMPTY`
const ErrorCodeSearchQueryTooLong ErrorCode = `SEARCH_QUERY_TOO_LONG`
const ErrorCodeSearchQueryTooShort ErrorCode = `SEARCH_QUERY_TOO_SHORT`
const ErrorCodeServiceUnderMaintenance ErrorCode = `SERVICE_UNDER_MAINTENANCE`
const ErrorCodeShareAlreadyExists ErrorCode = `SHARE_ALREADY_EXISTS`
const ErrorCodeShareDoesNotExist ErrorCode = `SHARE_DOES_NOT_EXIST`
const ErrorCodeStorageCredentialAlreadyExists ErrorCode = `STORAGE_CREDENTIAL_ALREADY_EXISTS`
const ErrorCodeStorageCredentialDoesNotExist ErrorCode = `STORAGE_CREDENTIAL_DOES_NOT_EXIST`
const ErrorCodeTableAlreadyExists ErrorCode = `TABLE_ALREADY_EXISTS`
const ErrorCodeTableDoesNotExist ErrorCode = `TABLE_DOES_NOT_EXIST`
const ErrorCodeTemporarilyUnavailable ErrorCode = `TEMPORARILY_UNAVAILABLE`
const ErrorCodeUnauthenticated ErrorCode = `UNAUTHENTICATED`
const ErrorCodeUnavailable ErrorCode = `UNAVAILABLE`
const ErrorCodeUnknown ErrorCode = `UNKNOWN`
const ErrorCodeUnparseableHttpError ErrorCode = `UNPARSEABLE_HTTP_ERROR`
const ErrorCodeWorkspaceTemporarilyUnavailable ErrorCode = `WORKSPACE_TEMPORARILY_UNAVAILABLE`

func (*ErrorCode) Set

func (f *ErrorCode) Set(v string) error

Set raw string value and validate it against allowed values

func (*ErrorCode) String

func (f *ErrorCode) String() string

String representation for fmt.Print

func (*ErrorCode) Type

func (f *ErrorCode) Type() string

Type always returns ErrorCode to satisfy [pflag.Value] interface

func (*ErrorCode) Values

func (f *ErrorCode) Values() []ErrorCode

Values returns all possible values for ErrorCode.

There is no guarantee on the order of the values in the slice.

type GenerateDatabaseCredentialRequest added in v0.98.0

type GenerateDatabaseCredentialRequest struct {
	// The returned token will be scoped to UC tables with the specified
	// permissions.
	Claims []RequestedClaims `json:"claims,omitempty"`
	// This field is not yet supported. The endpoint for which this credential
	// will be generated. Format:
	// projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id}
	Endpoint string `json:"endpoint"`
}

type GetBranchRequest

type GetBranchRequest struct {
	// The resource name of the branch to retrieve. Format:
	// `projects/{project_id}/branches/{branch_id}`
	Name string `json:"-" url:"-"`
}

type GetEndpointRequest

type GetEndpointRequest struct {
	// The resource name of the endpoint to retrieve. Format:
	// `projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id}`
	Name string `json:"-" url:"-"`
}

type GetOperationRequest

type GetOperationRequest struct {
	// The name of the operation resource.
	Name string `json:"-" url:"-"`
}

type GetProjectRequest

type GetProjectRequest struct {
	// The resource name of the project to retrieve. Format:
	// `projects/{project_id}`
	Name string `json:"-" url:"-"`
}

type GetRoleRequest added in v0.96.0

type GetRoleRequest struct {
	// The name of the Role to retrieve. Format:
	// projects/{project_id}/branches/{branch_id}/roles/{role_id}
	Name string `json:"-" url:"-"`
}

type ListBranchesRequest

type ListBranchesRequest struct {
	// Upper bound for items returned. Cannot be negative.
	PageSize int `json:"-" url:"page_size,omitempty"`
	// Page token from a previous response. If not provided, returns the first
	// page.
	PageToken string `json:"-" url:"page_token,omitempty"`
	// The Project that owns this collection of branches. Format:
	// projects/{project_id}
	Parent string `json:"-" url:"-"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (ListBranchesRequest) MarshalJSON

func (s ListBranchesRequest) MarshalJSON() ([]byte, error)

func (*ListBranchesRequest) UnmarshalJSON

func (s *ListBranchesRequest) UnmarshalJSON(b []byte) error

type ListBranchesResponse

type ListBranchesResponse struct {
	// List of database branches in the project.
	Branches []Branch `json:"branches,omitempty"`
	// Token to request the next page of database branches.
	NextPageToken string `json:"next_page_token,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (ListBranchesResponse) MarshalJSON

func (s ListBranchesResponse) MarshalJSON() ([]byte, error)

func (*ListBranchesResponse) UnmarshalJSON

func (s *ListBranchesResponse) UnmarshalJSON(b []byte) error

type ListEndpointsRequest

type ListEndpointsRequest struct {
	// Upper bound for items returned. Cannot be negative.
	PageSize int `json:"-" url:"page_size,omitempty"`
	// Page token from a previous response. If not provided, returns the first
	// page.
	PageToken string `json:"-" url:"page_token,omitempty"`
	// The Branch that owns this collection of endpoints. Format:
	// projects/{project_id}/branches/{branch_id}
	Parent string `json:"-" url:"-"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (ListEndpointsRequest) MarshalJSON

func (s ListEndpointsRequest) MarshalJSON() ([]byte, error)

func (*ListEndpointsRequest) UnmarshalJSON

func (s *ListEndpointsRequest) UnmarshalJSON(b []byte) error

type ListEndpointsResponse

type ListEndpointsResponse struct {
	// List of compute endpoints in the branch.
	Endpoints []Endpoint `json:"endpoints,omitempty"`
	// Token to request the next page of compute endpoints.
	NextPageToken string `json:"next_page_token,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (ListEndpointsResponse) MarshalJSON

func (s ListEndpointsResponse) MarshalJSON() ([]byte, error)

func (*ListEndpointsResponse) UnmarshalJSON

func (s *ListEndpointsResponse) UnmarshalJSON(b []byte) error

type ListProjectsRequest

type ListProjectsRequest struct {
	// Upper bound for items returned. Cannot be negative.
	PageSize int `json:"-" url:"page_size,omitempty"`
	// Page token from a previous response. If not provided, returns the first
	// page.
	PageToken string `json:"-" url:"page_token,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (ListProjectsRequest) MarshalJSON

func (s ListProjectsRequest) MarshalJSON() ([]byte, error)

func (*ListProjectsRequest) UnmarshalJSON

func (s *ListProjectsRequest) UnmarshalJSON(b []byte) error

type ListProjectsResponse

type ListProjectsResponse struct {
	// Token to request the next page of database projects.
	NextPageToken string `json:"next_page_token,omitempty"`
	// List of all database projects in the workspace that the user has
	// permission to access.
	Projects []Project `json:"projects,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (ListProjectsResponse) MarshalJSON

func (s ListProjectsResponse) MarshalJSON() ([]byte, error)

func (*ListProjectsResponse) UnmarshalJSON

func (s *ListProjectsResponse) UnmarshalJSON(b []byte) error

type ListRolesRequest added in v0.96.0

type ListRolesRequest struct {
	// Upper bound for items returned. Cannot be negative.
	PageSize int `json:"-" url:"page_size,omitempty"`
	// Page token from a previous response. If not provided, returns the first
	// page.
	PageToken string `json:"-" url:"page_token,omitempty"`
	// The Branch that owns this collection of roles. Format:
	// projects/{project_id}/branches/{branch_id}
	Parent string `json:"-" url:"-"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (ListRolesRequest) MarshalJSON added in v0.96.0

func (s ListRolesRequest) MarshalJSON() ([]byte, error)

func (*ListRolesRequest) UnmarshalJSON added in v0.96.0

func (s *ListRolesRequest) UnmarshalJSON(b []byte) error

type ListRolesResponse added in v0.96.0

type ListRolesResponse struct {
	// Token to request the next page of Postgres roles.
	NextPageToken string `json:"next_page_token,omitempty"`
	// List of Postgres roles in the branch.
	Roles []Role `json:"roles,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (ListRolesResponse) MarshalJSON added in v0.96.0

func (s ListRolesResponse) MarshalJSON() ([]byte, error)

func (*ListRolesResponse) UnmarshalJSON added in v0.96.0

func (s *ListRolesResponse) UnmarshalJSON(b []byte) error

type Operation

type Operation struct {
	// If the value is `false`, it means the operation is still in progress. If
	// `true`, the operation is completed, and either `error` or `response` is
	// available.
	Done bool `json:"done,omitempty"`
	// The error result of the operation in case of failure or cancellation.
	Error *DatabricksServiceExceptionWithDetailsProto `json:"error,omitempty"`
	// Service-specific metadata associated with the operation. It typically
	// contains progress information and common metadata such as create time.
	// Some services might not provide such metadata.
	Metadata json.RawMessage `json:"metadata,omitempty"`
	// The server-assigned name, which is only unique within the same service
	// that originally returns it. If you use the default HTTP mapping, the
	// `name` should be a resource name ending with `operations/{unique_id}`.
	Name string `json:"name,omitempty"`
	// The normal, successful response of the operation.
	Response json.RawMessage `json:"response,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

This resource represents a long-running operation that is the result of a network API call.

func (Operation) MarshalJSON

func (s Operation) MarshalJSON() ([]byte, error)

func (*Operation) UnmarshalJSON

func (s *Operation) UnmarshalJSON(b []byte) error

type PostgresAPI

type PostgresAPI struct {
	// contains filtered or unexported fields
}

Use the Postgres API to create and manage Lakebase Autoscaling Postgres infrastructure, including projects, branches, compute endpoints, and roles.

This API manages database infrastructure only. To query or modify data, use the Data API or direct SQL connections.

**About resource IDs and names**

Lakebase APIs use hierarchical resource names in API paths to identify resources, such as `projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id}`.

When creating a resource, you may optionally provide the final ID component (for example, `project_id`, `branch_id`, or `endpoint_id`). If you do not, the system generates an identifier and uses it as the ID component.

The `name` field is output-only and represents the full resource path. Note: The term *resource name* in this API refers to this full, hierarchical identifier (for example, `projects/{project_id}`), not the `display_name` field. The `display_name` is a separate, user-visible label shown in the UI.

The `uid` field is a system-generated, immutable identifier intended for internal reference and should not be used to address or locate resources.

func NewPostgres

func NewPostgres(client *client.DatabricksClient) *PostgresAPI

func (*PostgresAPI) CreateBranch

func (*PostgresAPI) CreateEndpoint

func (*PostgresAPI) CreateProject

func (*PostgresAPI) CreateRole added in v0.96.0

func (*PostgresAPI) DeleteBranch

func (*PostgresAPI) DeleteEndpoint

func (*PostgresAPI) DeleteProject

func (*PostgresAPI) DeleteRole added in v0.96.0

func (*PostgresAPI) GenerateDatabaseCredential added in v0.98.0

func (a *PostgresAPI) GenerateDatabaseCredential(ctx context.Context, request GenerateDatabaseCredentialRequest) (*DatabaseCredential, error)

func (*PostgresAPI) GetBranch

func (a *PostgresAPI) GetBranch(ctx context.Context, request GetBranchRequest) (*Branch, error)

func (*PostgresAPI) GetEndpoint

func (a *PostgresAPI) GetEndpoint(ctx context.Context, request GetEndpointRequest) (*Endpoint, error)

func (*PostgresAPI) GetOperation

func (a *PostgresAPI) GetOperation(ctx context.Context, request GetOperationRequest) (*Operation, error)

func (*PostgresAPI) GetProject

func (a *PostgresAPI) GetProject(ctx context.Context, request GetProjectRequest) (*Project, error)

func (*PostgresAPI) GetRole added in v0.96.0

func (a *PostgresAPI) GetRole(ctx context.Context, request GetRoleRequest) (*Role, error)

func (*PostgresAPI) ListBranches

func (a *PostgresAPI) ListBranches(ctx context.Context, request ListBranchesRequest) listing.Iterator[Branch]

Returns a paginated list of database branches in the project.

func (*PostgresAPI) ListBranchesAll

func (a *PostgresAPI) ListBranchesAll(ctx context.Context, request ListBranchesRequest) ([]Branch, error)

Returns a paginated list of database branches in the project.

func (*PostgresAPI) ListEndpoints

func (a *PostgresAPI) ListEndpoints(ctx context.Context, request ListEndpointsRequest) listing.Iterator[Endpoint]

Returns a paginated list of compute endpoints in the branch.

func (*PostgresAPI) ListEndpointsAll

func (a *PostgresAPI) ListEndpointsAll(ctx context.Context, request ListEndpointsRequest) ([]Endpoint, error)

Returns a paginated list of compute endpoints in the branch.

func (*PostgresAPI) ListProjects

func (a *PostgresAPI) ListProjects(ctx context.Context, request ListProjectsRequest) listing.Iterator[Project]

Returns a paginated list of database projects in the workspace that the user has permission to access.

func (*PostgresAPI) ListProjectsAll

func (a *PostgresAPI) ListProjectsAll(ctx context.Context, request ListProjectsRequest) ([]Project, error)

Returns a paginated list of database projects in the workspace that the user has permission to access.

func (*PostgresAPI) ListRoles added in v0.96.0

func (a *PostgresAPI) ListRoles(ctx context.Context, request ListRolesRequest) listing.Iterator[Role]

Returns a paginated list of Postgres roles in the branch.

func (*PostgresAPI) ListRolesAll added in v0.96.0

func (a *PostgresAPI) ListRolesAll(ctx context.Context, request ListRolesRequest) ([]Role, error)

Returns a paginated list of Postgres roles in the branch.

func (*PostgresAPI) UpdateBranch

func (*PostgresAPI) UpdateEndpoint

func (*PostgresAPI) UpdateProject

type PostgresInterface

type PostgresInterface interface {
	CreateBranch(ctx context.Context, request CreateBranchRequest) (CreateBranchOperationInterface, error)

	CreateEndpoint(ctx context.Context, request CreateEndpointRequest) (CreateEndpointOperationInterface, error)

	CreateProject(ctx context.Context, request CreateProjectRequest) (CreateProjectOperationInterface, error)

	CreateRole(ctx context.Context, request CreateRoleRequest) (CreateRoleOperationInterface, error)

	DeleteBranch(ctx context.Context, request DeleteBranchRequest) (DeleteBranchOperationInterface, error)

	DeleteEndpoint(ctx context.Context, request DeleteEndpointRequest) (DeleteEndpointOperationInterface, error)

	DeleteProject(ctx context.Context, request DeleteProjectRequest) (DeleteProjectOperationInterface, error)

	DeleteRole(ctx context.Context, request DeleteRoleRequest) (DeleteRoleOperationInterface, error)

	// Generate OAuth credentials for a Postgres database.
	GenerateDatabaseCredential(ctx context.Context, request GenerateDatabaseCredentialRequest) (*DatabaseCredential, error)

	// Retrieves information about the specified database branch.
	GetBranch(ctx context.Context, request GetBranchRequest) (*Branch, error)

	// Retrieves information about the specified compute endpoint, including its
	// connection details and operational state.
	GetEndpoint(ctx context.Context, request GetEndpointRequest) (*Endpoint, error)

	// Retrieves the status of a long-running operation.
	GetOperation(ctx context.Context, request GetOperationRequest) (*Operation, error)

	// Retrieves information about the specified database project.
	GetProject(ctx context.Context, request GetProjectRequest) (*Project, error)

	// Retrieves information about the specified Postgres role, including its
	// authentication method and permissions.
	GetRole(ctx context.Context, request GetRoleRequest) (*Role, error)

	// Returns a paginated list of database branches in the project.
	//
	// This method is generated by Databricks SDK Code Generator.
	ListBranches(ctx context.Context, request ListBranchesRequest) listing.Iterator[Branch]

	// Returns a paginated list of database branches in the project.
	//
	// This method is generated by Databricks SDK Code Generator.
	ListBranchesAll(ctx context.Context, request ListBranchesRequest) ([]Branch, error)

	// Returns a paginated list of compute endpoints in the branch.
	//
	// This method is generated by Databricks SDK Code Generator.
	ListEndpoints(ctx context.Context, request ListEndpointsRequest) listing.Iterator[Endpoint]

	// Returns a paginated list of compute endpoints in the branch.
	//
	// This method is generated by Databricks SDK Code Generator.
	ListEndpointsAll(ctx context.Context, request ListEndpointsRequest) ([]Endpoint, error)

	// Returns a paginated list of database projects in the workspace that the user
	// has permission to access.
	//
	// This method is generated by Databricks SDK Code Generator.
	ListProjects(ctx context.Context, request ListProjectsRequest) listing.Iterator[Project]

	// Returns a paginated list of database projects in the workspace that the user
	// has permission to access.
	//
	// This method is generated by Databricks SDK Code Generator.
	ListProjectsAll(ctx context.Context, request ListProjectsRequest) ([]Project, error)

	// Returns a paginated list of Postgres roles in the branch.
	//
	// This method is generated by Databricks SDK Code Generator.
	ListRoles(ctx context.Context, request ListRolesRequest) listing.Iterator[Role]

	// Returns a paginated list of Postgres roles in the branch.
	//
	// This method is generated by Databricks SDK Code Generator.
	ListRolesAll(ctx context.Context, request ListRolesRequest) ([]Role, error)

	UpdateBranch(ctx context.Context, request UpdateBranchRequest) (UpdateBranchOperationInterface, error)

	UpdateEndpoint(ctx context.Context, request UpdateEndpointRequest) (UpdateEndpointOperationInterface, error)

	UpdateProject(ctx context.Context, request UpdateProjectRequest) (UpdateProjectOperationInterface, error)
}

type PostgresService deprecated

type PostgresService interface {

	// Creates a new database branch in the project.
	CreateBranch(ctx context.Context, request CreateBranchRequest) (*Operation, error)

	// Creates a new compute endpoint in the branch.
	CreateEndpoint(ctx context.Context, request CreateEndpointRequest) (*Operation, error)

	// Creates a new Lakebase Autoscaling Postgres database project, which
	// contains branches and compute endpoints.
	CreateProject(ctx context.Context, request CreateProjectRequest) (*Operation, error)

	// Creates a new Postgres role in the branch.
	CreateRole(ctx context.Context, request CreateRoleRequest) (*Operation, error)

	// Deletes the specified database branch.
	DeleteBranch(ctx context.Context, request DeleteBranchRequest) (*Operation, error)

	// Deletes the specified compute endpoint.
	DeleteEndpoint(ctx context.Context, request DeleteEndpointRequest) (*Operation, error)

	// Deletes the specified database project.
	DeleteProject(ctx context.Context, request DeleteProjectRequest) (*Operation, error)

	// Deletes the specified Postgres role.
	DeleteRole(ctx context.Context, request DeleteRoleRequest) (*Operation, error)

	// Generate OAuth credentials for a Postgres database.
	GenerateDatabaseCredential(ctx context.Context, request GenerateDatabaseCredentialRequest) (*DatabaseCredential, error)

	// Retrieves information about the specified database branch.
	GetBranch(ctx context.Context, request GetBranchRequest) (*Branch, error)

	// Retrieves information about the specified compute endpoint, including its
	// connection details and operational state.
	GetEndpoint(ctx context.Context, request GetEndpointRequest) (*Endpoint, error)

	// Retrieves the status of a long-running operation.
	GetOperation(ctx context.Context, request GetOperationRequest) (*Operation, error)

	// Retrieves information about the specified database project.
	GetProject(ctx context.Context, request GetProjectRequest) (*Project, error)

	// Retrieves information about the specified Postgres role, including its
	// authentication method and permissions.
	GetRole(ctx context.Context, request GetRoleRequest) (*Role, error)

	// Returns a paginated list of database branches in the project.
	ListBranches(ctx context.Context, request ListBranchesRequest) (*ListBranchesResponse, error)

	// Returns a paginated list of compute endpoints in the branch.
	ListEndpoints(ctx context.Context, request ListEndpointsRequest) (*ListEndpointsResponse, error)

	// Returns a paginated list of database projects in the workspace that the
	// user has permission to access.
	ListProjects(ctx context.Context, request ListProjectsRequest) (*ListProjectsResponse, error)

	// Returns a paginated list of Postgres roles in the branch.
	ListRoles(ctx context.Context, request ListRolesRequest) (*ListRolesResponse, error)

	// Updates the specified database branch. You can set this branch as the
	// project's default branch, or protect/unprotect it.
	UpdateBranch(ctx context.Context, request UpdateBranchRequest) (*Operation, error)

	// Updates the specified compute endpoint. You can update autoscaling
	// limits, suspend timeout, or enable/disable the compute endpoint.
	UpdateEndpoint(ctx context.Context, request UpdateEndpointRequest) (*Operation, error)

	// Updates the specified database project.
	UpdateProject(ctx context.Context, request UpdateProjectRequest) (*Operation, error)
}

Use the Postgres API to create and manage Lakebase Autoscaling Postgres infrastructure, including projects, branches, compute endpoints, and roles.

This API manages database infrastructure only. To query or modify data, use the Data API or direct SQL connections.

**About resource IDs and names**

Lakebase APIs use hierarchical resource names in API paths to identify resources, such as `projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id}`.

When creating a resource, you may optionally provide the final ID component (for example, `project_id`, `branch_id`, or `endpoint_id`). If you do not, the system generates an identifier and uses it as the ID component.

The `name` field is output-only and represents the full resource path. Note: The term *resource name* in this API refers to this full, hierarchical identifier (for example, `projects/{project_id}`), not the `display_name` field. The `display_name` is a separate, user-visible label shown in the UI.

The `uid` field is a system-generated, immutable identifier intended for internal reference and should not be used to address or locate resources.

Deprecated: Do not use this interface, it will be removed in a future version of the SDK.

type Project

type Project struct {
	// A timestamp indicating when the project was created.
	CreateTime *time.Time `json:"create_time,omitempty"`
	// The resource name of the project. This field is output-only and
	// constructed by the system. Format: `projects/{project_id}`
	Name string `json:"name,omitempty"`
	// The spec contains the project configuration, including display_name,
	// pg_version (Postgres version), history_retention_duration, and
	// default_endpoint_settings.
	Spec *ProjectSpec `json:"spec,omitempty"`
	// The current status of a Project.
	Status *ProjectStatus `json:"status,omitempty"`
	// System-generated unique ID for the project.
	Uid string `json:"uid,omitempty"`
	// A timestamp indicating when the project was last updated.
	UpdateTime *time.Time `json:"update_time,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (Project) MarshalJSON

func (s Project) MarshalJSON() ([]byte, error)

func (*Project) UnmarshalJSON

func (s *Project) UnmarshalJSON(b []byte) error

type ProjectDefaultEndpointSettings

type ProjectDefaultEndpointSettings struct {
	// The maximum number of Compute Units. Minimum value is 0.5.
	AutoscalingLimitMaxCu float64 `json:"autoscaling_limit_max_cu,omitempty"`
	// The minimum number of Compute Units. Minimum value is 0.5.
	AutoscalingLimitMinCu float64 `json:"autoscaling_limit_min_cu,omitempty"`
	// A raw representation of Postgres settings.
	PgSettings map[string]string `json:"pg_settings,omitempty"`
	// Duration of inactivity after which the compute endpoint is automatically
	// suspended. Supported values: -1s (never suspend), 0s (use default), or
	// value should be between 60s and 604800s (1 minute to 1 week).
	SuspendTimeoutDuration *duration.Duration `json:"suspend_timeout_duration,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

A collection of settings for a compute endpoint.

func (ProjectDefaultEndpointSettings) MarshalJSON

func (s ProjectDefaultEndpointSettings) MarshalJSON() ([]byte, error)

func (*ProjectDefaultEndpointSettings) UnmarshalJSON

func (s *ProjectDefaultEndpointSettings) UnmarshalJSON(b []byte) error

type ProjectOperationMetadata

type ProjectOperationMetadata struct {
}

type ProjectSpec added in v0.96.0

type ProjectSpec struct {
	DefaultEndpointSettings *ProjectDefaultEndpointSettings `json:"default_endpoint_settings,omitempty"`
	// Human-readable project name. Length should be between 1 and 256
	// characters.
	DisplayName string `json:"display_name,omitempty"`
	// The number of seconds to retain the shared history for point in time
	// recovery for all branches in this project. Value should be between 0s and
	// 2592000s (up to 30 days).
	HistoryRetentionDuration *duration.Duration `json:"history_retention_duration,omitempty"`
	// The major Postgres version number. Supported versions are 16 and 17.
	PgVersion int `json:"pg_version,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (ProjectSpec) MarshalJSON added in v0.96.0

func (s ProjectSpec) MarshalJSON() ([]byte, error)

func (*ProjectSpec) UnmarshalJSON added in v0.96.0

func (s *ProjectSpec) UnmarshalJSON(b []byte) error

type ProjectStatus added in v0.96.0

type ProjectStatus struct {
	// The logical size limit for a branch.
	BranchLogicalSizeLimitBytes int64 `json:"branch_logical_size_limit_bytes,omitempty"`
	// The effective default endpoint settings.
	DefaultEndpointSettings *ProjectDefaultEndpointSettings `json:"default_endpoint_settings,omitempty"`
	// The effective human-readable project name.
	DisplayName string `json:"display_name,omitempty"`
	// The effective number of seconds to retain the shared history for point in
	// time recovery.
	HistoryRetentionDuration *duration.Duration `json:"history_retention_duration,omitempty"`
	// The email of the project owner.
	Owner string `json:"owner,omitempty"`
	// The effective major Postgres version number.
	PgVersion int `json:"pg_version,omitempty"`
	// The current space occupied by the project in storage.
	SyntheticStorageSizeBytes int64 `json:"synthetic_storage_size_bytes,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (ProjectStatus) MarshalJSON added in v0.96.0

func (s ProjectStatus) MarshalJSON() ([]byte, error)

func (*ProjectStatus) UnmarshalJSON added in v0.96.0

func (s *ProjectStatus) UnmarshalJSON(b []byte) error

type RequestedClaims added in v0.98.0

type RequestedClaims struct {
	PermissionSet RequestedClaimsPermissionSet `json:"permission_set,omitempty"`

	Resources []RequestedResource `json:"resources,omitempty"`
}

type RequestedClaimsPermissionSet added in v0.98.0

type RequestedClaimsPermissionSet string
const RequestedClaimsPermissionSetReadOnly RequestedClaimsPermissionSet = `READ_ONLY`

func (*RequestedClaimsPermissionSet) Set added in v0.98.0

Set raw string value and validate it against allowed values

func (*RequestedClaimsPermissionSet) String added in v0.98.0

String representation for fmt.Print

func (*RequestedClaimsPermissionSet) Type added in v0.98.0

Type always returns RequestedClaimsPermissionSet to satisfy [pflag.Value] interface

func (*RequestedClaimsPermissionSet) Values added in v0.98.0

Values returns all possible values for RequestedClaimsPermissionSet.

There is no guarantee on the order of the values in the slice.

type RequestedResource added in v0.98.0

type RequestedResource struct {
	TableName string `json:"table_name,omitempty"`

	UnspecifiedResourceName string `json:"unspecified_resource_name,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

func (RequestedResource) MarshalJSON added in v0.98.0

func (s RequestedResource) MarshalJSON() ([]byte, error)

func (*RequestedResource) UnmarshalJSON added in v0.98.0

func (s *RequestedResource) UnmarshalJSON(b []byte) error

type Role added in v0.96.0

type Role struct {
	CreateTime *time.Time `json:"create_time,omitempty"`
	// The resource name of the role. Format:
	// projects/{project_id}/branches/{branch_id}/roles/{role_id}
	Name string `json:"name,omitempty"`
	// The Branch where this Role exists. Format:
	// projects/{project_id}/branches/{branch_id}
	Parent string `json:"parent,omitempty"`
	// The spec contains the role configuration, including identity type,
	// authentication method, and role attributes.
	Spec *RoleRoleSpec `json:"spec,omitempty"`
	// Current status of the role, including its identity type, authentication
	// method, and role attributes.
	Status *RoleRoleStatus `json:"status,omitempty"`

	UpdateTime *time.Time `json:"update_time,omitempty"`

	ForceSendFields []string `json:"-" url:"-"`
}

Role represents a Postgres role within a Branch.

func (Role) MarshalJSON added in v0.96.0

func (s Role) MarshalJSON() ([]byte, error)

func (*Role) UnmarshalJSON added in v0.96.0

func (s *Role) UnmarshalJSON(b []byte) error

type RoleAuthMethod added in v0.96.0

type RoleAuthMethod string

How the role is authenticated when connecting to Postgres.

const RoleAuthMethodLakebaseOauthV1 RoleAuthMethod = `LAKEBASE_OAUTH_V1`
const RoleAuthMethodNoLogin RoleAuthMethod = `NO_LOGIN`
const RoleAuthMethodPgPasswordScramSha256 RoleAuthMethod = `PG_PASSWORD_SCRAM_SHA_256`

func (*RoleAuthMethod) Set added in v0.96.0

func (f *RoleAuthMethod) Set(v string) error

Set raw string value and validate it against allowed values

func (*RoleAuthMethod) String added in v0.96.0

func (f *RoleAuthMethod) String() string

String representation for fmt.Print

func (*RoleAuthMethod) Type added in v0.96.0

func (f *RoleAuthMethod) Type() string

Type always returns RoleAuthMethod to satisfy [pflag.Value] interface

func (*RoleAuthMethod) Values added in v0.96.0

func (f *RoleAuthMethod) Values() []RoleAuthMethod

Values returns all possible values for RoleAuthMethod.

There is no guarantee on the order of the values in the slice.

type RoleIdentityType added in v0.96.0

type RoleIdentityType string

The type of the Databricks managed identity that this Role represents. Leave empty if you wish to create a regular Postgres role not associated with a Databricks identity.

const RoleIdentityTypeGroup RoleIdentityType = `GROUP`
const RoleIdentityTypeServicePrincipal RoleIdentityType = `SERVICE_PRINCIPAL`
const RoleIdentityTypeUser RoleIdentityType = `USER`

func (*RoleIdentityType) Set added in v0.96.0

func (f *RoleIdentityType) Set(v string) error

Set raw string value and validate it against allowed values

func (*RoleIdentityType) String added in v0.96.0

func (f *RoleIdentityType) String() string

String representation for fmt.Print

func (*RoleIdentityType) Type added in v0.96.0

func (f *RoleIdentityType) Type() string

Type always returns RoleIdentityType to satisfy [pflag.Value] interface

func (*RoleIdentityType) Values added in v0.96.0

func (f *RoleIdentityType) Values() []RoleIdentityType

Values returns all possible values for RoleIdentityType.

There is no guarantee on the order of the values in the slice.

type RoleOperationMetadata added in v0.96.0

type RoleOperationMetadata struct {
}

type RoleRoleSpec added in v0.96.0

type RoleRoleSpec struct {
	// If auth_method is left unspecified, a meaningful authentication method is
	// derived from the identity_type: * For the managed identities, OAUTH is
	// used. * For the regular postgres roles, authentication based on postgres
	// passwords is used.
	//
	// NOTE: this is ignored for the Databricks identity type GROUP, and
	// NO_LOGIN is implicitly assumed instead for the GROUP identity type.
	AuthMethod RoleAuthMethod `json:"auth_method,omitempty"`
	// The type of role. When specifying a managed-identity, the chosen role_id
	// must be a valid:
	//
	// * application ID for SERVICE_PRINCIPAL * user email for USER * group name
	// for GROUP
	IdentityType RoleIdentityType `json:"identity_type,omitempty"`
}

type RoleRoleStatus added in v0.96.0

type RoleRoleStatus struct {
	AuthMethod RoleAuthMethod `json:"auth_method,omitempty"`
	// The type of the role.
	IdentityType RoleIdentityType `json:"identity_type,omitempty"`
}

type UpdateBranchOperationInterface

type UpdateBranchOperationInterface interface {

	// Wait blocks until the long-running operation is completed. If no timeout is
	// specified, this will poll indefinitely. If a timeout is provided and the operation
	// didn't finish within the timeout, this function will return an error, otherwise
	// returns successful response and any errors encountered.
	Wait(ctx context.Context, opts ...api.Option) (*Branch, error)

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*BranchOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type UpdateBranchRequest

type UpdateBranchRequest struct {
	// The Branch to update.
	//
	// The branch's `name` field is used to identify the branch to update.
	// Format: projects/{project_id}/branches/{branch_id}
	Branch Branch `json:"branch"`
	// The resource name of the branch. This field is output-only and
	// constructed by the system. Format:
	// `projects/{project_id}/branches/{branch_id}`
	Name string `json:"-" url:"-"`
	// The list of fields to update. If unspecified, all fields will be updated
	// when possible.
	UpdateMask fieldmask.FieldMask `json:"-" url:"update_mask"`
}

type UpdateEndpointOperationInterface

type UpdateEndpointOperationInterface interface {

	// Wait blocks until the long-running operation is completed. If no timeout is
	// specified, this will poll indefinitely. If a timeout is provided and the operation
	// didn't finish within the timeout, this function will return an error, otherwise
	// returns successful response and any errors encountered.
	Wait(ctx context.Context, opts ...api.Option) (*Endpoint, error)

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*EndpointOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type UpdateEndpointRequest

type UpdateEndpointRequest struct {
	// The Endpoint to update.
	//
	// The endpoint's `name` field is used to identify the endpoint to update.
	// Format:
	// projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id}
	Endpoint Endpoint `json:"endpoint"`
	// The resource name of the endpoint. This field is output-only and
	// constructed by the system. Format:
	// `projects/{project_id}/branches/{branch_id}/endpoints/{endpoint_id}`
	Name string `json:"-" url:"-"`
	// The list of fields to update. If unspecified, all fields will be updated
	// when possible.
	UpdateMask fieldmask.FieldMask `json:"-" url:"update_mask"`
}

type UpdateProjectOperationInterface

type UpdateProjectOperationInterface interface {

	// Wait blocks until the long-running operation is completed. If no timeout is
	// specified, this will poll indefinitely. If a timeout is provided and the operation
	// didn't finish within the timeout, this function will return an error, otherwise
	// returns successful response and any errors encountered.
	Wait(ctx context.Context, opts ...api.Option) (*Project, error)

	// Name returns the name of the long-running operation. The name is assigned
	// by the server and is unique within the service from which the operation is created.
	Name() string

	// Metadata returns metadata associated with the long-running operation.
	// If the metadata is not available, the returned metadata and error are both nil.
	Metadata() (*ProjectOperationMetadata, error)

	// Done reports whether the long-running operation has completed.
	Done() (bool, error)
}

type UpdateProjectRequest

type UpdateProjectRequest struct {
	// The resource name of the project. This field is output-only and
	// constructed by the system. Format: `projects/{project_id}`
	Name string `json:"-" url:"-"`
	// The Project to update.
	//
	// The project's `name` field is used to identify the project to update.
	// Format: projects/{project_id}
	Project Project `json:"project"`
	// The list of fields to update. If unspecified, all fields will be updated
	// when possible.
	UpdateMask fieldmask.FieldMask `json:"-" url:"update_mask"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL